In: Statistics and Probability
Consider the following table.
> addmargins(table(mpg$drv,mpg$class))
2seater compact midsize minivan pickup subcompact suv Sum
4 0 12 3 0 33 4 51 103
f 0 35 38 11 0 22 0 106
r 5 0 0 0 0 9 11 25
Sum 5 47 41 11 33 35 62 234
while 38 of the 41 midsize vehicles have front wheel drive. We
wish
the test that the proportion of front wheel drive cars is the same
in
We see that 35 of the 47 compact vehicles have front wheel drive
compact and midsize vehicles. Formally, we will test H0 : pc =
pm vs
Ha : pc 6= pm, where pc and pm are the proportion of front wheel
drive cars in compacts and midsize cars. We will test at the 5%
significance
level. You may assume that the normal approximation is
appropriate
for these problems.
Using prop.test, what is a 95% confidence interval for
pc - pm?
{ a) (0.12, 0.46)
{ b) (-0.57, -0.21)
{ c) (-0.14, 0.58)
{ d) (-0.35, -0.01)
Using prop.test, what is the p value for the test?
{ a) 0.183
{ b) 0.004
{ c) 0.047
{ d) 0.143
Based on the p value, do we reject H0?
(a) yes
(b) no
(c) not enough info to decide
we are given the values of total mid-size vehicles, compact size vehicles that have front-wheel drive.
to be Precise, 35 of the 47 compact vehicles have front-wheel drive and 38 of the 41 mid-size vehicles have front-wheel drive.
therefore, n1= 47,n2 = 41 and X1 = 35 and X2 = 38 .
therefore in the Question, we are asked to find the Values using Prop.test
prop.test can be used in r
the Hypothesis is
H0 : pc = pm
vs
H1: pc pm
therefore, using prop.test in R.
the Syntax is as follows :
prop_test=prop.test(x=c(35,38), n=c(47,41))
prop_test
the Output is as follows:
2-sample test for equality
of proportions with
continuity correction
data: c(35, 38) out of
c(47, 41)
X-squared = 3.9306, df = 1, p-value = 0.04741
alternative hypothesis: two.sided
95 percent confidence interval:
-0.35294827 -0.01134857
sample estimates:
prop 1 prop 2
0.7446809 0.9268293
continuity correction is assumed since we are told that we can use Normal approximation.
q.1.
from the Output, we can see the 95 % confidence interval to be (-0.3529, -0.011)
which corresponds to Option D.
q.2.
the Output also shows the P-value.
the P-value is 0.04741.
which Corresponds to Option C.
q.3.
we have used 0.05 level of significance, therefore L.O.S = 0.05.
the Decision Criterion is
Rej H0 at 5% L.O.S if P-value < L.O.S.
Conclusion :
Since 0.047 < 0.05 , we reject H0 .
which corresponds to option A.