stratify-methods {spcosa} | R Documentation |
Stratification
Description
Methods for partitioning a spatial object into compact strata by means of k
-means. The objective function to minimize is the mean squared shortest distance (MSSD). Optionally, the strata may be forced to be of equal size. This facilitates field work in case of stratified simple random sampling for composites. Another option is spatial infill sampling, a variant of spatial coverage sampling where existing sampling points are taken into account. Use nTry > 1
, to reduce the risk of ending up in an unfavorable local optimum. Better results will generally be obtained by increasing the ratio nGridCells/nStrata
and by increasing nTry
.
Usage
## S4 method for signature 'SpatialPixels'
stratify(object, nStrata, priorPoints = NULL, maxIterations = 1000, nTry = 1,
equalArea = FALSE, verbose = getOption("verbose"))
## S4 method for signature 'SpatialGrid'
stratify(object, nStrata, priorPoints = NULL, maxIterations = 1000, nTry = 1,
equalArea = FALSE, verbose = getOption("verbose"))
## S4 method for signature 'SpatialPolygons'
stratify(object, nStrata, priorPoints = NULL, maxIterations = 1000, nTry = 1,
nGridCells = 2500, cellSize, equalArea = FALSE, verbose = getOption("verbose"))
Arguments
object |
an object of class |
nStrata |
number of strata ( |
priorPoints |
object of class |
maxIterations |
maximum number of iterations. |
nTry |
the |
nGridCells |
in case |
cellSize |
in case |
equalArea |
If |
verbose |
if |
Methods
- object = "SpatialPixels"
Stratify a raster representation of the study area.
- object = "SpatialPolygons"
Stratify a vector representation of the study area.
Note
When the projection attribute of a map is set to EPSG:4326 (lat/lon), great circle distances will be used for stratification. Otherwise, Euclidean distances will be used.
References
Brus, D. J., Spatjens, L. E. E. M., and de Gruijter, J. J. (1999). A sampling scheme for estimating the mean extractable phosphorus concentration of fields for environmental regulation. Geoderma 89:129-148
de Gruijter, J. J., Brus, D. J., Bierkens, M. F. P., and Knotters, M. (2006) Sampling for Natural Resource Monitoring Berlin: Springer-Verlag.
Walvoort, D., Brus, D. and de Gruijter, J. (2009). Spatial Coverage Sampling on Various Spatial Scales. Pedometron 26:20-22
Walvoort, D. J. J., Brus, D. J. and de Gruijter, J. J. (2010). An R package for spatial coverage sampling and random sampling from compact geographical strata by k
-means. Computers & Geosciences 36: 1261-1267 (doi:10.1016/j.cageo.2010.04.005)
See Also
spsample
for sampling, and estimate
for inference.
Examples
# Note: the example below requires the 'sf'-package
if (require(sf)) {
# read a vector representation of the `Farmsum' field
shpFarmsum <- as(st_read(
dsn = system.file("maps", package = "spcosa"),
layer = "farmsum"), "Spatial")
# stratify `Farmsum' into 50 strata
# NB: increase argument 'nTry' to get better results
set.seed(314)
myStratification <- stratify(shpFarmsum, nStrata = 50, nTry = 1)
# plot the resulting stratification
plot(myStratification)
}