[R-sig-Geo] sample with varying intensity according to local density

Rolf Turner r.turner at auckland.ac.nz
Mon Oct 20 10:09:34 CEST 2014


On 20/10/14 17:03, Nicolas Meurisse wrote:
> Hi all,
>
> I want to sample locations within a defined area, but also optimize
> the spatial arrangement of my sample locations in order to:
>
> 1.       sample some parts of the area more intensively (e.g. as a
> function of previous findings intensity, as it could be illustrated
> by a density map)
>
> 2.       sample at regular intervals within each area, as opposed to
> pure random sampling (e.g. "regular" or "stratified random" as
> defined in sp package)
>
> Here an example dataset:
> n <- 10000
> x1  <- matrix(rnorm(n), ncol = 2)
> x2  <- matrix(rnorm(n, mean = 3, sd = 1.5), ncol = 2)
> x   <- rbind(x1, x2)
> # scatterplot with smoothed densities color representation
> smoothScatter(x)
> # random sampling (not appropriate, as we want an arrangement that optimizes conditions 1 and 2)
> points(sample(x[,1],20), sample(x[,2],20), col="red", pch=16)
>
> I would greatly appreciate any insight someone might have as it seems
> there are lot of potential applications using  such "stratified"
> sampling.

It seems to that desideratum #1 can easily be effected using the rthin()
function from the spatstat package.

I'm not clear what you actually want to do in respect of desideratum #2, 
but it is at least conceivable that this could be effected in the same 
way:  Provide an image or function specifying the intervals (regions?) 
from which you wish to sample.  I.e. make an image (object of class 
"im") or function which takes the value 1 within the regions from which 
you wish to sample and 0 outside those regions.

cheers,

Rolf Turner

-- 
Rolf Turner
Technical Editor ANZJS



More information about the R-sig-Geo mailing list