So stay with errorsarlm() for error SAR models, or spautolm() for a wider
selection of error models.

=>

?spautolm, which shows

Spatial conditional and simultaneous autoregression model estimation

Description:

     Function taking family and weights arguments for spatial
     autoregression model estimation by Maximum Likelihood, using full
     matrix methods, not suited to large data sets with thousands of
     obse'interval=' argument should be set.

both SAR and CAR were tried but run very well with 4000 data sets here.

In the results, CAR seems to be more suitable than SAR based on
log-likelihood and AIC.

Elaine


Results

>  summary(mignb8.sar)

Call: spautolm(formula = datam.std$SummerM_ratio ~ datam.std$coast +
    datam.std$topo_mean + datam.std$prec_mean, data = datam.std, listw =
nb8.w, na.action = na.omit,
    family = "SAR", method = "Matrix", verbose = TRUE, zero.policy = TRUE)

Residuals:
       Min         1Q     Median         3Q        Max
-0.4775092 -0.0438067 -0.0045993  0.0405448  0.4616156

Coefficients:
                      Estimate Std. Error  z value  Pr(>|z|)
(Intercept)          3.8716032  1.2590572   3.0750  0.002105
datam.std$coast      0.0149182  0.0052961   2.8169  0.004850
datam.std$topo_mean  0.0142579  0.0024689   5.7751 7.690e-09
datam.std$prec_mean -0.0427762  0.0033422 -12.7988 < 2.2e-16


Lambda: 0.999 LR test value: 13678 p-value: < 2.22e-16

Log likelihood: 4909.326
ML residual variance (sigma squared): 0.007599, (sigma: 0.087172)
Number of observations: 4873
Number of parameters estimated: 8
AIC: -9802.7




>      summary(mignb8.car)

Call: spautolm(formula = datam.std$SummerM_ratio ~ datam.std$coast +
    datam.std$topo_mean + datam.std$prec_mean, data = datam.std, listw =
nb8.w, na.action = na.omit,
    family = "CAR", method = "Matrix", verbose = TRUE, zero.policy = TRUE)

Residuals:
      Min        1Q    Median        3Q       Max
-0.487501 -0.086579  0.011347  0.116020  0.970053

Coefficients:
                      Estimate Std. Error z value  Pr(>|z|)
(Intercept)          1.7232148  0.0516192  33.383 < 2.2e-16
datam.std$coast      0.3527424  0.0050680  69.603 < 2.2e-16
datam.std$topo_mean  0.0563818  0.0029408  19.172 < 2.2e-16
datam.std$prec_mean -0.0722950  0.0040828 -17.707 < 2.2e-16


Lambda: 0.999 LR test value: 11133 p-value: < 2.22e-16

Log likelihood: 3636.802
ML residual variance (sigma squared): 0.012985, (sigma: 0.11395)
Number of observations: 4873
Number of parameters estimated: 8
AIC: -7257.6


code
rm(list=ls())
datam <-read.csv("c:/migration/Mig_ratio_20100808.csv",header=T,
row.names=1)
dim(datam)
library(ncf)

# Define coordinates, neighbours, and spatial weights
      coords<-cbind(datam$lon,datam$lat)
      coords<-as.matrix(coords)

    # Define neighbourhood (here distance 8)
      nb8<-dnearneigh(coords,0,8.12)
      summary(nb8)

 # Spatial weights, illustrated with coding style "W" (row standardized)
      nb8.w<-nb2listw(nb8, glist=NULL, style="W")

 # std model
       datam.sd<-scale(datam)
       datam.std<-as.data.frame(datam.sd)
       summary (datam.std)
       mean(datam.std)

          # obtain standard deviation
          sd(datam.std)

       mig.std
<-lm(datam.std$Summer~datam.std$coast+datam.std$topo_var+datam.std$prec_ran,data=datam.std)
       summary(mig.std)

# SAR of spautolm
 mignb8.sar <-
spautolm(datam.std$Summer~datam.std$coast+datam.std$topo_var+datam.std$prec_ran,data=datam.std,
listw=nb8.w, na.action=na.omit, , zero.policy=TRUE, family="SAR",
method="Matrix", verbose=TRUE)
     summary(mignb8.sar)

     # CAR of spautolm
     mignb8.car <-
spautolm(datam.std$Summer~datam.std$coast+datam.std$topo_var+datam.std$prec_ran,data=datam.std,
listw=nb8.w, na.action=na.omit, , zero.policy=TRUE, family="CAR",
method="Matrix", verbose=TRUE)
     summary(mignb8.car)








>
>

	[[alternative HTML version deleted]]

