Chapter 6 Example 2.2

We use the differences Standard minus Ergonomic for the runstitching data.
> library(cfcdae)
> data(RunStitch)
> differences <- RunStitch[,"Standard"] - RunStitch[,"Ergonomic"]
> differences
 [1]  1.03 -0.04  0.26  0.30 -0.97  0.04 -0.57  1.75  0.01  0.42  0.45 -0.80
[13]  0.39  0.25  0.18  0.95 -0.18  0.71  0.42  0.43 -0.48 -1.08 -0.57  1.10
[25]  0.27 -0.45  0.62  0.21 -0.21  0.82

We want to examine both the hypothesis of Mr. Skeptical (\(\mu = 0\)) and Mr. Enthusiastic (\(\mu = 0.5\)). The t.test() function does exactly what we need. In addition, we ask for a 95% confidence interval for the mean.

For the hypothesis that \(\mu=0\), we get a p-value of .147, suggesting that the data are compatible with that hypothesis. Mr. Skeptical is pleased.
> t.test(differences,mu=0,conf.level=.95)

    One Sample t-test

data:  differences
t = 1.49, df = 29, p-value = 0.147
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
 -0.06532811  0.41599478
sample estimates:
mean of x 
0.1753333 
For the hypothesis \(\mu=.5\), we get a p-value of .01. This shows that the data would be somewhat unusual if the true mean were .5, but it is not strong evidence against Mr. Enthusiastic’s claim.
> t.test(differences,mu=0.5,conf.level=.95)

    One Sample t-test

data:  differences
t = -2.7591, df = 29, p-value = 0.009934
alternative hypothesis: true mean is not equal to 0.5
95 percent confidence interval:
 -0.06532811  0.41599478
sample estimates:
mean of x 
0.1753333 

In either case, the 95% confidence interval is the same (-.065, .416), as the confidence interval does not depend on a null hypothesis for the mean. This interval includes 0 but does not include .5 (the 99% interval goes right up to .5).