Dear List,

I wanna know if lag or error model is better to examine a spatial regression
model.
However, the results of their p-values are the same, which shows no
difference between the models in the aspect.
Please kindly help and thanks.

Elaine


code

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

library(ncf)
library(spdep)

    # get the upper bound
      up <- knearneigh(cbind(datam$lat,datam$lon))
      upknn <- knn2nb(up)
      updist1 <- nbdists(upknn,cbind(datam$lat,datam$lon))
      updist1
      updistvec <- unlist(updist1)
      updistvec
      upmaxd <- max(updistvec)
      upmaxd

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

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

      #length(nb8)
      #sum(card(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$S ~ datam.std$coast + datam.std$topo_var
+datam.std$prec_ran, data = datam.std)
       summary(mig.std)

       mig.lagrange
<-lm.LMtests(mig.std,nb8.w,test=c("LMerr","RLMerr","LMlag","RLMlag","SARMA"))

       print(mig.lagrange)



        Lagrange multiplier diagnostics for spatial dependence



data:

model: lm(formula = datam.std$S ~ datam.std$coast + datam.std$topo_var
+datam.std$prec_ran, data = datam.std)

weights: nb8.w



LMerr = 79589.91, df = 1, p-value < 2.2e-16





        Lagrange multiplier diagnostics for spatial dependence



data:

model: lm(formula = datam.std$S ~ datam.std$coast + datam.std$topo_var
+datam.std$prec_ran, data = datam.std)

weights: nb8.w



RLMerr = 68943.02, df = 1, p-value < 2.2e-16





        Lagrange multiplier diagnostics for spatial dependence



data:

model: lm(formula = datam.std$S ~ datam.std$coast + datam.std$topo_var
+datam.std$prec_ran, data = datam.std)

weights: nb8.w



LMlag = 13000.91, df = 1, p-value < 2.2e-16





        Lagrange multiplier diagnostics for spatial dependence



data:

model: lm(formula = datam.std$S ~ datam.std$coast + datam.std$topo_var
+datam.std$prec_ran, data = datam.std)

weights: nb8.w



RLMlag = 2354.020, df = 1, p-value < 2.2e-16





        Lagrange multiplier diagnostics for spatial dependence



data:

model: lm(formula = datam.std$S ~ datam.std$coast + datam.std$topo_var
+datam.std$prec_ran, data = datam.std)

weights: nb8.w



SARMA = 81943.93, df = 2, p-value < 2.2e-16

	[[alternative HTML version deleted]]

