*
* PANEL.RPF
* Example of panel data estimation techniques
*
* RATS User's Guide, Example from Section 12.7.
*
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