x=c(1.5,1.8,2.4,3.0,3.5,3.9,4.4,4.8,5.0)
y=c(4.8,5.7,7.0,8.3,10.9,12.4,13.1,13.6,15.3)
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
a=ybar-b*xbar;a
r=sxy/sqrt(sxx*syy);r
