Dear all,

I am currently trying to find out if there is a way to calculate a pseudo R2 value from the output of SAR error models or spatial GLS models. I have seen this presented in publications, and the program SAM (Spatial analysis in macroecology) produces this value... but I need to implement the calculation of this pseudo R2 in a piece of R code I am writing. The authors of SAM say they calculate their pseudo R2 using Nagelkerke's 1991 furmulation, which I also have seen used in various other places; so I have tried to use it with R output from functions errorsarlm and gls in R, but the results do not make sense. 

Here is what I am doing:


For SAR error model:

my.lm<-lm(Y~X1+X2+X3, data=DATA)

coords<-as.matrix(cbind(DATA$x,DATA$y))
nb.5<-dnearneigh(coords,0,5)
nb.5.w<-nb2listw(nb.5, glist=NULL, style="W", zero.policy=TRUE)

my.sar.error<- errorsarlm(my.lm, listw=nb.5.w, na.action="na.omit")

lL.B <- logLik(my.sar.error)
lL.0 <- updata(my.sar.error, ~1)
yN<-nrow(DATA)

Nagelkerke<-(1-exp((lL.B-lL.0)*(-2/yN)))/(1-exp((lL.0)*(2/yN)))
Nagelkerke[1]



For the GLS it looks almost identical:

exp.correl.structure<-corExp(form=~x+y)
my.gls<-gls(Y~X1+X2+X3, data=DATA, correlation=exp.correl.structure, 
method="ML"))

lL.B <- logLik(my.gls)
lL.0 <- updata(my.gls, ~1)
yN<-nrow(DATA)

Nagelkerke<-(1-exp((lL.B-lL.0)*(-2/yN)))/(1-exp((lL.0)*(2/yN)))
Nagelkerke[1]

>From running these analyses, I obtain that the pseudo R2 is of almost 0.997, while the ols R2 is of only 0.59. I know this two numbers are not really comparable (I do not expect them to be the same), but also the pseudo R2 produced by SAM is of around 0.55. So I am not sure what is wrong. I think the pseudo R2 I am obtaining is for the model after accountiong for all the spatial autocorrelation, rather than only from what can be predicted by the explanatory variables in the model. If any one knows of a way to do this, or has any ideas of approaches to take or resources to visit, I would appreciate the input. 

Thanks in advance,

Sebastian


 J. Sebastián Tello


Department of Biological Sciences
285 Life Sciences Building
Louisiana State University
Baton Rouge, LA, 70803
(225) 578-4284 (office and lab.)



      
	[[alternative HTML version deleted]]

