x=c(4.3,4.5,5.9,5.6,6.1,5.2,3.8,2.1,7.5)
y=c(126,121,116,118,114,118,132,141,108)
n=length(x);n
sumx=sum(x);sumx
sumxx=sum(x*x);sumxx
sumy=sum(y);sumy
sumyy=sum(y*y);sumyy
sumxy=sum(x*y);sumxy
xbar=mean(x);xbar
ybar=mean(y);ybar
sxx=sumxx-sumx^2/n;sxx
syy=sumyy-sumy^2/n;syy
sxy=sumxy-sumx*sumy/n;sxy
b=sxy/sxx;b
SST=syy;SST
SSR=b^2*sxx;SSR
SSE=SST-SSR;SSE
DF_SST=n-1;DF_SST
DF_SSR=1;DF_SSR
DF_SSE=DF_SST-DF_SSR;DF_SSE
MSR=SSR/DF_SSR;MSR
MSE=SSE/DF_SSE;MSE
f_compute=MSR/MSE;f_compute
alpha=0.05
f_critical=qf(1-alpha,DF_SSR,DF_SSE);f_critical
sig_1_tailed=1-pf(f_compute,DF_SSR,DF_SSE);sig_1_tailed
