[R-sig-Geo] how to find observed Moran's I value using moran.test(spdep)

Roger Bivand Roger.Bivand at nhh.no
Mon Jun 21 09:46:08 CEST 2010


On Mon, 21 Jun 2010, elaine kuo wrote:

> Dear ,
>
> This is Elaine.
>
> I am computing moran's I using moran.test for
> a generalized linear model (multiregression).

Don't do this, the expected value and the calculated variance under 
normality and randomisation are wrong. Use lm.morantest(), but be aware 
that it is for an lm() fit, not a glm() fit. There are no tests with 
statistical authority for glm residuals (as far as I know).

One would usually assign the output of a test to an object, then examine 
the object with str() to find the required value, here the list component 
called estimate, first vector element.

So lm.morantest(modg1, modg1.listw)$estimate[1] is the calculated value of 
Moran's I for your glm model, for what it is worth.

Roger

>
> The following contents are the results, and I cannot find the observed
> Moran's I mentioned as estimate in the manual.
> Please kindly help indicate if there is observed Moran's I did not notice or
> other method for calculation.
> Thanks
>
> Elaine
>
> data:  residuals(modg1)
> weights: modg1.listw
>
> Moran I statistic standard deviate = 786.6486, p-value < 2.2e-16
> alternative hypothesis: greater
> sample estimates:
> Moran I statistic       Expectation          Variance
>     6.351413e-01     -2.052545e-04      6.523188e-07
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at 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.Bivand at nhh.no



More information about the R-sig-Geo mailing list