What is n value in a confidence interval

75 Views Asked by At

how large must n be if the length of the 99% CI is to be 40? the distribution is normal, sigma= 20.

The book says that the answer is 7, but I keep getting 5.4

This is how I solved it:

(X+Z(sigma/ (root n))- (X-Z(sigma/ (root n))=40 basically, it is Upper Bound-Lower Bound=40. X then cancels out, and it reduces to 2Z(sigma/(root n))=40. When I do invnorm(0.99)=2.326 and plug it in for z, and plug in 20 for sigma and solve the equation, I get 5.4. What am I doing wrong?

2

There are 2 best solutions below

0
On BEST ANSWER

First, find $z$ such that $P(Z \geq z)=0.005$. Note the division by $2$ because your original problem is two-tailed. I get about 2.576 when I do this. So your confidence interval is going to be $2z=5.148$ standard deviations wide. So you need $5.148\sigma/\sqrt{n} \leq 40$, hence $5.148/\sqrt{n} \leq 2$. From this I get $n \geq 7$ as in your book.

So it looks like your only mistake is taking invnorm(0.99) instead of invnorm(0.995).

0
On

The formula for a 2-sided $100(1-\alpha)\%$ confidence interval for the mean of normally distributed data with known variance $\sigma^2$ is $$[L,U] = \left[\bar x - z_{\alpha/2} \frac{\sigma}{\sqrt{n}}, \; \bar x + z_{\alpha/2} \frac{\sigma}{\sqrt{n}}\right],$$ where $\bar x$ is the sample mean, $n$ is the sample size, and $z_{\alpha/2}$ is the upper $\alpha/2$ quantile of the standard normal distribution; i.e., $$\Pr[Z > z_{\alpha/2}] = \alpha/2.$$ So for a 2-sided $99\%$ confidence interval, we require that $$\Pr[-z_{\alpha/2} < Z < z_{\alpha/2}] = 1 - \alpha = 0.99,$$ which is why we wrote $\alpha/2$. The upper $0.5$ percentile of the standard normal distribution is $$z_{0.005} \approx 2.5758293.$$ Therefore, if $U - L = 40$, this is equivalent to $$2z_{0.005} \frac{\sigma}{\sqrt{n}} = 40,$$ or $$n = \left(\frac{2z_{0.005} \sigma}{40}\right)^2 = z_{0.005}^2 \approx 6.63489.$$ But since $n$ is a positive integer, the minimum such $n$ that guarantees the width of the confidence interval is at most $40$ is $n = 7$: the width of the interval decreases with increasing $n$.

What is the actual width of the CI if $n = 7$? It is easily calculated to be approximately $38.94$. If $n = 6$, it is too large, about $42.06$.