options nodate nonumber ps=54 ls=80; /* This analyzyes your data from take-home project 1 in matrix form Replace the values in the Y vector with your data */ proc iml; n=12; x={1 0, 1 0, 1 10, 1 10, 1 20, 1 20, 1 30, 1 30, 1 40, 1 40, 1 50, 1 50}; y={6, 12, 33, 28, 48, 55, 67, 79, 86, 91, 109, 113}; xpx=x`*x; xpy=x`*y; xpxinv=inv(xpx); b=xpxinv*xpy; h=x*xpxinv*x`; yhat=h*y; i_n=i(n); e=(i_n-h)*y; j_n=j(n,n,1/n); ssto=y`*(i_n-j_n)*y; sse=y`*(i_n-h)*y; ssr=y`*(h-j_n)*y; dfe=n-2; dfr=1; mse=sse/dfe; msr=ssr/dfr; f=msr/mse; s2_b=xpxinv*mse; print y x yhat e; print b s2_b; print h; print ssto ssr sse msr mse f; run; stop;