1、一、异方差检验与修正(一)建立初始回归模型相关命令:data x yscat x yls y c x模型一:Dependent Variable: YMethod: Least SquaresDate: 10/23/14 Time: 10:46Sample: 1 20Included observations: 20Variable Coefficient Std. Error t-Statistic Prob. C 272.3635 159.6773 1.705713 0.1053X 0.755125 0.023316 32.38690 0.0000R-squared 0.983129 Me
2、an dependent var 5199.515Adjusted R-squared 0.982192 S.D. dependent var 1625.275S.E. of regression 216.8900 Akaike info criterion 13.69130Sum squared resid 846743.0 Schwarz criterion 13.79087Log likelihood -134.9130 F-statistic 1048.912Durbin-Watson stat 1.301684 Prob(F-statistic) 0.000000(二)异方差的四种检
3、验方法及其分析右击resid选择Object Copy,输入e得到初始回归模型的残差序列;1. 图示法:scat x e2040801201602004608010120XE2. 模型检验法:ls e2 c xDependent Variable: E2Method: Least SquaresDate: 10/23/14 Time: 10:52Sample: 1 20Included observations: 20Variable Coefficient Std. Error t-Statistic Prob. C -65281.66 21544.58 -3.030073 0.0072X
4、16.49344 3.145895 5.242843 0.0001R-squared 0.604286 Mean dependent var 42337.15Adjusted R-squared 0.582302 S.D. dependent var 45279.67S.E. of regression 29264.05 Akaike info criterion 23.50075Sum squared resid 1.54E+10 Schwarz criterion 23.60032Log likelihood -233.0075 F-statistic 27.48740Durbin-Wat
5、son stat 1.029463 Prob(F-statistic) 0.0000553. GQ假设检验法首先,点击工具按钮 proc选择 sort current page,输入 X,按升序排序;去掉中间约 n/4个样本点,然后对前后两个子样本分别进行回归;子样本模型一:Dependent Variable: YMethod: Least SquaresDate: 10/23/14 Time: 10:57Sample: 1 8Included observations: 8Variable Coefficient Std. Error t-Statistic Prob. C 1277.16
6、1 1540.604 0.829000 0.4388X 0.554126 0.311432 1.779287 0.1255R-squared 0.345397 Mean dependent var 4016.814Adjusted R-squared 0.236296 S.D. dependent var 166.1712S.E. of regression 145.2172 Akaike info criterion 13.00666Sum squared resid 126528.3 Schwarz criterion 13.02652Log likelihood -50.02663 F-
7、statistic 3.165861Durbin-Watson stat 3.004532 Prob(F-statistic) 0.125501子样本模型二:Dependent Variable: YMethod: Least SquaresDate: 10/23/14 Time: 10:57Sample: 13 20Included observations: 8Variable Coefficient Std. Error t-Statistic Prob. C 212.2118 530.8892 0.399729 0.7032X 0.761893 0.060348 12.62505 0.
8、0000R-squared 0.963723 Mean dependent var 6760.477Adjusted R-squared 0.957676 S.D. dependent var 1556.814S.E. of regression 320.2790 Akaike info criterion 14.58858Sum squared resid 615472.0 Schwarz criterion 14.60844Log likelihood -56.35432 F-statistic 159.3919Durbin-Watson stat 1.722960 Prob(F-stat
9、istic) 0.000015根据得到的 RSS1与 RSS2,求得 F检验统计量值。F= RSS2/RSS1=615472.0/126528.3=4.86;查 F分布表,确定临界值 F0.05(6,6);若 F F0.05(6,6)则拒绝 H0,认为原初始模型的随机误差项存在显著的异方差;反之则认为不存在显著的异方差问题。4. 怀特检验法:打开初始模型一,点击View工具按钮,选择residual tests右拉列表选择White Heteroskedasticity Test(cross terms)White Heteroskedasticity Test:F-statistic 14.
10、63595 Probability 0.000201Obs*R-squared 12.65213 Probability 0.001789Test Equation:Dependent Variable: RESID2Method: Least SquaresDate: 10/23/14 Time: 11:24Sample: 1 20Included observations: 20Variable Coefficient Std. Error t-Statistic Prob. C -180998.9 103318.2 -1.751858 0.0978X 49.42846 28.93929
11、1.708006 0.1058X2 -0.002115 0.001847 -1.144742 0.2682R-squared 0.632606 Mean dependent var 42337.15Adjusted R-squared 0.589384 S.D. dependent var 45279.67S.E. of regression 29014.92 Akaike info criterion 23.52649Sum squared resid 1.43E+10 Schwarz criterion 23.67585Log likelihood -232.2649 F-statisti
12、c 14.63595Durbin-Watson stat 2.081758 Prob(F-statistic) 0.000201首先根据上方假设检验统计量及其伴随概率可知,Obs*R-squared=12.65,判断与 2个自由度的卡方统计量临界值的大小关系,得出具体假设检验结果,原理类似于 F检验。(二)异方差的修正方法及其分析加权最小二乘法WLS 首先点击主菜单QuickEstimate Equation,在空白区域输入模型形式Y C X,点击右上方Option按钮,选中左侧中间的WLS法,在W空白区域输入权变量1/abs(e),回车即可得到加权以后的回归模型。Dependent Vari
13、able: YMethod: Least SquaresDate: 10/23/14 Time: 11:12Sample: 1 20Included observations: 20Weighting series: 1/ABS(E)Variable Coefficient Std. Error t-Statistic Prob. C 415.6603 116.9791 3.553288 0.0023X 0.729026 0.022429 32.50349 0.0000Weighted StatisticsR-squared 0.999895 Mean dependent var 4471.6
14、06Adjusted R-squared 0.999889 S.D. dependent var 7313.160S.E. of regression 77.04831 Akaike info criterion 11.62138Sum squared resid 106856.0 Schwarz criterion 11.72096Log likelihood -114.2138 F-statistic 1056.477Durbin-Watson stat 2.367808 Prob(F-statistic) 0.000000Unweighted StatisticsR-squared 0.
15、981664 Mean dependent var 5199.515Adjusted R-squared 0.980645 S.D. dependent var 1625.275S.E. of regression 226.1101 Sum squared resid 920263.9Durbin-Watson stat 1.886959对加权修正以后的模型进行怀特异方差检验,以确定异方差问题是否消除,步骤同前。White Heteroskedasticity Test:F-statistic 0.032603 Probability 0.967983Obs*R-squared 0.07642
16、0 Probability 0.962511Test Equation:Dependent Variable: STD_RESID2Method: Least SquaresDate: 10/23/14 Time: 11:25Sample: 1 20Included observations: 20Variable Coefficient Std. Error t-Statistic Prob. C 6196.481 11798.68 0.525184 0.6062X -0.165323 3.304793 -0.050025 0.9607X2 4.80E-06 0.000211 0.02274
17、5 0.9821R-squared 0.003821 Mean dependent var 5342.798Adjusted R-squared -0.113377 S.D. dependent var 3140.196S.E. of regression 3313.430 Akaike info criterion 19.18684Sum squared resid 1.87E+08 Schwarz criterion 19.33620Log likelihood -188.8684 F-statistic 0.032603Durbin-Watson stat 2.153876 Prob(F
18、-statistic) 0.967983非常明显地判断出异方差性问题已经消除,上面加权修正后的模型即可作为最终模型。二、随机误差项序列相关性问题的检验与修正(一)建立初始回归模型相关命令:data x yscat x yls y c x模型一:Dependent Variable: YMethod: Least SquaresDate: 07/29/12 Time: 09:48Sample: 1991 2011Included observations: 21Variable Coefficient Std. Error t-Statistic Prob. C 178.9755 55.0642
19、1 3.250305 0.0042X 0.020002 0.001134 17.64157 0.0000R-squared 0.942463 Mean dependent var 922.9095Adjusted R-squared 0.939435 S.D. dependent var 659.3491S.E. of regression 162.2653 Akaike info criterion 13.10673Sum squared resid 500270.3 Schwarz criterion 13.20621Log likelihood -135.6207 F-statistic
20、 311.2248Durbin-Watson stat 0.658849 Prob(F-statistic) 0.000000初始回归模型一经济意义合理,统计指标较为理想,但 DW 值偏低,模型可能存在序列相关性。(二)序列相关性的四种检验方法及其分析右击resid选择Object Copy,输入e得到初始回归模型的残差序列;1. 图示法:scat e(-1) e散点图形略2. 自回归模型检验法一阶自回归为:ls e e(-1)Dependent Variable: EMethod: Least SquaresDate: 07/29/12 Time: 09:49Sample (adjusted
21、): 1992 2011Included observations: 20 after adjustmentsVariable Coefficient Std. Error t-Statistic Prob. E(-1) 0.717080 0.201852 3.552497 0.0021R-squared 0.398929 Mean dependent var 2.801737Adjusted R-squared 0.398929 S.D. dependent var 161.7297S.E. of regression 125.3870 Akaike info criterion 12.54
22、939Sum squared resid 298716.2 Schwarz criterion 12.59918Log likelihood -124.4939 Durbin-Watson stat 1.080741说明模型一的随机误差项至少存在一阶正序列相关性,结合该自回归模型的DW值为1.08,怀疑存在更高阶的序列相关,继续引入e(-2)如下:ls e e(-1) e(-2)Dependent Variable: EMethod: Least SquaresDate: 07/29/12 Time: 09:49Sample (adjusted): 1993 2011Included obse
23、rvations: 19 after adjustmentsVariable Coefficient Std. Error t-Statistic Prob. E(-1) 1.094974 0.178768 6.125108 0.0000E(-2) -0.815010 0.199977 -4.075513 0.0008R-squared 0.692885 Mean dependent var 7.790341Adjusted R-squared 0.674819 S.D. dependent var 164.5730S.E. of regression 93.84710 Akaike info
24、 criterion 12.02051Sum squared resid 149723.7 Schwarz criterion 12.11993Log likelihood -112.1949 Durbin-Watson stat 1.945979由于e(-2)的t检验显著,说明模型一的随机误差项确实存在二阶正序列相关性,结合该二阶自回归模型的DW值为1.95,基本确定不存在更高阶的序列相关。Breusch-Godfrey Serial Correlation LM Test:F-statistic 0.888958 Probability 0.431668Obs*R-squared 1.99
25、8924 Probability 0.368077可以看出二阶自回归模型的随机误差项不存在序列相关性,论证了原模型仅存在二阶序列相关。3. DW 检验法0DWdL 存在正自相关(趋近于 0)DLDWdU 不能确定DUDW4d U 无自相关(趋近于 2)4. LM 检验法原理:一方面,根据上面的假设检验结果判断是否存在序列相关性,即根据(n-p)*R 2统计量值与卡方检验临界值 2(P)进行比较,其中 n 为原模型样本容量,P 为选择的滞后阶数,R 2为下面辅助回归模型的可决系数。若(n-p)*R2 2(P),则拒绝不序列相关的原假设,说明模型存在显著的序列相关性;另一方面,结合下面的辅助回归模
26、型中残差滞后变量是否通过 t 检验及 DW 值判断序列相关的具体阶数,方法与上面的自回归模型检验法相同。打开初始模型一,点击View工具按钮,选择residual tests右拉列表选择Serial Correlation LM Test,在出现的对话框中选择滞后的阶数,即检验模型的resid取到滞后多少期。选择滞后一阶检验:Breusch-Godfrey Serial Correlation LM Test:F-statistic 13.15036 Probability 0.001931Obs*R-squared 8.865308 Probability 0.002906Test Equa
27、tion:Dependent Variable: RESIDMethod: Least SquaresDate: 07/29/12 Time: 09:51Presample missing value lagged residuals set to zero.Variable Coefficient Std. Error t-Statistic Prob. C -14.24472 43.18361 -0.329864 0.7453X 0.000714 0.000907 0.786617 0.4417RESID(-1) 0.763263 0.210477 3.626342 0.0019R-squ
28、ared 0.422158 Mean dependent var 1.30E-13Adjusted R-squared 0.357953 S.D. dependent var 158.1566S.E. of regression 126.7275 Akaike info criterion 12.65352Sum squared resid 289077.4 Schwarz criterion 12.80274Log likelihood -129.8619 F-statistic 6.575179Durbin-Watson stat 1.159275 Prob(F-statistic) 0.
29、007183说明原模型确实存在一阶序列相关性,结合该辅助回归模型的DW值为1.16,怀疑存在更高阶的序列相关。重复上述操作,引入滞后二阶检验如下:Breusch-Godfrey Serial Correlation LM Test:F-statistic 20.49152 Probability 0.000030Obs*R-squared 14.84303 Probability 0.000598Test Equation:Dependent Variable: RESIDMethod: Least SquaresDate: 07/29/12 Time: 09:51Presample miss
30、ing value lagged residuals set to zero.Variable Coefficient Std. Error t-Statistic Prob. C 14.06463 32.40987 0.433961 0.6698X -0.000628 0.000742 -0.846303 0.4091RESID(-1) 1.108488 0.176127 6.293696 0.0000RESID(-2) -0.918175 0.226004 -4.062643 0.0008R-squared 0.706811 Mean dependent var 1.30E-13Adjus
31、ted R-squared 0.655072 S.D. dependent var 158.1566S.E. of regression 92.88633 Akaike info criterion 12.07027Sum squared resid 146673.8 Schwarz criterion 12.26923Log likelihood -122.7379 F-statistic 13.66102Durbin-Watson stat 1.950263 Prob(F-statistic) 0.000087由于e(-2)的t检验显著,说明模型一的随机误差项确实存在二阶正序列相关性,结合该二阶自回归模型的DW值为1.95,基本确定不存在更高阶的序列相关。当然可以继续引入滞后三阶检验如下:Breusch-Godfrey Serial Correlation LM Test:F-statistic 12.85743 Probability 0.000157Obs*R-squared 14.84303 Probability 0.001956Test Equation:Dependent Variable: RESIDMethod: Least SquaresDate: 07/29/12 Time: 09:52