#Biostatistics 350 #SIMPLE LINEAR REGRESSION #ZAR EXAMPLE 17.1 ZAR=read.table("ZarEX17.1R.txt") ZAR attach(ZAR) X=ageX Y=winglY #CREATING LINEAR MODEL LM: LM=lm(Y~X) LM Yhat=fitted(LM) e=residuals(LM) RESULTS=data.frame(X,Y,Yhat,e) RESULTS #PLOTTING REGRESSION LINE & POINTS: plot(X,Y) abline(LM,col="blue") segments(X,Yhat,X,Y,col="red") summary(LM) anova(LM)