In the dataset airways (see R code), we have the change inairflow from moderate exercise for 19 subjects under 2 differentexposure conditions – regular air (air) and 0.25% sulpher dioxide(so2).
a) Look at the correlation, and use the t-table to test the nullhypothesis that air flow change under these two conditions isuncorrelated. Test at significance level 0.05. Show your work.
b) Use a linear model and the summary function in R to test thenull hypothesis that air flow changes are uncorrelated among peopleat the alpha = 0.05.
c) Look at the scatterplot of the airway changes. Does a linearmodel fully explain the relationship between these variables? Whyor why not?
R codes:
##################
subject = 1:19
air =c(0.82,0.86,1.86,1.64,12.57,1.56,1.28,1.08,4.29,1.37,14.68,3.64,3.89,0.58,9.50,0.93,0.49,31.04,1.66)
so2 =c(0.72,1.05,1.40,2.30,13.49,0.62,2.41,2.32,8.19,6.33,19.88,8.87,9.25,6.59,2.17,9.93,13.44,16.25,19.89)
airways = data.frame(subject,air,so2)
airways
# part a, get the correlation
cor(air,so2)
# part b, make a model and get the summary
fit = lm(air ~ so2, data=airways)
summary(fit)
## part c, to see a scatterplot...
plot(air ~ so2, data=airways)