|
Examples / PANEL.RPF |
PANEL.RPF estimates a panel data model using several different methods. It demonstrates the PREGRESS instruction plus several different uses of the PANEL instruction and how the equivalent estimators to fixed and random effects can be done using least squares with dummy variables and with panel data transformations.
This uses the grunfeld.dat data file, with \(N=10\), \(T=20\).
cal(panelobs=20) 1935
all 10//1954:1
open data grunfeld.dat
data(format=prn,org=cols)
Do fixed and random effects. The intercept in the fixed effects estimator gets zeroed out as a time-invariant variable, but we include it to maintain the same form as the other regressions.
preg(method=fixed) invest
# constant firmvalue cstock
preg(method=random) invest
# constant firmvalue cstock
This does a first-difference regression:
preg(method=fd) invest
# firmvalue cstock
And this does a SUR estimation. (This data set is barely adequate for that, with T relatively small relative to N).
preg(method=sur) invest
# constant firmvalue cstock
This does fixed effects as least squares with dummy variables (omitting the CONSTANT, since it is redundant with a full set of dummies).
panel(dummies=idummies)
linreg invest
# firmvalue cstock idummies
Random effects done using transformed data. We first need estimates of the component variances. The simplest (though not most accurate) can be computed using PSTATS with the residuals from a linear regression. PSTATS does a Wallace-Hussain variance calculation treating the input information as data (rather than residuals), so it will give a somewhat different values for the component variances from the one you get from PREGRESS (even with VCOMP=WH) since the latter uses information about the regression being run.
One other difference between the filtered regression and PREGRESS with METHOD=RANDOM is that the latter (in effect) uses the computed random variance component in calculating the covariance matrix, while the filtered least squares estimator uses the standard OLS estimator on the filtered data, thus recomputing the residual variance based upon the results.
linreg invest
# constant firmvalue cstock
pstats(effects=indiv) %resids
set ones = 1.0
panel(gls=standard,effects=indiv,$
vrandom=%vrandom,vindiv=%vindiv) invest / ifix
panel(gls=standard,effects=indiv,$
vrandom=%vrandom,vindiv=%vindiv) firmvalue / ffix
panel(gls=standard,effects=indiv,$
vrandom=%vrandom,vindiv=%vindiv) cstock / cfix
panel(gls=standard,effects=indiv,$
vrandom=%vrandom,vindiv=%vindiv) ones / constfix
linreg(title="Random Effects using Transformed Data") ifix
# constfix ffix cfix
preg(method=random,vcomp=wh) invest
# constant firmvalue cstock
Full Program
cal(panelobs=20) 1935
all 10//1954:1
open data grunfeld.dat
data(format=prn,org=cols)
*
* Do fixed and random effects. The intercept in the fixed effects
* estimator gets zeroed out as a time-invariant variable, but we include
* it to maintain the same form as the other regressions.
*
preg(method=fixed) invest
# constant firmvalue cstock
preg(method=random) invest
# constant firmvalue cstock
*
* First difference regression
*
preg(method=fd) invest
# firmvalue cstock
*
* SUR
*
preg(method=sur) invest
# constant firmvalue cstock
*
* Do fixed effects as least squares with dummy variables
*
panel(dummies=idummies)
linreg invest
# firmvalue cstock idummies
*
* Random effects done using transformed data. We first need estimates of the
* component variances. The simplest (though not most accurate) can be computed
* using PSTATS with the residuals from a linear regression. PSTATS does a
* Wallace-Hussain variance calculation treating the input information as data
* (rather than residuals), so it will give a somewhat different values for the
* component variances from the one you get from PREGRESS (even with VCOMP=WH)
* since the latter uses information about the regression being run.
*
* One other difference between the filtered regression and PREGRESS with
* METHOD=RANDOM is that the latter (in effect) uses the computed random variance
* component in calculating the covariance matrix, while the filtered least squares
* estimator uses the standard OLS estimator on the filtered data, thus recomputing
* the residual variance based upon the results.
*
linreg invest
# constant firmvalue cstock
pstats(effects=indiv) %resids
*
set ones = 1.0
panel(gls=standard,effects=indiv,$
vrandom=%vrandom,vindiv=%vindiv) invest / ifix
panel(gls=standard,effects=indiv,$
vrandom=%vrandom,vindiv=%vindiv) firmvalue / ffix
panel(gls=standard,effects=indiv,$
vrandom=%vrandom,vindiv=%vindiv) cstock / cfix
panel(gls=standard,effects=indiv,$
vrandom=%vrandom,vindiv=%vindiv) ones / constfix
linreg(title="Random Effects using Transformed Data") ifix
# constfix ffix cfix
*
preg(method=random,vcomp=wh) invest
# constant firmvalue cstock
Output
Panel Regression - Estimation by Fixed Effects
Dependent Variable INVEST
Panel(20) of Annual Data From 1//1935:01 To 10//1954:01
Usable Observations 200
Degrees of Freedom 188
Centered R^2 0.9440725
R-Bar^2 0.9408002
Uncentered R^2 0.9615675
Mean of Dependent Variable 145.95825000
Std Error of Dependent Variable 216.87529623
Standard Error of Estimate 52.76796595
Sum of Squared Residuals 523478.14739
Regression F(11,188) 288.4996
Significance Level of F 0.0000000
Log Likelihood -1070.7810
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Constant 0.0000000000 0.0000000000 0.00000 0.00000000
2. FIRMVALUE 0.1101238041 0.0118566942 9.28790 0.00000000
3. CSTOCK 0.3100653413 0.0173545028 17.86656 0.00000000
Panel Regression - Estimation by Random Effects-Wansbeek-Kapteyn
Dependent Variable INVEST
Panel(20) of Annual Data From 1//1935:01 To 10//1954:01
Usable Observations 200
Degrees of Freedom 197
Mean of Dependent Variable 145.95825000
Std Error of Dependent Variable 216.87529623
Standard Error of Estimate 51.57596760
Sum of Squared Residuals 524035.84543
Log Likelihood -1095.2767
S.D. (eta_it) 52.7680
S.D. (mu_i) 83.5235
Hausman Test(2) 2.165099
Significance Level 0.3387309
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Constant -57.82187368 28.68561577 -2.01571 0.04383034
2. FIRMVALUE 0.10977763 0.01047110 10.48387 0.00000000
3. CSTOCK 0.30808136 0.01717229 17.94062 0.00000000
Panel Regression - Estimation by First Difference
Dependent Variable INVEST
Panel(20) of Annual Data From 1//1935:01 To 10//1954:01
Usable Observations 190
Degrees of Freedom 188
Skipped/Missing (from 200) 10
Centered R^2 0.4080548
R-Bar^2 0.4049061
Uncentered R^2 0.4288436
Mean of Dependent Variable 10.580789474
Std Error of Dependent Variable 55.606632649
Standard Error of Estimate 42.896251341
Sum of Squared Residuals 345936.61527
Log Likelihood -982.7621
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. FIRMVALUE 0.0890628288 0.0082341070 10.81633 0.00000000
2. CSTOCK 0.2786940167 0.0471564164 5.90999 0.00000002
Panel Regression - Estimation by Cross Individual SUR
Dependent Variable INVEST
Panel(20) of Annual Data From 1//1935:01 To 10//1954:01
Usable Observations 200
Degrees of Freedom 197
Log Likelihood -799.3006
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Constant -1.896858713 0.184802520 -10.26425 0.00000000
2. FIRMVALUE 0.040795066 0.001827778 22.31949 0.00000000
3. CSTOCK 0.084165394 0.002110682 39.87591 0.00000000
Linear Regression - Estimation by Least Squares
Dependent Variable INVEST
Panel(20) of Annual Data From 1//1935:01 To 10//1954:01
Usable Observations 200
Degrees of Freedom 188
Centered R^2 0.9440725
R-Bar^2 0.9408002
Uncentered R^2 0.9615675
Mean of Dependent Variable 145.95825000
Std Error of Dependent Variable 216.87529623
Standard Error of Estimate 52.76796595
Sum of Squared Residuals 523478.14739
Regression F(11,188) 288.4996
Significance Level of F 0.0000000
Log Likelihood -1070.7810
Durbin-Watson Statistic 1.0789
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. FIRMVALUE 0.1101238 0.0118567 9.28790 0.00000000
2. CSTOCK 0.3100653 0.0173545 17.86656 0.00000000
3. IDUMMIES(1) -70.2967175 49.7079588 -1.41419 0.15895875
4. IDUMMIES(2) 101.9058137 24.9383232 4.08631 0.00006485
5. IDUMMIES(3) -235.5718410 24.4316165 -9.64209 0.00000000
6. IDUMMIES(4) -27.8092946 14.0777538 -1.97541 0.04968535
7. IDUMMIES(5) -114.6168128 14.1654333 -8.09130 0.00000000
8. IDUMMIES(6) -23.1612951 12.6687393 -1.82822 0.06910077
9. IDUMMIES(7) -66.5534735 12.8429734 -5.18209 0.00000056
10. IDUMMIES(8) -57.5456573 13.9931464 -4.11242 0.00005848
11. IDUMMIES(9) -87.2222724 12.8918932 -6.76567 0.00000000
12. IDUMMIES(10) -6.5678435 11.8268910 -0.55533 0.57932822
Linear Regression - Estimation by Least Squares
Dependent Variable INVEST
Panel(20) of Annual Data From 1//1935:01 To 10//1954:01
Usable Observations 200
Degrees of Freedom 197
Centered R^2 0.8124080
R-Bar^2 0.8105035
Uncentered R^2 0.8710896
Mean of Dependent Variable 145.95825000
Std Error of Dependent Variable 216.87529623
Standard Error of Estimate 94.40840333
Sum of Squared Residuals 1755850.4841
Regression F(2,197) 426.5757
Significance Level of F 0.0000000
Log Likelihood -1191.8024
Durbin-Watson Statistic 0.3582
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Constant -42.71436944 9.51167603 -4.49073 0.00001207
2. FIRMVALUE 0.11556216 0.00583571 19.80259 0.00000000
3. CSTOCK 0.23067849 0.02547580 9.05481 0.00000000
Linear Regression - Estimation by Random Effects using Transformed Data
Dependent Variable IFIX
Panel(20) of Annual Data From 1//1935:01 To 10//1954:01
Usable Observations 200
Degrees of Freedom 197
Centered R^2 0.7701087
R-Bar^2 0.7677747
Uncentered R^2 0.7793720
Mean of Dependent Variable 22.50972149
Std Error of Dependent Variable 110.12986275
Standard Error of Estimate 53.07131291
Sum of Squared Residuals 554863.15798
Regression F(2,197) 329.9633
Significance Level of F 0.0000000
Log Likelihood -1076.6036
Durbin-Watson Statistic 0.9831
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. CONSTFIX -57.65456985 26.45569335 -2.17929 0.03049659
2. FFIX 0.10973383 0.01029150 10.66257 0.00000000
3. CFIX 0.30764686 0.01723808 17.84694 0.00000000
Panel Regression - Estimation by Random Effects-Wallace-Hussain
Dependent Variable INVEST
Panel(20) of Annual Data From 1//1935:01 To 10//1954:01
Usable Observations 200
Degrees of Freedom 197
Mean of Dependent Variable 145.95825000
Std Error of Dependent Variable 216.87529623
Standard Error of Estimate 51.57326630
Sum of Squared Residuals 523980.95397
Log Likelihood -1095.4262
S.D. (eta_it) 53.7452
S.D. (mu_i) 87.3580
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Constant -57.86252975 29.90491885 -1.93488 0.05300461
2. FIRMVALUE 0.10978918 0.01072476 10.23698 0.00000000
3. CSTOCK 0.30818339 0.01749842 17.61207 0.00000000
Copyright © 2026 Thomas A. Doan