On Thu, 12 Aug 2010, elaine kuo wrote:

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.

Given the possible errors in your construction of spatial weights in your other thread on this list, and the very high levels of residual correlation found here, I would not even start trying to consider this question. Unless you fully understand what the lag model does, and are an econometrician, avoid it. It makes little sense in other fields than spatial econometrics, and its interpretation is non-standard. So stay with errorsarlm() for error SAR models, or spautolm() for a wider selection of error models.

Roger


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]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: roger.biv...@nhh.no

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to