3# Elisa129
下面是我自己做的第一问,和你给的答案一样,但第二问不知道怎么做,FGLS应该要用prais命令吧,请问你的第二问答案怎么还是做的OLS回归啊?
. use http://www.stata-press.com/data/imeus/cigconsump
. keep if year == 1985 | year == 1995
(432 observations deleted)
. regress lpackpc lavgprs lincpc
Source |
SS
df
MS
Number of obs =
96
-------------+------------------------------
F(
2,
93) =
45.42
Model |
2.78667621
2
1.3933381
Prob > F
=
0.0000
Residual |
2.85290424
93
.03067639
R-squared
=
0.4941
-------------+------------------------------
Adj R-squared =
0.4832
Total |
5.63958045
95
.059364005
Root MSE
=
.17515
------------------------------------------------------------------------------
lpackpc |
Coef.
Std. Err.
t
P>|t|
[95% Conf. Interval]
-------------+----------------------------------------------------------------
lavgprs |
-.8867271
.128371
-6.91
0.000
-1.141647
-.6318077
lincpc |
.435617
.140242
3.11
0.003
.1571241
.7141099
_cons |
7.780854
.3321711
23.42
0.000
7.121228
8.44048
------------------------------------------------------------------------------
. estat hettest year
Breusch-Pagan / Cook-Weisberg test for heteroskedasticity
Ho: Constant variance
Variables: year
chi2(1)
=
4.31
Prob > chi2
=
0.0379
Hettest is used to test whether the estimated variance of the residuals from a regression are dependent on the values of the year variable. The null hypothesis that the variance of the residuals is homogenous. Therefore, if the p-value is very small, we would have to reject the hypothesis and accept the alternative hypothesis that the variance is not homogenous. So in this case, the evidence is against the null hypothesis that the variance is homogeneous, so we need to refit the model.