function[B_hat R_sqd]=ols(y,x) B_hat=inv(x'*x)*(x'*y), e_hat=y-B_hat*x, R_sqd=1-((e_hat)'*(e_hat))/var(y)