data(anorexia)
#are subjects' weights at baseline and endpoint significantly different from normal
one.sample.test(variables=d(Prewt,Postwt),
data=anorexia,
test=shapiro.test)
#does CBT work at increasing mean wt
anorexia.sub<-subset(anorexia,Treat=="CBT")
one.sample.test(variables=Postwt-Prewt,
data=anorexia.sub,
test=t.test)
Run the code above in your browser using DataLab