Dear Community,

I already performed some successful Moran's I tests using the moran.test 
function (spdep package) for my data but now I got an error that I do not 
understand.

For the code:

> moran.temp <- moran.test(birds_s...@data[, i], birds.nb4.idw.W_lw, 
> zero.policy = TRUE, na.action = na.exclude)

where birds_s...@data is the data frame with the variables to be tested and 
birds.nb4.idw.W_lw is a listw object with the weights from an inverse distance 
matrix and four neighbours for each coordinate. I set na.action to na.exclude 
because I know that there are some NA values in the data; therefore I also set 
the zero.policy to TRUE. The code fragment is running in a loop for all 
variables that I want to be tested. For all other data sets it worked perfectly 
but now I get the the following error:

Error in subset.listw(listw, subset, zero.policy = zero.policy) : 
  Not yet able to subset general weights lists

When I checked for the value of i it was clear that the error happens for the 
first time in the presence of NA values in the data, i. e. in the first column 
that contains NAs. Since I set na.action = na.exclude and it worked for other 
data sets that contain NAs I am not sure what is the problem here?

Any suggestions?


Regards,

Nils Breitbach
_______________________________________________
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