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.
Many thanks !
Nicolas
________________________________
This e-mail and any attachments may contain information ...{{dropped:10}}
sample with varying intensity according to local density
3 messages · Nicolas Meurisse, Rolf Turner, Philippi, Tom
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
Nicholas-- You might also want to consider the spsurvey package (in the spatial task view or http://cran.r-project.org/web/packages/spsurvey/index.html). It supports stratified and unstratified unequal probability independent random sampling, which is how I interpret your first aspect if it is stand-alone. If you need #1 and #2 in the same sample design, spsurvey also supports generalized random tessellation stratified (GRTS) sampling, which is a slick and useful design that is almost as spatially-balanced or spread as grid sampling, but is also a probability design, so it works well for both design-based estimators and model-based estimators such as kriging. GRTS samples are also easy to enlarge or reduce if some points are unsampleable, which isn't possible with grid sampling. GRTS works for sampling from both continuous domains (e.g., areas) or finite domains (sets of spatial locations), and supports stratification as well as unequal probability sampling within and between strata. And, the package includes functions for analyses of the resulting data, including a neighborhood variance estimator for GRTS. It might not meet your needs, but I recommend you consider it. Tom 2 On Mon, Oct 20, 2014 at 1:09 AM, Rolf Turner <r.turner at auckland.ac.nz> wrote:
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
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo