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 200We use the argument conf . level=… to specify the confidence level.■ Example 7.10: Comparing shoes The shoes (MASS) data set contains shoe wear <strong>for</strong>ten children each wearing two different shoes. By comparing the differences, we can tellwhether the two types of shoes have different mean wear amounts.> library(MASS) # load data set> names(shoes)[1] "A" "B"> with(shoes, t.test(A-B,conf.level = 0.9))One Sample t-testdata: A − Bt = −3.349, df = 9, p-value = 0.008539alternative hypothesis: true mean is not equal to a90 percent confidence interval:−0.6344 −0.1856sample estimates:mean of x−0.41### Alternately:> with(shoes, t.test(A,B,conf.level = 0.9,paired=TRUE))...Both approaches produce the same 90% confidence interval. In this case, it does notinclude a, indicating that there may be a difference in the means.7.5.4 Problems7.25 Two different AIDS-treatment “cocktails” are compared. For each, the time it takes(in years) to fail is measured <strong>for</strong> seven randomly assigned patients. The data is in Table7.1. Find an 80% confidence interval <strong>for</strong> the difference of means. What assumptions areyou making on the data?Table 7.1 Time to fail <strong>for</strong> AIDS cocktails, inyearsType 1 2 3 4 5 6 7 sCocktail 1: 3.1 3.3 1.7 1.2 0.7 2.3 2.9 2.24 0.99Cocktail 2: 1.8 2.3 2.2 3.5 1.7 1.6 1.4 2.13 0.697.26 In determining the recommended dosage of AZT <strong>for</strong> AIDS patients, tests were donecomparing efficacy <strong>for</strong> various dosages. If a low dosage is effective, then that would berecommended, as it would be less expensive and would have fewer potential side effects.A test to decide whether a dosage of 1,200 mg is similar to one of 400 mg isper<strong>for</strong>med on two random samples of AIDS patients. A numeric measurement of apatient’s health is made, and the be<strong>for</strong>e-and-after differences are recorded after treatment

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

Saved successfully!

Ooh no, something went wrong!