Using R for Introductory Statistics - Verzani Problem 8.6
I am trying to solve the Verzani problem 8.6 in his book, but I have no idea how to.
I have to use the confidence intervals to solve the problem. Here is the picture of the problem: Problem 8.6 A student wishes to find the proportion of left-handed people at her college. She surveys 100 fellow students and finds that only 5 are left-handed. If she computed a 95% confidence interval would it contain the value of p = 1/10?
I have tried to use the confidence interval formulas, I have already solved some of these problems using the confidence interval formula, but I don't know how to solve the last part - would it contain the value of p = 1/10?
Formula I am using
by using this formula, lower is $-0.1410372$ and upper is $0.2410372$.
If someone would help me get an answer so I can learn from it or guide me to an answer.
Thank you so much...
The formula for the Wald CI is as follows:
$$\hat\pi \pm 1.96 \sqrt{\frac{\hat\pi(1-\hat\pi)}{n}}.$$
So using data, you'd use $\hat\pi = 0.05, n = 100.$ This interval is $(0.0073, 0.0927)$ from the computation in R below. It is centered at the point estimate $\hat\pi=0.05$ from data, but it does not contain $\pi = 0.1.$
pi.hat = 5/100
CI.wald = pi.hat + qnorm(c(.025,.975))*sqrt(pi.hat*(1-pi.hat)/100)
CI.wald
[1] 0.007283575 0.092716425
Notes: (1) Because you are using R, you must be careful
never to name a variable as pi
in R, where pi
is
used for a 'reserved constant' $\pi = 3.14159\cdots .$
[It's OK to use variations such as pi.hat
and pi.est
.]
(2) The Wald interval depends of asymptotic arguments and should be used only for samples that are at least moderately large (some use $n \ge 500$ as a rough rule).
The Agresi-Cooll CI is much the same in form as the Wald CI, but more accurate for $n < 500,$ or so. For data $x = 5, n = 100$ it computes to $(0.019, 0.115),$ which does contain the value $\pi = 0.1.$
p.est = (5+2)/(100+4)
CI.agresti = p.est + qnorm(c(.025,.975))*sqrt(p.est*(1-p.est)/104)
CI.agresti
[1] 0.01915363 0.11546176
Another very useful CI for binomial proportions is the Jeffreys interval, which uses a beta distribution. This interval computes to $(0.019,0.1061),$ which also contains the value $\pi = 0.1.$
CI.jeffreys = qbeta(c(.025,.975), 5.5, 95.5)
CI.jeffreys
[1] 0.01933181 0.10610007
Clopper-Pearson 95% CIs tend to be wider than other
styles in order to ensure at least 95% coverage probability in all cases.
This style of CI is provided along with the procedure binom.test
in R. For your data this Ci is $(0.0164, 0.1128).$ It contains the value $\pi = 0.1.$
binom.test(5, 100)$conf.int
[1] 0.01643188 0.11283491
attr(,"conf.level")
[1] 0.95
I mention these additional styles of binomial confidence intervals because the point of this exercise might be to show that the Wald interval doesn't contain the known value $1/10,$ while the some other styles of CIs do.
Ref: All of the styles of CIs illustrated above are discussed in the Wikipedia page on binomial confidence intervals.