* * Examples in section 4.5, pp 143-150 * open data mlb1.raw data(format=free,org=columns) 1 353 salary teamsal nl years games atbats runs hits doubles triples hruns $ rbis bavg bb so sbases fldperc frstbase scndbase shrtstop thrdbase outfield catcher yrsallst hispan $ black whitepop blackpop hisppop pcinc gamesyr hrunsyr atbatsyr allstar slugavg rbisyr sbasesyr runsyr $ percwhte percblck perchisp blckpb hispph whtepw blckph hisppb lsalary * * Do the unrestricted regression (4.31) and save the sum of squared residuals. * linreg lsalary # constant years gamesyr bavg hrunsyr rbisyr compute rssu=%rss * * Do the restricted regression (4.33) * linreg lsalary # constant years gamesyr * * Compute the F-statistic (page 148) and use CDF to display its significance * level. * compute f=((%rss-rssu)/rssu)*(%nobs-6)/3 cdf ftest f 3 %nobs-6 * * This uses the EXCLUDE instruction to do the test directly off the unrestricted * regression. Estimate the unrestricted regression, then follow with an EXCLUDE * which lists the set of coefficients being tested. * linreg lsalary # constant years gamesyr bavg hrunsyr rbisyr exclude(title="Test of Performance Variables") # bavg hrunsyr rbisyr