use TBL15-1, clear
Table 15.1, page 598, Least squares, OLS Standard errors.
regress i f c
Source | SS df MS Number of obs = 100
-------------+------------------------------ F( 2, 97) = 170.81
Model | 5532554.18 2 2766277.09 Prob > F = 0.0000
Residual | 1570883.64 97 16194.6767 R-squared = 0.7789
-------------+------------------------------ Adj R-squared = 0.7743
Total | 7103437.82 99 71751.8972 Root MSE = 127.26
------------------------------------------------------------------------------
i | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
f | .1050854 .0113778 9.24 0.000 .0825036 .1276673
c | .3053655 .0435078 7.02 0.000 .2190146 .3917165
_cons | -48.02974 21.48016 -2.24 0.028 -90.66192 -5.397556
------------------------------------------------------------------------------
predict xb, xb
. generate r2 = (i-xb)^2
. table firm, contents(mean r2)
----------------------
firm | mean(r2)
----------+-----------
1 | 9410.907
2 | 755.8508
3 | 34288.49
4 | 633.4236
5 | 33455.51
----------------------
Table 15.1, page 598, Least squares, OLS Standard errors, using xtlgs.
xtgls i f c, i(firm) t(year) panels(iid)
Cross-sectional time-series FGLS regression
Coefficients: generalized least squares
Panels: homoskedastic
Correlation: no autocorrelation
Estimated covariances = 1 Number of obs = 100
Estimated autocorrelations = 0 Number of groups = 5
Estimated coefficients = 3 No. of time periods= 20
Wald chi2(2) = 352.19
Log likelihood = -624.9928 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
i | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
f | .1050854 .0112059 9.38 0.000 .0831223 .1270485
c | .3053655 .0428502 7.13 0.000 .2213806 .3893504
_cons | -48.02974 21.15551 -2.27 0.023 -89.49377 -6.565701
------------------------------------------------------------------------------
matrix list e(Sigma)
symmetric e(Sigma)[5,5]
c1 c2 c3 c4 c5
r1 15708.836
r2 0 15708.836
r3 0 0 15708.836
r4 0 0 0 15708.836
r5 0 0 0 0 15708.836
Table 15.1, page 598, White standard errors.
regress i f c, robust
Regression with robust standard errors Number of obs = 100
F( 2, 97) = 205.34
Prob > F = 0.0000
R-squared = 0.7789
Root MSE = 127.26
------------------------------------------------------------------------------
| Robust
i | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
f | .1050854 .0092867 11.32 0.000 .0866538 .123517
c | .3053655 .0600123 5.09 0.000 .1862578 .4244733
_cons | -48.02974 15.24712 -3.15 0.002 -78.29105 -17.76842
------------------------------------------------------------------------------
matrix d = vecdiag(e(V))
. matrix v = cholesky(diag(d))
. matrix s = sqrt((100-3)/100)*vecdiag(v)
. matrix list s
s[1,3]
f c _cons
r1 .00914637 .05910526 15.016673
Table 15.1, page 598, Correct standard errors.
tsset firm year
panel variable: firm, 1 to 5
time variable: year, 1935 to 1954
xtpcse i f c, het
Linear regression, heteroskedastic panels corrected standard errors
Group variable: firm Number of obs = 100
Time variable: year Number of groups = 5
Panels: heteroskedastic (balanced) Obs per group: min = 20
Autocorrelation: no autocorrelation avg = 20
max = 20
Estimated covariances = 5 R-squared = 0.7789
Estimated autocorrelations = 0 Wald chi2(2) = 720.01
Estimated coefficients = 3 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
| Het-corrected
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
f | .1050854 .0090625 11.60 0.000 .0873232 .1228476
c | .3053655 .0409468 7.46 0.000 .2251113 .3856198
_cons | -48.02974 14.20367 -3.38 0.001 -75.86841 -20.19106
------------------------------------------------------------------------------
matrix list e(Sigma)
symmetric e(Sigma)[5,5]
r1 r2 r3 r4 r5
r1 9410.9061
r2 0 755.85077
r3 0 0 34288.49
r4 0 0 0 633.42367
r5 0 0 0 0 33455.511
Table 15.1, page 598, FGLS.
xtgls i f c, i(firm) t(year) panels(het)
Cross-sectional time-series FGLS regression
Coefficients: generalized least squares
Panels: heteroskedastic
Correlation: no autocorrelation
Estimated covariances = 5 Number of obs = 100
Estimated autocorrelations = 0 Number of groups = 5
Estimated coefficients = 3 No. of time periods= 20
Wald chi2(2) = 865.38
Log likelihood = -570.1305 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
i | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
f | .0949905 .007409 12.82 0.000 .0804692 .1095118
c | .3378129 .0302254 11.18 0.000 .2785722 .3970535
_cons | -36.2537 6.124363 -5.92 0.000 -48.25723 -24.25017
------------------------------------------------------------------------------
predict xb, xb
. generate r2 = (i-xb)^2
. tabstat r2, stat(mean semean) by(firm)
Summary for variables: r2
by categories of: firm
firm | mean se(mean)
---------+--------------------
1 | 8612.145 2896.987
2 | 409.1902 136.7008
3 | 36563.24 5801.747
4 | 777.9749 323.5032
5 | 32902.83 7000.861
---------+--------------------
Total | 15853.07 2449.648
------------------------------
Table 15.1, page 598, ML.
xtgls i f c, i(firm) t(year) panel(het) igls
Iteration 1: tolerance = .1603143
(output omitted)
Iteration 15: tolerance = 2.892e-08
Cross-sectional time-series FGLS regression
Coefficients: generalized least squares
Panels: heteroskedastic
Correlation: no autocorrelation
Estimated covariances = 5 Number of obs = 100
Estimated autocorrelations = 0 Number of groups = 5
Estimated coefficients = 3 No. of time periods= 20
Wald chi2(2) = 1048.82
Log likelihood = -564.5355 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
i | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
f | .09435 .0062834 15.02 0.000 .0820347 .1066652
c | .3337015 .022039 15.14 0.000 .2905059 .376897
_cons | -23.25817 4.815172 -4.83 0.000 -32.69574 -13.82061
------------------------------------------------------------------------------
matrix list e(Sigma)
symmetric e(Sigma)[5,5]
c1 c2 c3 c4 c5
r1 8657.8826
r2 0 175.7844
r3 0 0 40211.124
r4 0 0 0 1241.0108
r5 0 0 0 0 29824.904
Table 15.2, page 602, FGLS.
xtgls i f c, i(firm) t(year) panel(cor)
xtgls i f c, i(firm) t(year) panel(cor)
Cross-sectional time-series FGLS regression
Coefficients: generalized least squares
Panels: heteroskedastic with cross-sectional correlation
Correlation: no autocorrelation
Estimated covariances = 15 Number of obs = 100
Estimated autocorrelations = 0 Number of groups = 5
Estimated coefficients = 3 No. of time periods= 20
Wald chi2(2) = 1285.19
Log likelihood = -537.8045 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
i | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
f | .0961894 .0054752 17.57 0.000 .0854583 .1069206
c | .3095321 .0179851 17.21 0.000 .2742819 .3447822
_cons | -38.36128 5.344871 -7.18 0.000 -48.83703 -27.88552
------------------------------------------------------------------------------
Table 15.2, page 602, MLE. The current version of Limdep produces these results which differ from those in the book (see Errata for book).
xtgls i f c, i(firm) t(year) panels(cor) igls
xtgls i f c, i(firm) t(year) panel(cor)
Cross-sectional time-series FGLS regression
Coefficients: generalized least squares
Panels: heteroskedastic with cross-sectional correlation
Correlation: no autocorrelation
Estimated covariances = 15 Number of obs = 100
Estimated autocorrelations = 0 Number of groups = 5
Estimated coefficients = 3 No. of time periods= 20
Wald chi2(2) = 558.51
Log likelihood = -515.4222 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
i | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
f | .023631 .004291 5.51 0.000 .0152207 .0320413
c | .1709472 .0152526 11.21 0.000 .1410526 .2008417
_cons | -2.216508 1.958845 -1.13 0.258 -6.055774 1.622759
------------------------------------------------------------------------------
Table 15.3, page 607, Heteroscedastic.
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
------------------------------------------------------------------------------
