> sheng<-readOGR(".","shengditu")
OGR data source with driver: ESRI Shapefile
Source: ".", layer: "shengditu"
with 30 features and 7 fields
Feature type: wkbPolygon with 2 dimensions
> sheng_nb<-poly2nb(sheng)
> sheng_nblist<-nb2listw(sheng_nb)
> Y<-log(sheng$INCOME)
> X1<-log(sheng$CAIZHENG)
> X2<-log(sheng$YONGDIAN)
> M0=lm(sheng$INCOME~sheng$CAIZHENG+sheng$YONGDIAN)
> M0
Call:
lm(formula = sheng$INCOME ~ sheng$CAIZHENG + sheng$YONGDIAN)
Coefficients:
(Intercept) sheng$CAIZHENG sheng$YONGDIAN
2242.7762 1.9409 0.8433
> bptest(M0)
studentized Breusch-Pagan test
data: M0
BP = 13.3794, df = 2, p-value = 0.001244
> M1=lm(Y~X1+X2)
> M1
Call:
lm(formula = Y ~ X1 + X2)
Coefficients:
(Intercept) X1 X2
5.9063 0.1410 0.2403
> bptest(M1)
studentized Breusch-Pagan test
data: M1
BP = 1.0727, df = 2, p-value = 0.5849
空间同步自回归误差模型
M5SEAR<-errorsarlm(form=Y~X1+X2,listw=sheng_nblist,etype="error")
> M5SEAR
Call:
errorsarlm(formula = Y ~ X1 + X2, listw = sheng_nblist, etype = "error")
Type: error
Coefficients:
lambda (Intercept) X1 X2
0.6803705 6.2439714 0.1698298 0.1567685
Log likelihood: 16.28129
空间杜宾误差模型
M6SDEM<-errorsarlm(formula=Y~X1+X2,listw=sheng_nblist,etype="emixed")
> M6SDEM
Call:
errorsarlm(formula = Y ~ X1 + X2, listw = sheng_nblist, etype = "emixed")
Type: error
Coefficients:
lambda (Intercept) X1 X2 lag.X1 lag.X2
0.383941329 5.606443895 0.174980753 0.125294150 0.127128572 0.005312641
Log likelihood: 18.43699
空间自回归滞后模型
> M7SAR<-lagsarlm(Y~X1+X2,listw=sheng_nblist,type="lag")
> M7SAR
Call:
lagsarlm(formula = Y ~ X1 + X2, listw = sheng_nblist, type = "lag")
Type: lag
Coefficients:
rho (Intercept) X1 X2
0.4977138 2.5142894 0.1598273 0.1208989
Log likelihood: 19.10202
空间杜宾模型
> M8SDM<-lagsarlm(Y~X1+X2,list=sheng_nblist,type="mixed")
> M8SDM
Call:
lagsarlm(formula = Y ~ X1 + X2, listw = sheng_nblist, type = "mixed")
Type: mixed
Coefficients:
rho (Intercept) X1 X2 lag.X1
0.44734778 2.94168844 0.15733944 0.12553596 0.03462418
lag.X2
-0.05020476
Log likelihood: 19.35204
一般空间模型SAC
SARAR
M9SAC<-sacsarlm(Y~X1+X2,listw=sheng_nblist,type="sac")
> M9SAC
Call:
sacsarlm(formula = Y ~ X1 + X2, listw = sheng_nblist, type = "sac")
Type: sac
Coefficients:
rho lambda (Intercept) X1 X2
0.6237129 -0.3867786 1.6820435 0.1402677 0.1090523
Log likelihood: 19.50472
M9SARMA<-sacsarlm(Y~X1+X2,listw=sheng_nblist,type="sacmixed")
> M9SARMA
Call:
sacsarlm(formula = Y ~ X1 + X2, listw = sheng_nblist, type = "sacmixed")
Type: sacmixed
Coefficients:
rho lambda (Intercept)
0.72462052 -0.52029281 1.26735141
X1 X2 lag.X1
0.13794167 0.13100192 -0.02403913
lag.X2
-0.07284195
Log likelihood: 19.859