Learn R Programming

spcosa (version 0.4-2)

stratify-methods: 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 SpatialPixels
stratify(object, nStrata, priorPoints = NULL, maxIterations = 1000, nTry = 1,
    equalArea = FALSE, verbose = getOption("verbose"))
# S4 method for SpatialGrid
stratify(object, nStrata, priorPoints = NULL, maxIterations = 1000, nTry = 1,
    equalArea = FALSE, verbose = getOption("verbose"))
# S4 method for SpatialPolygons
stratify(object, nStrata, priorPoints = NULL, maxIterations = 1000, nTry = 1,
    nGridCells = 2500, cellSize, equalArea = FALSE, verbose = getOption("verbose"))

Arguments

object

an object of class "SpatialPixels", "SpatialGrid" or "SpatialPolygons"

nStrata

number of strata (nStrata >= 1).

priorPoints

object of class "SpatialPoints", containing the prior (i.e., existing) points

maxIterations

maximum number of iterations.

nTry

the stratify method will try nTry initial configurations and will keep the best solution in order to reduce the risk of ending up with an unfavorable solution.

nGridCells

in case object is an instance of class "SpatialPolygons", the approximate number of grid cells to be used for discretizing the vector map in object.

cellSize

in case object is an instance of class "SpatialPolygons", the cell size to be used for discretizing the vector map in object. Note that cellsize takes precedence over argument nGridCells.

equalArea

If FALSE the algorithm results in compact strata. If TRUE, the algorithm results in compact strata of equal size.

verbose

if TRUE, progress information and intermediate results will be printed to the output device.

Methods

object = "SpatialPixels"

Stratify a raster representation of the study area.

object = "SpatialPolygons"

Stratify a vector representation of the study area.

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 (tools:::Rd_expr_doi("10.1016/j.cageo.2010.04.005"))

See Also

spsample for sampling, and estimate for inference.

Examples

Run this code
# 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)

}

Run the code above in your browser using DataLab