* * Example from pages 641-649, section 16.3 * Fixed and random effects * cal(panel=20) 1935 all 4//1954:1 open data table16-1.prn data(format=prn,org=obs) / y x2 x3 * linreg y # constant x2 x3 * * Generate the dummies for individuals 2 through 4 * set d2 = %indiv(t)==2 set d3 = %indiv(t)==3 set d4 = %indiv(t)==4 linreg y # constant d2 d3 d4 x2 x3 * * Test joint significance of the dummies. The 16.3.5 calculation from the book * seems to be slightly off. * exclude # d2 d3 d4 * * There are so many time dummies that it makes more sense do put a loop to work * generating them. We create a vector of 19 series and fill them with dummies for * each of the first 19 periods. We can insert the vector into the regressor * lists to include all of them. * dec vect[series] tdummies(19) do i=1,19 set tdummies(i) = %period(t)==i end do i linreg y # constant tdummies x2 x3 exclude # tdummies * * Now we put in all the individual and time dummies and test the significance of * each, plus an joint test of all the dummies. * linreg y # constant d2 d3 d4 tdummies x2 x3 exclude # d2 d3 d4 exclude # tdummies exclude # d2 d3 d4 tdummies * * Create slope dummies. We need one for each combination of individual dummy and * regressor. * set d2x2 = d2*x2 set d3x2 = d3*x2 set d4x2 = d4*x2 set d2x3 = d2*x3 set d3x3 = d3*x3 set d4x3 = d4*x3 linreg y # constant d2 d3 d4 x2 x3 d2x2 d3x2 d4x2 d2x3 d3x3 d4x3 * * Using PREGRESS (panel regression) for the random effects (or ECM) model. These * don't match exactly because of differing formulas for the component variances. * Table 16.3 also has a typo in the std error for x3. * preg(method=random,effects=indiv) y # constant x2 x3 * * Using PREGRESS for fixed effects. This will yield the same slope coefficients * as the LSDV regressions above. Leave the constant out of these, since these * include regressions include a full set of dummies. * preg(method=fixed,effects=indiv) y # x2 x3 preg(method=fixed,effects=time) y # x2 x3 preg(method=fixed,effects=both) y # x2 x3