资源描述:
《空间计量模型R操作代码.docx》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、>sheng<-readOGR(".","shengditu")OGRdatasourcewithdriver:ESRIShapefileSource:".",layer:"shengditu"with30featuresand7fieldsFeaturetype:wkbPolygonwith2dimensions>sheng_nb<-poly2nb(sheng)>sheng_nblist<-nb2listw(sheng_nb)>Y<-log(sheng$INCOME)>X1<-log(sheng$CAIZHENG)>X2<-log(sheng$YONGDIAN)>M0=lm(sheng$IN
2、COME~sheng$CAIZHENG+sheng$YONGDIAN)>M0Call:lm(formula=sheng$INCOME~sheng$CAIZHENG+sheng$YONGDIAN)Coefficients:(Intercept)sheng$CAIZHENGsheng$YONGDIAN2242.77621.94090.8433>bptest(M0)studentizedBreusch-Pagantestdata:M0BP=13.3794,df=2,p-value=0.>M1=lm(Y~X1+X2)>M1Call:lm(formula=Y~X1+X2)Coefficients:(In
3、tercept)X1X25.90630.14100.2403>bptest(M1)studentizedBreusch-Pagantestdata:M1BP=1.0727,df=2,p-value=0.5849空间同步自回归误差模型M5SEAR<-errorsarlm(form=Y~X1+X2,listw=sheng_nblist,etype="error")>M5SEARCall:errorsarlm(formula=Y~X1+X2,listw=sheng_nblist,etype="error")Type:errorCoefficients:lambda(Intercept)X1X20.6
4、.0.0.Loglikelihood:16.28129空间杜宾误差模型M6SDEM<-errorsarlm(formula=Y~X1+X2,listw=sheng_nblist,etype="emixed")>M6SDEMCall:errorsarlm(formula=Y~X1+X2,listw=sheng_nblist,etype="emixed")Type:errorCoefficients:lambda(Intercept)X1X2lag.X1lag.X20.5.0.0.0.0.Loglikelihood:18.43699空间自回归滞后模型>M7SAR<-lagsarlm(Y~X1+X2
5、,listw=sheng_nblist,type="lag")>M7SARCall:lagsarlm(formula=Y~X1+X2,listw=sheng_nblist,type="lag")Type:lagCoefficients:rho(Intercept)X1X20.2.0.0.Loglikelihood:19.10202空间杜宾模型>M8SDM<-lagsarlm(Y~X1+X2,list=sheng_nblist,type="mixed")>M8SDMCall:lagsarlm(formula=Y~X1+X2,listw=sheng_nblist,type="mixed")Type
6、:mixedCoefficients:rho(Intercept)X1X2lag.X10.2.0.0.0.lag.X2-0.Loglikelihood:19.35204一般空间模型SACSARARM9SAC<-sacsarlm(Y~X1+X2,listw=sheng_nblist,type="sac")>M9SACCall:sacsarlm(formula=Y~X1+X2,listw=sheng_nblist,type="sac")Type:sacCoefficients:rholambda(Intercept)X1X20.-0.1.0.0.Loglikelihood:19.50472M9SA
7、RMA<-sacsarlm(Y~X1+X2,listw=sheng_nblist,type="sacmixed")>M9SARMACall:sacsarlm(formula=Y~X1+X2,listw=sheng_nblist,type="sacmixed")Type:sacmixedCoefficients:rholambda(Intercept)0.-0.1.X1X2lag.X10.0.-0.