Exact binomial probability:
If I understand correctly, you have $X \sim Binom(n=1000, p=.05),$
and you want to know
$$P(|X/1000 - .05| > .015) = 1 - P(35 \le X \le 65) = 0.0242,$$
computed in R statistical software as
1-(pbinom(65, 1000, .05)-pbinom(34, 1000, .05))
## 0.02423487
Normal approximation:
This could be approximated to about two places using $X \sim Norm(\mu=50,\, \sigma=6.892).$ With continuity correction, this is
$1 - P(34.5 < X < 65.5) = 0.0245,$
computed as
1 - diff(pnorm(c(34.5, 65.5), 50, 6.892))
## 0.02451349
Simulation:
Also, as you suggest, this probability can be approximated (to two or three places) by the following simulation: One generates a million
realizations of $X \sim Binom(1000, .05)$ and checks what proportion
of them satisfy the condition $|X/1000 - .05| > .015.$ The answer is 0.0244. (In R, cond
is a logical vector with elements TRUE
and FALSE
, and the mean
of a logical vector is its proportion of TRUE
s.)
x = rbinom(10^6, 1000, .05)
cond = (abs(x/1000 - .05) > .015)
mean(cond)
## 0.024429
The three results are about as near to each other as can be expected.
I am not quite clear how this probability relates to the hypothesis test
you are trying to do. Also, I understand that R is not exactly the same as MatLab. (R is excellent open source software
available free of charge at www.r-project.org
for Windows, Mac, and
UNIX operating systems.)
I hope you can understand the three procedures and make any necessary adaptations
for your specific homework problem.
In the plot below, the histogram shows the simulated distribution of $X,$
the curve is the approximating normal density function, the purple dots
are exact binomial probabilities, and the vertical red lines mark the
desired boundaries.
Best Answer
You can calculate the probability that (1) a fish weighs more than $1.4$kg, or (2) a fish weighs $1.4$kg or less, using the normal distribution
If fish weights are independent, you can then use the binomial distribution to work out the probability that (1) $4$, $5$ or $6$ fish weigh more than $1.4$kg or (2) $0$ or $1$ fish weigh $1.4$kg or less.
Note that the $\le$ in (b) should be $\lt$