[R-sig-Geo] spatially autocorrelated wildlife counts
Ana Nuno
ana.nuno08 at imperial.ac.uk
Tue Jun 21 14:37:22 CEST 2011
Dear all,
Sorry for posting the question again but I'd been advised to do so
including more information. Hopefully, this will make my simulation
approach and questions clearer.
As I said before:
> I am trying to simulate the distribution of a ungulate species across
> a landscape, where animals of this species are spatially aggregated
> (exact aggregation level is unknown so I'll have a range of values). I
> know the "true" size of this population because it results from my
> previously built biological model. After spreading these animals across the landscape, I'll simulate counts using fixed
> transects.
>
> My response variable is number of animals per cell. I am assuming a
> zero-inflated negative binomial distribution and, to simulate spatial
> autocorrelation, I'm planning to use spatial lag models (number of
> animals in each cell should be affected by number of animals in
> neighbour cells). Because my landscape matrix has 250 000 cells, I'm
> using the function powerWeights and not invIrW.
Thus, I am using:
library(spdep)
neighbours <- cell2nb(500, 500, torus=TRUE)
x <- matrix(rzinbinom(length(neighbours),52,0.1,0.7), nrow=length(neighbours))
W <- as(as_dgRMatrix_listw(nb2listw(neighbours,style="W")), "CsparseMatrix")
ee <- powerWeights(W, rho=0.9, X=x)
# and zero-inflated negative binomial distribution is defined by:
rzinbinom <- function(n, mu, size, zprob) {
ifelse(runif(n) < zprob, 0, rnbinom(n, mu=mu, size=size))
}
My questions are:
- approximately 70% of cells should have no animals (hence the
zero-inflated distribution) but after applying the spatial weights,
these cells are populated. How to maintain some cells empty?
- the total population is known so, after incorporating spatial
autocorrelation, I should have exactly 1 000 000 animals across the
landscape. Any advice on how to do this? I am currently using an
extremely simplistic, and potentially wrong, approach, where:
ratio<-sum(ee)/1000000 #1000000 is total pop size; ratio calculates
discrepancy between simulated and real population
final<-round(ee at x/ratio) # this gives the real number of animals per
cell (total across 250 000 cells should be 1 000 000)
Finally, I'd also appreciate any comments on my approach to this simulation.
Thanks in advance!
--
Ana Nuno
http://iccs.org.uk/ananuno.htm
http://fp7hunt.net/
More information about the R-sig-Geo
mailing list