Hi,
I am trying to calculate Moran's I test for the residuals for a
regression equation, but I have trouble converting my coordinates into
nb format.
I have used the dnearneigh() funtion now with an arbitrarily high upper
distance to make it include all plots. However, when I do the
lm.morantest() I get a Moran's I value which is the same as the expected
value and a P-value of 1.
I have used the following code:
>attach(lowland)
>coords <- as.matrix(cbind(long, $lat))
>coord.nb <- dnearneigh(coords, 0, 10000 longlat=TRUE)
>coord.list <- nb2listw(coord.nb, style="W")
>lianasp.lm <- lm(lianasprich ~ log(averdist) + dsl + lianadens +
wooddens)
>lm.morantest(lianasp.lm, coord.list, alternative="two.sided")
And get the following result
Global Moran's I for regression residuals
data:
model: lm(formula = lianasprich ~ log(averdist) + dsl + lianadens +
wooddens)
weights: coord.list
Moran I statistic standard deviate = 0, p-value = 1
alternative hypothesis: two.sided
sample estimates:
Observed Moran's I Expectation Variance
-1.754386e-02 -1.754386e-02 2.125706e-16
Can anyone tell me where I went wrong or if there is another way to
generate a nb list?
Many thanks,
Geertje
~~~~
Geertje van der Heijden
PhD student
Tropical Ecology
School of Geography
University of Leeds
Leeds LS2 9JT
Tel: (+44)(0)113 3433345
Email: [EMAIL PROTECTED]
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.