* * Example 2.1.3, 2.3.3, 2.5.5, 2.8.1 * open data wages1.dat data(format=prn,org=columns) 1 3294 exper male school wage * * Do basic statistics on the two subsamples. The first is where "male" is * non-zero, the second where .not.male is non-zero, that is, where male itself is * zero. * stats(smpl=male) wage stats(smpl=.not.male) wage * * The regression on constant and the male dummy will give the same type of * information in a form which will usually be easier to interpret. The * coefficient on the intercept will be the same as the mean for the females, * while the coefficient on the male dummy is the difference between the mean for * males and the mean for females. * linreg wage # constant male * * Example 2.5.5 adds school and exper to the regression and tests the joint * significance of the two additional variables. There are several ways to do this * without putting numbers into a calculator. The first uses "compute" * instructions to organize the values generated by the regressions. For instance, * %RSQUARED is the R**2 from the most recent regression. We'll save that into * rsqrr (which is an abbreviation for rsqr restricted). In addition to %RSQUARED, * we also use %NDF, which is the degrees of freedom from the most recent * regression. * compute rsqrr=%rsquared * linreg wage # constant male school exper * * This computes the F-statistic. The instruction CDF then can be used to * determine the p-value (significance level) of the statistic. Note that the * value is slightly different from that given in the text. This is because the * calculations here are done to the full machine precision, while the R**2 * values in the calculation in the text are rounded to four decimal places. * compute fstat=(%rsquared-rsqrr)/2/((1-%rsquared)/%ndf) cdf ftest fstat 2 %ndf * * An alternative method to do the test is to use an EXCLUDE instruction after the * unrestricted regression. The line after EXCLUDE lists the set of regressors to * be tested (jointly) * exclude # school exper * * 2.8.1, various equivalent dummy combinations * set female = .not.male linreg wage # constant male linreg wage # constant female linreg wage # male female