X=c(90,86,67,89,81,75,85,70,81,77)
Y=c(58.13564, 52.26466, 43.77175, 56.33112, 53.95647,
50.57478, 57.96312, 47.32378, 51.20470, 50.30007)
mean(X)
mean(Y)
sd(X)
sd(Y)
var(X)
cov(X,Y)
cor(X,Y)
model=lm(Y~X)
model
model$residuals
cor(X,model$residuals)
sum(model$residuals^2)
predict(model,newdata = data.frame(X=c(88)), interval='confidence')
predict(model,newdata = data.frame(X=c(88)), interval='prediction')
Y_hat=predict(model,newdata = data.frame(X=c(88)))
W=sqrt(2*qf(0.95,df1 = 2,df2=8))
se=sqrt(sum(model$residuals^2)/8)*sqrt((1/10)+((88-mean(X))^2/(9*var(X))))
Y_hat-W*se
Y_hat+W*se
test_stat=model$coefficients[2]-0.8
model=lm(Y~X)
model2=lm(Y~1)
anova(model2,model)