实验五异方差性【实验目的】掌握异方差性的检验和修正【实验内容】为了给医疗机构的规划提供依据,分析比较卫生医疗机构与人口数量的关系,交建立卫生医疗机构数与人口数的回归模型。【实验步骤】一、问题的提出和模型设定[例]P124:第五节案例分析理论模型设定为:Y,=β+β,X,+u表5.1 四川省2000年各地区卫生医疗机构数与人口数地区卫生医疗机构数Y/个人口数X/万人成都63041013.3自贡315911攀枝花103934泸州463.71297德阳379.31085绵阳518.41616广元1021302.6遂宁3711375内江1212419.9乐山345.91132南充709.24064眉山339.9827宜宾508.51530广安438.61589达州620.12403雅安149.8866巴中1223346.7资阳1361488.4阿坝82.9536甘孜88.9594凉山402.41471
实验五 异方差性 【实验目的】掌握异方差性的检验和修正. 【实验内容】为了给医疗机构的规划提供依据,分析比较卫生医疗机 构与人口数量的关系,建立卫生医疗机构数与人口数的回归模型。 【实验步骤】 一、问题的提出和模型设定 [例] P124:第五节案例分析 理论模型设定为: i i i Y X u 1 2 表 5.1 四川省 2000 年各地区卫生医疗机构数与人口数 地区 人口数 X/万人 卫生医疗机构数 Y/个 成都 1013.3 6304 自贡 315 911 攀枝花 103 934 泸州 463.7 1297 德阳 379.3 1085 绵阳 518.4 1616 广元 302.6 1021 遂宁 371 1375 内江 419.9 1212 乐山 345.9 1132 南充 709.2 4064 眉山 339.9 827 宜宾 508.5 1530 广安 438.6 1589 达州 620.1 2403 雅安 149.8 866 巴中 346.7 1223 资阳 488.4 1361 阿坝 82.9 536 甘孜 88.9 594 凉山 402.4 1471
二、参数估计输入命令:dataxyIs y cx日Equation:EQ01Workfile:第五章Untitledy回XView Proc Object Print Name Freeze Estimate Forecast Stats ResidsDependent Variable:YMethod:Least SquaresDate:11/16/21 Time:12:20Sample:121Includedobservations:21VariableCoefficientStd.Errort-StatisticProb.c0.0686-562.9074291.5642-1.930646x0.00005.3728280.6442398.3398110.7854381588.143R-squaredMeandependentvar0.7741451310.975AdjustedR-squaredS.D.dependent varS.E.of regression623.030115.79746Akaike info criterion7375164.15.89694Sum squaredresidSchwarzcriterion-163.873315.81905Log likelihoodHannan-Quinn criter.F-statistic69.55245Durbin-Watson stat1.947198Prob(F-statistic)0.000000图5.1回归结果估计结果:Y,=-562.9074+5.372828X(291.5642)(0.644239)(8.3398)t= (-1.9306)R2=0.7854F=69.5525三、检验模型的异方差(一)图示检验法1.Eviews软件操作(1)生成残差平方序列e:genre2=(resid)^2
二、参数估计 输入命令: data x y ls y c x 图 5.1 回归结果 估计结果: Yi Xi ˆ 562.9074 5.372828 (291.5642) (0.644239) t =(-1.9306) (8.3398) 0.7854 2 R F 69.5525 三、检验模型的异方差 (一)图示检验法 1. Eviews 软件操作 (1)生成残差平方序列 2 i e :genr e2 = (resid)^2
(2)绘制e’与x,的散点图:scatxe2Gtaph:GRAPHO1Workfile:第五童Untitled一回XView Proc Object Print Name Freeze Options Update AddText Line/Shade Remove T2.400.0002.000,0001,600,00021,200,000800.000400.00080000.02006008004001,0001,200X图5.2散点图2. 判断从图5.2可以看出,残差平方和e’对解释变量x,的散点图主要分布在图形当中的下三角部分,大致看出e随x的变动呈增大的趋势。因此,模型很可能存在异方差(二)Goldfeld-Quandt检验1.Eviews软件操作(1)对变量取值排序(按递增或递减):在workfile窗口中--选sortseries --选择 ascending(递增)/descending(递减)-- 键入x---点击 OK.(2)构造子样本区间,建立回归模型。在本例中共21个样本容量,删除1/4的观测值,即删除5个观测值,余下部分平分得到两个区间:1~8和14~21,样本个数都是8个
(2)绘制 2 i e 与 i x 的散点图:scat x e2 图 5.2 散点图 2. 判断 从图 5.2 可以看出,残差平方和 2 i e 对解释变量 i x 的散点图主要分布在 图形当中的下三角部分,大致看出 2 i e 随 i x 的变动呈增大的趋势。因此, 模型很可能存在异方差。 (二)Goldfeld-Quandt 检验 1. Eviews 软件操作 (1)对变量取值排序(按递增或递减):在 workfile 窗口中-选 sort series -选择 ascending(递增)/descending(递减) - 键入 x -点击 OK. (2)构造子样本区间,建立回归模型。 在本例中共 21 个样本容量,删除 1/4 的观测值,即删除 5 个观测值, 余下部分平分得到两个区间:1~8 和 14~21,样本个数都是 8 个
(a)选择菜单:sample---18用 OLS 方法:Is y c x日Equation;EQ02Workfile:第五章:Untitled回X-View Proc ObjectPrint Name FreezeEstimate Forecast Stats ResidsDependent Variable:YMethod:Least SquaresDate:11/16/21Time:12:48Sample:18Included observations:8Prob.VariableCoefficientStd.Errort-Statisticc598.2525119.29225.0150180.0024x1.1776500.4901872.4024520.0531R-squared0.490306852.6250Mean dependent varAdjusted R-squared0.405357S.D.dependent var201.5667S.E.ofregression155.4343Akaike info criterion13.14264144958.9Schwarzcriterion13.16250Sum squaredresid13.00869Log likelihood-50.57056Hannan-Quinn criter.F-statistic5.7717751.656269Durbin-Watsonstat0.053117Prob(F-statistic)图5.3样本区间1~8的回归结果421(b)选择菜单:sample---14用 OLS方法:Is y cx日Equation:EQ03 Workfile:第五章:Untitled回X-View Proc ObjectPrint Name FreezeEstimate Forecast Stats ResidsDependentVariable:YMethod:LeastSquaresDate:11/16/21Time:12:49Sample:1421Included observations:8VariableCoefficientStd.ErrorProb,t-Statisticc-2940.426430.7787-6.8258390.0005x9.1776410.69341913.235340.0000R-squared2520.5000.966883Mean dependent var0.9613631781.627Adjusted R-squaredS.D. dependent varS.E.of regression350.2011Akaike info criterion14.76721735844.7SumsquaredresidSchwarzcriterion14.78707Log likelihood-57.06884Hannan-Quinn criter.14.63326175.17441.815102F-statisticDurbin-Watson statProb(F-statistic)0.000011图5.4样本区间14~21的回归结果
(a) 选择菜单:sample - 1 8 用 OLS 方法:ls y c x 图 5.3 样本区间 1~8 的回归结果 (b) 选择菜单:sample - 14 21 用 OLS 方法:ls y c x 图 5.4 样本区间 14~21 的回归结果
Ze735844.7(3)求F统计量:F=5.0762=Zei144958.92. 判断取α=0.05,查F分布表得临界值:F0os(6,6)=4.28:F=5.0762>Fo0s(6,6)=4.28,拒绝原假设Ho,表明模型存在异方差。(三)White检验(1)在equation01中,选择View---Residual diagnostics-Heteroskedasticitytest.(2)在弹出的对话框Specification中--检验类型Test type:White检验--选中IncludeWhitecrossterms复选框,则辅助函数为:o =α+αx +α,x +y日Equation:EQ01Workile:第五章:Untitlec一回XView Proc Object Print Name FreezeEstimate Forecast Stats ResidsHeteroskedasticityTest:WhiteF-statistic0.000055.61118Prob. F(2.18)0.0001Obs'R-squared18.07481Prob. Chi-Square(2)0.0028Scaled explained Ss11.78770Prob.Chi-Square(2)TestEguation:DependentVariable:RESID^2Method:Least SquaresDate:11/16/21 Time:15:07Sample:121Includedobservations:21VariableCoefficientStd.Errort-StatisticProb.c823375.5130273.46.3203650.0000X^24.7423870.5323528.9083660.0000X-3605.578553.5894-6.5130910.00000.860705351198.3R-squaredMeandependentval0.845228454261.0AdjustedR-squaredS.D.dependent var178711.127.15649S.E.of regressionAkaikeinfocriterionSumsquaredresid5.75E+11Schwarzcriterion27.3057127.18888Log likelihood-282.1432Hannan-Quinncriter55.611181.687985F-statisticDurbin-Watsonstat0.000000Prob(F-statistic)图5.5White检验结果
(3)求 F 统计量: 5.0762 144958.9 735844.7 2 1 2 2 i i e e F 2. 判断 取 0.05,查 F 分布表得临界值: (6,6) 4.28 F0.05 , 5.0762 (6,6) 4.28 F F0.05 ,拒绝原假设 H0,表明模型存在异方差。 (三)White 检验 (1)在 equation 01 中,选择 View - Residual diagnostics - Heteroskedasticity test. (2)在弹出的对话框 Specification 中 - 检验类型 Test type: White 检验 - 选中 Include White cross terms 复选框,则辅助函数为: t t t t x x v 2 0 1 2 2 图 5.5 White 检验结果