Vraag A:
Make a scatter plot of resistance against length and compute the sample correlation coefficient between the two variables resistance and length. What do the plots and coefficients tell you about the question?
Code: Selecteer alles
lengte.ast=
c(90, 97, 97, 104, 119 ,106, 113 ,116, 118 ,119, 117, 122, 122 ,124, 129, 130, 135, 127, 120,
121, 126, 123, 125, 118 ,122, 120, 133,125, 123, 141 ,121,128,125,140 ,140, 140 ,148,145,
138 ,148,132,134)
resistentie.ast=
c(25.6 ,15.1 , 9.8 , 7.5 ,10.1 ,12.5 , 9.1 ,17.0 , 5.5 ,15.7 , 6.4 , 8.8 ,10.1, 5.0 , 5.8,
12.8, 10.0 , 8.0 ,23.8, 7.5 ,12.1 , 6.2, 8.3 , 3.5 ,10.2,16.1 ,10.1 ,12.1, 11.2, 9.4,
15.6 , 7.9 ,18.7 , 8.3 , 7.5 , 8.5 , 8.9 , 7.9 , 5.7 , 9.5 , 6.5, 15.0)
lengte.cyst=
c(89, 93, 92,101, 95, 89, 97, 97, 111, 102, 103, 108, 103, 105, 109, 93, 98, 103, 108,
106, 109, 111, 111, 116)
resistentie.cyst=
c(13.8, 8.2, 9.0, 12.5, 21.1, 6.8, 17.0, 11.0, 8.2, 12.7, 8.5, 10.0, 11.6, 9.5, 15.0,
13.5, 11.0, 11.0, 8.8, 9.5, 9.2, 15.0, 7.0, 6.3)
ademhaling=list(lengte.ast,resistentie.ast,lengte.cyst,resistentie.cyst)
names(ademhaling)=c("lengte.ast","resistentie.ast","lengte.cyst","resistentie.cyst")
Code: Selecteer alles
> plot(lengte.cyst, resistentie.cyst, main="Scatterplot voor breathing", xlab="Length", ylab="Resistance")
> fit <- lsfit(lengte.cyst, resistentie.cyst)
> fit$coefficients
Intercept X
23.8070432 -0.1246097
> abline(fit, col="red")
cystic fibrosis group.
Klopt dit?