[R-sig-Geo] generating points from random to overdispersed on a raster grid.
Patrick Giraudoux
p@tr|ck@g|r@udoux @end|ng |rom un|v-|comte@|r
Mon Jun 22 16:40:08 CEST 2020
Le 22/06/2020 à 16:20, Roger Bivand a écrit :
> On Sat, 20 Jun 2020, Patrick Giraudoux wrote:
>
>> Dear listers,
>>
>> On a simulation purpose, I would like to generate data variying from
>> random to various degrees of overdispersion on a raster grid. For
>> instance on a matrix 1000 x 1000, to select a number of pixels that
>> could be considered spatially aggregated (with a possibility for tuning
>> the degree of aggregation from "random" - no aggregation - to strong
>> clusters).
>>
>> Has anyone heard about how to proceed or an idea about it?
>
> This sounds very much like spatstat, but could you provide a short
> code example to show what the discretised output should be? Are these
> presence/absence in the grid cells?
>
> Best wishes,
>
> Roger
Good point Roger. Actually some earlier answers helped be even to
clarify the problem in my mind... I did not realise at first there was
two hidden components in my question. I becomes clear that the way to
adress the issue is scale dependent. If the need is to simulate spatial
aggregation of points (e.g. vole colonies or vole individuals), thus we
probably need to dig in Akos' proposition and spatstat, indeed. If the
need is to simulate overdispersed densities (e.g. according to a e.g.
negbinomial distribution), thus selecting pixels randomly on a raster
and giving them the values computed on the negbinomial distribution
should make it. Both can be combined to obtain a perfect mess
The ball is now in my and collaborator's court !
Thanks anyway to responders who really helped be to go a step further
(below David Pleydell's answer, a former postdoc now researcher at INRA,
contacted directly off list, but this might be of interest or other
listers).
------------------------------------------------------------------------
Le 22/06/2020 à 13:01, David Pleydell a écrit :
Hi Patrick
(...)
Since the Poisson is a special case of negative binomial then why not?
https://en.wikipedia.org/wiki/Negative_binomial_distribution#Poisson_distribution
According to the above chunk of wikipedia, as r -> Inf the neg binomial
converges to Poisson. So in a spatial model you could include log(r) (or
log(1/r)) as a Gaussian random field (or Markov random field, or 2-D
spline etc etc). You would need to give some thought as to how to
parameterise this - i.e. if there was no data would you
want over-dispersed vs Poisson to be equally likely, or should the prior
favour one or the other?
If this is a (modestly sized) spatial model it should be possible to use
the conditional-autoregressive (CAR) priors that Andrew Lawson has
written for nimble (https://r-nimble.org/nimbleExamples/CAR.html). These
are adaptations of what has previously been implemented in geo-BUGS
(with the added advantage of the flexibility and transparency of nimble).
One potential limit of this option is that under-dispersion is assumed
to not take place. So a slightly different approach would be needed
for potentially territorial animals (e.g. blackbirds). In this case a
gamma distribution could be more flexible: when scale=1 then
mean=variance, when scale <1 variance<mean, when scale>1 variance>mean.
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list