use https://stats.idre.ucla.edu/stat/stata/examples/greene/table14_1, clear generate logc = log(c) generate logq = log(q) generate logf = log(pf) save table14-1
Table 14.1, page 566, No effects.
regress logc logq logf lf Source | SS df MS Number of obs = 90 -------------+------------------------------ F( 3, 86) = 2419.34 Model | 112.705452 3 37.5684839 Prob > F = 0.0000 Residual | 1.33544153 86 .01552839 R-squared = 0.9883 -------------+------------------------------ Adj R-squared = 0.9879 Total | 114.040893 89 1.28135835 Root MSE = .12461 ------------------------------------------------------------------------------ logc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- logq | .8827385 .0132545 66.60 0.000 .8563895 .9090876 logf | .453977 .0203042 22.36 0.000 .4136136 .4943404 lf | -1.62751 .345302 -4.71 0.000 -2.313948 -.9410727 _cons | 9.516923 .2292445 41.51 0.000 9.0612 9.972645 ------------------------------------------------------------------------------
Table 14.1, Group Means.
egen mq = mean(logq), by(i) egen mf = mean(logf), by(i) egen mlf = mean(lf), by(i) regress logc mq mf mlf Source | SS df MS Number of obs = 90 -------------+------------------------------ F( 3, 86) = 53.40 Model | 74.2047466 3 24.7349155 Prob > F = 0.0000 Residual | 39.8361466 86 .463211006 R-squared = 0.6507 -------------+------------------------------ Adj R-squared = 0.6385 Total | 114.040893 89 1.28135835 Root MSE = .6806 ------------------------------------------------------------------------------ logc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- mq | .7824569 .1518735 5.15 0.000 .4805424 1.084371 mf | -5.523905 6.253856 -0.88 0.380 -17.95616 6.908349 mlf | -1.751066 3.83042 -0.46 0.649 -9.365689 5.863557 _cons | 85.80811 78.8686 1.09 0.280 -70.97747 242.5937 ------------------------------------------------------------------------------
Table 14.1, Firm effects.
xtreg logc logq logf lf, i(i) fe Fixed-effects (within) regression Number of obs = 90 Group variable (i) : i Number of groups = 6 R-sq: within = 0.9926 Obs per group: min = 15 between = 0.9856 avg = 15.0 overall = 0.9873 max = 15 F(3,81) = 3604.80 corr(u_i, Xb) = -0.3475 Prob > F = 0.0000 ------------------------------------------------------------------------------ logc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- logq | .9192846 .0298901 30.76 0.000 .8598126 .9787565 logf | .4174918 .0151991 27.47 0.000 .3872503 .4477333 lf | -1.070396 .20169 -5.31 0.000 -1.471696 -.6690963 _cons | 9.713528 .229641 42.30 0.000 9.256614 10.17044 -------------+---------------------------------------------------------------- sigma_u | .1320775 sigma_e | .06010514 rho | .82843653 (fraction of variance due to u_i) ------------------------------------------------------------------------------ F test that all u_i=0: F(5, 81) = 57.73 Prob > F = 0.0000
Table 14.1, a1 … a6, Method 1.
tabulate i, gen(i) (output omitted) regress logc logq logf lf i2-i6 Source | SS df MS Number of obs = 90 -------------+------------------------------ F( 8, 81) = 3935.79 Model | 113.74827 8 14.2185338 Prob > F = 0.0000 Residual | .292622872 81 .003612628 R-squared = 0.9974 -------------+------------------------------ Adj R-squared = 0.9972 Total | 114.040893 89 1.28135835 Root MSE = .06011 ------------------------------------------------------------------------------ logc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- logq | .9192846 .0298901 30.76 0.000 .8598126 .9787565 logf | .4174918 .0151991 27.47 0.000 .3872503 .4477333 lf | -1.070396 .20169 -5.31 0.000 -1.471696 -.6690963 i2 | -.0412359 .0251839 -1.64 0.105 -.0913441 .0088722 i3 | -.2089211 .0427986 -4.88 0.000 -.2940769 -.1237652 i4 | .1845557 .0607527 3.04 0.003 .0636769 .3054345 i5 | .0240547 .0799041 0.30 0.764 -.1349293 .1830387 i6 | .0870617 .0841995 1.03 0.304 -.080469 .2545924 _cons | 9.705942 .193124 50.26 0.000 9.321686 10.0902 ------------------------------------------------------------------------------ lincom _cons ( 1) _cons = 0.0 ------------------------------------------------------------------------------ logc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 9.705942 .193124 50.26 0.000 9.321686 10.0902 ------------------------------------------------------------------------------ lincom _cons + i2 ( 1) i2 + _cons = 0.0 ------------------------------------------------------------------------------ logc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 9.664706 .198982 48.57 0.000 9.268794 10.06062 ------------------------------------------------------------------------------ lincom _cons + i3 ( 1) i3 + _cons = 0.0 ------------------------------------------------------------------------------ logc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 9.497021 .2249584 42.22 0.000 9.049424 9.944618 ------------------------------------------------------------------------------ lincom _cons + i4 ( 1) i4 + _cons = 0.0 ------------------------------------------------------------------------------ logc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 9.890498 .2417635 40.91 0.000 9.409464 10.37153 ------------------------------------------------------------------------------ lincom _cons + i5 ( 1) i5 + _cons = 0.0 ------------------------------------------------------------------------------ logc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 9.729997 .2609421 37.29 0.000 9.210804 10.24919 ------------------------------------------------------------------------------ lincom _cons + i6 ( 1) i6 + _cons = 0.0 ------------------------------------------------------------------------------ logc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 9.793004 .2636622 37.14 0.000 9.268399 10.31761 ------------------------------------------------------------------------------
Table 14.1, a1 … a6, Method 2.
regress logc logq logf lf i1-i6, noconst Source | SS df MS Number of obs = 90 -------------+------------------------------ F( 9, 81) = . Model | 16191.3043 9 1799.03381 Prob > F = 0.0000 Residual | .292622872 81 .003612628 R-squared = 1.0000 -------------+------------------------------ Adj R-squared = 1.0000 Total | 16191.5969 90 179.906633 Root MSE = .06011 ------------------------------------------------------------------------------ logc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- logq | .9192846 .0298901 30.76 0.000 .8598126 .9787565 logf | .4174918 .0151991 27.47 0.000 .3872503 .4477333 lf | -1.070396 .20169 -5.31 0.000 -1.471696 -.6690963 i1 | 9.705942 .193124 50.26 0.000 9.321686 10.0902 i2 | 9.664706 .198982 48.57 0.000 9.268794 10.06062 i3 | 9.497021 .2249584 42.22 0.000 9.049424 9.944618 i4 | 9.890498 .2417635 40.91 0.000 9.409464 10.37153 i5 | 9.729997 .2609421 37.29 0.000 9.210804 10.24919 i6 | 9.793004 .2636622 37.14 0.000 9.268399 10.31761 ------------------------------------------------------------------------------
Table 14.1, Time effects.
xtreg logc logq logf lf, i(t) fe Fixed-effects (within) regression Number of obs = 90 Group variable (i) : t Number of groups = 15 R-sq: within = 0.9858 Obs per group: min = 6 between = 0.4812 avg = 6.0 overall = 0.5265 max = 6 F(3,72) = 1668.37 corr(u_i, Xb) = -0.1503 Prob > F = 0.0000 ------------------------------------------------------------------------------ logc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- logq | .8677268 .0154082 56.32 0.000 .8370111 .8984424 logf | -.4844835 .3641085 -1.33 0.188 -1.210321 .2413535 lf | -1.954404 .4423777 -4.42 0.000 -2.836268 -1.07254 _cons | 21.66698 4.624053 4.69 0.000 12.4491 30.88486 -------------+---------------------------------------------------------------- sigma_u | .8027907 sigma_e | .12293801 rho | .97708602 (fraction of variance due to u_i) ------------------------------------------------------------------------------ F test that all u_i=0: F(14, 72) = 1.17 Prob > F = 0.3178
Table 14.1, c1 … c15, Method 2.
tabulate t, gen(t) (output omitted) regress logc logq logf lf t1-t15, noconst Source | SS df MS Number of obs = 90 -------------+------------------------------ F( 18, 72) =59513.52 Model | 16190.5087 18 899.472708 Prob > F = 0.0000 Residual | 1.08819022 72 .015113753 R-squared = 0.9999 -------------+------------------------------ Adj R-squared = 0.9999 Total | 16191.5969 90 179.906633 Root MSE = .12294 ------------------------------------------------------------------------------ logc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- logq | .8677268 .0154082 56.32 0.000 .8370111 .8984424 logf | -.4844835 .3641085 -1.33 0.188 -1.210321 .2413535 lf | -1.954404 .4423777 -4.42 0.000 -2.836268 -1.07254 t1 | 20.4958 4.209528 4.87 0.000 12.10426 28.88735 t2 | 20.57804 4.221526 4.87 0.000 12.16258 28.9935 t3 | 20.65573 4.224177 4.89 0.000 12.23499 29.07647 t4 | 20.74076 4.24575 4.89 0.000 12.27701 29.20451 t5 | 21.19983 4.440331 4.77 0.000 12.34819 30.05147 t6 | 21.41162 4.538621 4.72 0.000 12.36404 30.4592 t7 | 21.50335 4.571397 4.70 0.000 12.39044 30.61626 t8 | 21.65403 4.622886 4.68 0.000 12.43847 30.86958 t9 | 21.82957 4.656906 4.69 0.000 12.5462 31.11294 t10 | 22.1138 4.792648 4.61 0.000 12.55983 31.66777 t11 | 22.46533 4.949909 4.54 0.000 12.59786 32.33279 t12 | 22.65134 5.008592 4.52 0.000 12.66689 32.63578 t13 | 22.61656 4.986139 4.54 0.000 12.67687 32.55624 t14 | 22.55223 4.955942 4.55 0.000 12.67274 32.43172 t15 | 22.53677 4.940532 4.56 0.000 12.688 32.38554 ------------------------------------------------------------------------------
Table 14.2, Random effects, Firm effects.
xtreg logc logq logf lf, i(i) re Random-effects GLS regression Number of obs = 90 Group variable (i) : i Number of groups = 6 R-sq: within = 0.9925 Obs per group: min = 15 between = 0.9856 avg = 15.0 overall = 0.9876 max = 15 Random effects u_i ~ Gaussian Wald chi2(3) = 11091.33 corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ logc | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- logq | .9066805 .025625 35.38 0.000 .8564565 .9569045 logf | .4227784 .0140248 30.15 0.000 .3952904 .4502665 lf | -1.064499 .2000703 -5.32 0.000 -1.456629 -.672368 _cons | 9.627909 .210164 45.81 0.000 9.215995 10.03982 -------------+---------------------------------------------------------------- sigma_u | .12488859 sigma_e | .06010514 rho | .81193816 (fraction of variance due to u_i) ------------------------------------------------------------------------------
Table 14.2, Random effects with autocorrelation. Using xtregar we obtain slightly different values for the autocorrelation, coefficients and standard errors. It should be noted that the latest version of Greene’s Limdep program also computes different values from those found in the book.
tsset i t panel variable: i, 1 to 6 time variable: t, 1 to 15 xtregar logc logq logf lf, re Random-effects GLS regression Number of obs = 90 Group variable (i) : i Number of groups = 6 R-sq: within = 0.9925 Obs per group: min = 15 between = 0.9854 avg = 15.0 overall = 0.9866 max = 15 Wald chi2(4) = 3735.11 corr(u_i, Xb) = 0 (assumed) Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ logc | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- logq | .9276293 .0287051 32.32 0.000 .8713683 .9838904 logf | .3997841 .017633 22.67 0.000 .3652241 .4343442 lf | -.9870458 .198669 -4.97 0.000 -1.37643 -.5976618 _cons | 9.902918 .2626146 37.71 0.000 9.388203 10.41763 -------------+---------------------------------------------------------------- rho_ar | .69576607 (estimated autocorrelation coefficient) sigma_u | .10060015 sigma_e | .04720363 rho_fov | .81955952 (fraction of variance due to u_i) theta | .67082541 ------------------------------------------------------------------------------