10.07.2015 Views

Using R for Introductory Statistics : John Verzani

Using R for Introductory Statistics : John Verzani

Using R for Introductory Statistics : John Verzani

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Using</strong> R <strong>for</strong> introductory statistics 226Let and be the given sample proportions. Our null andalternative hypotheses areH 0 :p 1= p 2, H A :p 1 phat = c(.121, .117) # the sample proportions> n = c(50000, 60000) # the sample sizes> n*phat # the counts[1] 5850 7260> prop.test(n*phat,n,alt="less")2-sample test <strong>for</strong> equality of proportions withcontinuity correctiondata: n * phat out of nX-squared = 4.119, df = 1, p-value = 0.02121alternative hypothesis: less95 percent confidence interval:−1.0000000 −0.0007589sample estimates:prop 1 prop 20.117 0.121The small p-value of 0.02107 indicates an increase in the rate.If we were to do this by hand, rather than by using prop.test(), we would find:> p=sum(n*phat)/sum(n) #(n_1p_1+n_2p_2)/(n_1+n_2)> obs=(phat[1]−phat[2])/sqrt(p*(1−p)*sum(1/n))> obs[1] −2.039> pnorm(obs)[1] 0.02073This also gives a small p-value. The difference is due to a continuity correction used byprop.test().8.5.1 Problems8.21 A cell-phone store has sold 150 phones of Brand A and had 14 returned as defective.Additionally, it has sold 125 phones of Brand B and had 15 phones returned as defective.Is there statistical evidence that Brand A has a smaller chance of being returned thanBrand B?8.22 In the year 2001, a poll of 600 people found that 250 supported gay marriage. A2003 poll of 500 found 250 in support. Do a test of significance to see whether thedifference in proportions is statistically significant.8.23 There were two advance screenings of a new movie. The first audience wascomposed of a classical-music radio station’s listeners, the second a rock-androll musicstation’s listeners. Suppose the audience size was 350 <strong>for</strong> each screening. If 82% of the

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!