* * Example from section 7.1.2 starting page 169 * open data cps_small.dat data(format=free,org=columns) 1 1000 wage educ exper female black white midwest south west * set black_female = black*female * linreg wage # constant educ black female black_female exclude(title="Test of Demographics") # black female black_female * linreg wage # constant educ black female black_female south midwest west * exclude(title="Test of Regional Differences") # south midwest west * * Sample break down * set educ_south = educ*south set black_south = black*south set female_south = female*south set black_female_south = black*female*south * linreg wage # constant educ black female black_female south educ_south black_south female_south black_female_south exclude(title="Chow Test Using Dummies") # south educ_south black_south female_south black_female_south * * The SMPL option restricts the regression to the set of observations where the * value of the expression is non-zero. The expression .not.south will be 0 * ("false") where SOUTH is non-zero, and 1 ("true") where SOUTH is zero. * * linreg(smpl=.not.south) wage # constant educ black female black_female * * %NDF and %RSS are two variables defined by LINREG. %NDF is the degrees of * freedom, %RSS is the sum of squared residuals. We need to keep these values for * later use. To do this, we use the instruction COMPUTE. COMPUTE does general * calculations with single values or matrices. Here compute ndf1=%ndf takes the * current value of %ndf and puts it into a new variable called ndf1. As you can * see, you can do more than one such assignment on a single COMPUTE. * compute ndf1=%ndf,rss1=%rss * linreg(smpl=south) wage # constant educ black female black_female compute ndf2=%ndf,rss2=%rss * linreg wage # constant educ black female black_female * * CDF gives access to tables for four standard distributions: normal, chisquared, * t (called "ttest") and F (called "ftest"). Given an input value for the test * statistic and (if necessary) the degrees of freedom, it formats up a display of * the test with its significance level. There are also functions which return the * signficance values for tests using these statistics (and some others) in case * you want to format the output differently. * cdf(title="Chow Test by Subsample Regression") ftest $ ((%rss-(rss1+rss2))/%nreg)/((rss1+rss2)/(ndf1+ndf2)) %nreg ndf1+ndf2