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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Significance tests 233H 0 :µ x =µ y , H A :µ x µ ybecomes a significance test ofH 0 :µ=0, H A :µ0, or µ≠0.If the differences have a normally distributed population, a t-test can be used. If thedifferences are from a symmetric distribution, the Wilcoxon signed-rank test can be used.Otherwise, the sign test can be used, where µ is interpreted as the difference of medians.In R, both the t.test() and wilcox.test() functions have an argument paired=TRUE thatwill per<strong>for</strong>m the paired tests.■ Example 8.12: Twin studies continued For the Finasteride study, photographs aretaken of each head. They are assessed using a standard methodology. This results in ascore between 1 and 7:1 indicating greatly decreased hair growth and 7 greatly increased.Simulated data, presented as pairs, is in Table 8.5.We can assess the differences with a paired t-test as follows:> Finasteride = c(5,3,5,6,4,4,7,4,3)> placebo = c(2,3,2,4,2,2,3,4,2)Table 8.5 Assessment <strong>for</strong> hair loss on 1–7 scale<strong>for</strong> twin studyGroupscoreFinasteride treatment5 35744743placebo 232422342> t.test(Finasteride, placebo, paired=TRUE,alt="two.sided")Paired t-testdata: Finasteride and placebot=4.154, df=8, p-value=0.003192alternative hypothesis: true difference in means is notequal to a95 percent confidence interval:0.8403 2.9375sample estimates:mean of the differences1.889We see a very small p-value, indicating that the result is significant. The null hypothesisof no effect is in doubt.■ Example 8.13: Pre- and post-tests, continued To test whether a college course isworking, a pre- and post-test is arranged <strong>for</strong> the students. The results are given in Table8.6. Compare the scores with a t-test. First, assume that the scores are randomly selectedfrom the two tests. Next, assume that they are pairs of scores <strong>for</strong> ten students.

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

Saved successfully!

Ooh no, something went wrong!