x1<-c(171,175,159,155,152,158,154,164,168,166,159,164)
x2<-c(57,64,41,38,35,44,41,51,57,49,47,46)
plot(x1,x2)
cor(x1,x2)
cor.test(x1,x2)
d<-data.frame(x1,x2)
d
fm<-lm(x1~x2,data=d)
fm
summary(fm)
anova(fm)
names(fm)
coef(fm)
coef(fm)[1]
coef(fm)[2]
resid(fm)
residuals(fm)
fitted(fm)
predict(fm)
newdata=data.frame(x2:c(55,33))
predict(fm,newdata)
plot(x1~x2,data=d)
abline(fm)
oldpar=par(mfrow=c(2,2))
plot(fm)
y.rst<-rstandard(fm)
plot(y.rst~d$x1)