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?
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).