version 10 log using chap05, replace use andy, clear *-------------------------------------------------------------- * this is a comment * these commands presume you have changed to the working * directory and that you are using Stata Release 10 * use the clear option if previous work in memory can be erased *-------------------------------------------------------------- * Summary Statistics summarize andy * Least squares regression with covariance matrix regress sales price advert estat vce * display R-Square di e(r2) * display sigma-hat squares di e(rss)/e(df_r) * Simple tests (F-statistics) * Note, F(1,n-k)=t(n-k) squared test _b[price] = 0 test _b[advert] = 1 * conditional prediction scalar shat = _b[_cons]+ _b[price]*5.5+ _b[advert]*1.2 scalar list shat * Confidence Intervals scalar bL = _b[price] - invttail(e(df_r),.025) * _se[price] scalar bU = _b[price] + invttail(e(df_r),.025) * _se[price] scalar list bL bU * t-ratios scalar t1 = (_b[price]-0)/_se[price] scalar t2 = (_b[advert]-1)/_se[advert] scalar list t1 t2 *----------------------------------------------- * pvalues for the t-ratios. * Compare these to the ones above * that were obtained using the test statements. *----------------------------------------------- scalar p1 = 2*ttail(72,abs(t1)) scalar p2 = ttail(72,abs(t2)) scalar list p1 p2 log close translate chap05.smcl chap05.txt, replace