[R-sig-Geo] Problem with moran.test function

Roger Bivand Roger.Bivand at nhh.no
Wed Jun 16 15:08:17 CEST 2010


On Wed, 16 Jun 2010, Michael Haenlein wrote:

> Dear all,
>
> I'm trying to estimate Moran's I using the moran.test function Below
> please find the summary statistics for my network and key variable. In
> doing so, I'm facing the issue that my estimation results in the
> following error message:
>
> Warning message: In moran.test(x, Network_): Out-of-range p-value:
> reconsider test arguments
>
> The results are as follows:
>
>        Moran's I test under randomisation
>
> data:  x
> weights: Network
>
> Moran I statistic standard deviate = NA, p-value = NA
> alternative hypothesis: greater
> sample estimates:
> Moran I statistic       Expectation          Variance
>             -Inf     -0.0002926544                NA
>
> Could anyone please tell me what this error message means?

Well, Moran's I is -Inf, and the analytical variance is NA, so something 
is not right. The problem could lie in x, Network, or the lag of x (when 
x and Network are OK but their combination is unhappy). Can you run 
moran.test() under debug() and check which values lead the value of I to 
go to -Inf? Is this what is going on:

data(columbus)
set.seed(1)
x <- log(rpois(n=49, 2))
x
moran.test(x, nb2listw(col.gal.nb))

where the current spdep release fails reporting:

Error in lag.listw(listw, z, zero.policy = zero.policy, NAOK = NAOK) :
   Variable contains non-finite values

which was a fix introduced four weeks ago, changed to a test on |Inf| from 
a test on NA:

https://r-forge.r-project.org/scm/viewvc.php/pkg/src/lagw.c?root=spdep&r1=244&r2=282

If you update spdep, you'll pick up the improvement (made thanks to a bug 
report by Matias Mayor Fernandez), and if this is the case, the problem is 
in the x.

Hope this helps,

Roger

>
> Is there a problem with my network and/ or with my key variable?
>
> Thanks very much for letting me know,
>
> Michael
>
>
>
>
>
>
> Characteristics of weights list object:
> Neighbour list object:
> Number of regions: 3418
> Number of nonzero links: 6442
> Percentage nonzero weights: 0.05514125
> Average number of links: 1.884728
> Non-symmetric neighbours list
> Weights style: NA
> Weights constants summary:
>      n       nn S0 S1 S2
> NA 3418 11682724  0 NA NA
>
> summary(x)
> Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
> 1082    1543    2119    2250    2886    3965
>
> _______________________________________________
> 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