[R-sig-Geo] how to assess spatial randomness of an spp given the distribution of another spp

sylvain willart sylvain.willart at gmail.com
Mon Nov 29 18:03:56 CET 2010


well, thanks
it works and is precisely what I needed !
just added some weighting options in the use of density function (Yden)

Sylvain

2010/11/29 Adrian Baddeley <adrian at maths.uwa.edu.au>:
> sylvain willart <sylvain.willart at gmail.com> writes:
>
>  > I am working with spatstat package to analyse two
>> spatial points data frames:
>> - the locations of hospitals in France
>>  - the location of the population (each 'point' here
>> represents about 3,000 people)
>> I used quadrat.test and kstest to test for spatial randomness of
>> hospitals, which, hopefully is not random,
>> I would like to know if there's a (simple non-bayesian) way of
>> assessing spatial randomness for hospitals given the distribution of
>> the population,
>> and ultimately if it is possible to do so using MarkedPointProcess
>> package (the hospitals being of different sizes, and populations
>> having different needs for healthcare)
>
> Suppose X is the point pattern of hospitals and Y the point pattern of the
> reference population. First smooth the reference population to get a
> population density e.g.
>       Yden <- density(Y)
> (see 'density.ppp' for additional arguments to control the smoothing)
> Next rescale this intensity to have the same total as the hospitals
>
>       nn <- npoints(X)/npoints(Y)
>       Href <- eval.im(Yden * nn)
>
> Thus Href is (a smooth estimate of) the predicted intensity of hospitals
> under the assumption that hospitals are randomly allocated in proportion to
> population density, independent of one another.
>
> Finally compute the inhomogeneous K-function
>
>       Ki <- Kinhom(X, Href)
>       plot(Ki)
>
> The result has an interpretation similar to the usual K-function except that
> it is adjusted for the population density. [In the latest versions of
> spatstat, Href can be replaced by Yden in the last command, because Kinhom
> automatically renormalises]
>
> To generate simulation envelopes,
>
>        e <- expression(rpoispp(Href))
>        plot(envelope(X, Kinhom, lambda=Yden, simulate=e, nsim=39))
>
> Adrian Baddeley
>
>
>
>



More information about the R-sig-Geo mailing list