epoh 发表于 2011-11-17 17:54 
zhangtao兄,程序没错.我直接copy你贴上来的程序还是可以执行.更何况这是winrats自带的程序与数据.难道你的w ...
epoh老师,您好!
确实是数据弄错了,非常感谢!
*
* PANEL.PRG
* Manual Example 14.4
*
cal(panelobs=20) 1935
all 10//1954:1
open data grunfeld.dat
data(format=prn,org=cols)
*
* Do fixed and random effect. The intercept is dropped from the fixed effects
* regression since it will be wiped out as a time-invariant variable
*
preg(method=fixed) invest
# firmvalue cstock
preg(method=random) invest
# constant firmvalue cstock
preg(method=fd) invest
# firmvalue cstock
preg(method=sur) invest
# constant firmvalue cstock
*
* Do fixed effects as least squares with dummy variables
*
dec vect[series] idummies(10)
do i=1,10
set idummies(i) = %indiv(t)==i
end do i
linreg invest
# firmvalue cstock idummies
*
* Do random effects by using panel data transformations. %VRANDOM and %VINDIV are
* the estimates of the component variances from the PREGRESS instructions. The
* coefficient estimates are identical to those from PREGRESS, but the standard
* errors are slightly different because the LINREG on the transformed variables
* estimates a new SIGMA**2, while PREGRESS uses the %VRANDOM value.
*
compute theta=1-sqrt(%vrandom/(%vrandom+20*%vindiv))
panel(entry=1.0,indiv=-theta) invest / ifix
panel(entry=1.0,indiv=-theta) firmvalue / ffix
panel(entry=1.0,indiv=-theta) cstock / cfix
set constfix = 1-theta
linreg ifix
# constfix ffix cfix
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.944073 R Bar **2 0.940800
Uncentered R**2 0.961567 T x R**2 192.313
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.00000000
Log Likelihood -1070.78103
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. FIRMVALUE 0.1101238041 0.0118566942 9.28790 0.00000000
2. CSTOCK 0.3100653413 0.0173545028 17.86656 0.00000000
Panel Regression - Estimation by Random Effects
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.57371519
Sum of Squared Residuals 523990.07541
Log Likelihood -1095.28595
Hausman Test(2) 2.096758
Significance Level 0.35050549
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. Constant -57.85559027 29.08837067 -1.98896 0.04670568
2. FIRMVALUE 0.10978718 0.01046421 10.49168 0.00000000
3. CSTOCK 0.30816608 0.01708824 18.03381 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
Total Observations 200 Skipped/Missing 10
Centered R**2 0.408055 R Bar **2 0.404906
Uncentered R**2 0.428844 T x R**2 81.480
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.76206
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 -881.09752
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. Constant -42.71436944 0.10075031 -423.96265 0.00000000
2. FIRMVALUE 0.11556216 0.00006181 1869.53078 0.00000000
3. CSTOCK 0.23067849 0.00026985 854.84996 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.944073 R Bar **2 0.940800
Uncentered R**2 0.961567 T x R**2 192.313
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.00000000
Log Likelihood -1070.78103
Durbin-Watson Statistic 1.078912
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 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.769433 R Bar **2 0.767092
Uncentered R**2 0.776925 T x R**2 155.385
Mean of Dependent Variable 19.98207713
Std Error of Dependent Variable 109.30835918
Standard Error of Estimate 52.75282202
Sum of Squared Residuals 548223.46550
Regression F(2,197) 328.7071
Significance Level of F 0.00000000
Log Likelihood -1075.39980
Durbin-Watson Statistic 0.997931
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. CONSTFIX -57.85559027 29.23429433 -1.97903 0.04920554
2. FFIX 0.10978718 0.01051671 10.43931 0.00000000
3. CFIX 0.30816608 0.01717397 17.94379 0.00000000