* Working Matrix Problem # 2 set nocc set nocolor file 11 b:interest.dat read(11) tbill ip m infl sample 50 50 print tbill ip m infl sample 1 251 * Generate column of ones for the intercept genr x1=1.0 * Build the X matrix copy x1 ip m infl x * Calculate (XTX)inverse*XTY=Beta vector matrix xtx=x'x matrix xtxi=inv(xtx) matrix xty=x'tbill matrix b=xtxi*xty print b * Calculate residual sum of squares and sigma-hat matrix rss=tbill'tbill-b'xty gen1 sighat=rss/247 * Calculate the variance-covariance matrix matrix vcov=sighat*xtxi print vcov * Getting the forecasts sample 1 4 read a1 1 58.5 1.100006 -.00003980575 matrix fc1=a1'b print fc1 matrix ssq1=a1'vcov(a1) print ssq1 * Note that the standard error from the FC command * is for an individual observation forecast read a2 1 111 22 .07 matrix fc2=a2'b print fc2 matrix ssq2=a2'vcov(a2) print ssq2 ****************************************************** * Note: the following command was originally wrong * when this file was first placed on the web page ****************************************************** genr vof=ssq2+sighat * Testing read a3 0 1 1 0 matrix ssq3=a3'vcov(a3) print ssq3 * Do the multiple regression for comparison sample 1 251 dim fc 50 se 50 ?ols tbill ip m infl fc/list beg=50 end=50 predict=fc fcse=se ols tbill ip m infl/auxrsq test ip+m=0 * Getting condition numbers and indexes pc ip m infl