Title: | Spatial Coverage Sampling and Random Sampling from Compact Geographical Strata |
---|---|
Description: | Spatial coverage sampling and random sampling from compact geographical strata created by k-means. See Walvoort et al. (2010) <doi:10.1016/j.cageo.2010.04.005> for details. |
Authors: | Dennis Walvoort [aut, cre, cph] , Dick Brus [aut, cph] , Jaap de Gruijter [aut, cph] |
Maintainer: | Dennis Walvoort <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.4-2 |
Built: | 2024-12-03 06:55:41 UTC |
Source: | CRAN |
Algorithms for spatial coverage sampling and for random sampling from compact
geographical strata based on -means.
The spcosa-package provides algorithms for spatial coverage sampling and for random sampling from
compact geographical strata based on -means (see de Gruijter et al., 2006, Walvoort et al., 2010, and
kmeans
). S4-classes and methods are available for spatial coverage sampling, random sampling from
compact geographical strata, and stratified simple random sampling for composites. In case of spatial coverage
sampling, existing sampling points may be taken into account. See the package vignette for more information and examples.
In order to get the spcosa-package running, make sure that a recent version of Java is installed. Free Java downloads are available at https://www.java.com.
D.J.J. Walvoort, D.J. Brus, J.J. de Gruijter,
Maintainer: Dennis Walvoort [email protected]
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 -means. Computers & Geosciences 36: 1261-1267 (doi:10.1016/j.cageo.2010.04.005)
stratify
for stratification, spsample
for sampling, and
estimate
for inference.
A class for storing a stratification with compact strata.
Objects can be created by calls of the form
new("CompactStratification", cells, stratumId, centroids, mssd)
. However, objects are usually
created by calling stratify
.
cells
:Object of class "SpatialPixels"
, representing the area to be partitioned.
stratumId
:Object of class "integer"
, indicating to which stratum each cell in cells
belong.
centroids
:Object of class "SpatialPoints"
, representing the centers of gravity of each stratum.
mssd
:Object of class "numeric"
, representing the mean squared shortest distance.
Class "Stratification"
, directly.
signature(from = "CompactStratification", to = "data.frame")
: coerces to "data.frame"
.
signature(from = "CompactStratification", to = "SpatialPixels")
: coerces to "SpatialPixels"
.
signature(from = "CompactStratification", to = "SpatialPixelsDataFrame")
: coerces to "SpatialPixelsDataFrame"
.
signature(statistic = "SamplingVariance", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates the sampling variance. See "SamplingVariance"
for more details.
signature(statistic = "SpatialCumulativeDistributionFunction", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates the spatial cumulative distribution function (SCDF). See "SpatialCumulativeDistributionFunction"
for more details.
signature(statistic = "SpatialMean", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates the spatial mean. See "SpatialMean"
for more details.
signature(statistic = "SpatialVariance", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates the spatial variance. See "SpatialVariance"
for more details.
signature(statistic = "StandardError", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates the standard error of the spatial mean. See "StandardError"
for more details.
signature(statistic = "character", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates statistic
, one of spatial mean
, spatial variance
, SCDF
, sampling variance
, or standard error
.
signature(object = "CompactStratification")
: returns the area of each stratum.
signature(object = "CompactStratification")
: returns the center of gravity of each stratum.
signature(object = "CompactStratification")
: returns the number of strata.
signature(object = "CompactStratification")
: extracts the mean squared shortest distance.
signature(object = "CompactStratification")
: returns the relative area of each stratum. The sum of the relative areas equals one.
signature(x = "CompactStratification", y = "missing")
: plots stratification x
.
signature(x = "CompactStratification", y = "SamplingPattern")
: plots sampling pattern y
on top of stratification x
.
signature(x = "CompactStratification", y = "SamplingPatternPriorPoints")
: plots sampling pattern y
on top of stratification x
.
signature(x = "CompactStratification", y = "SamplingPatternRandomComposite")
: plots sampling pattern y
on top of stratification x
.
signature(x = "CompactStratification", n = "missing", type = "missing")
: returns the centers of gravity of each stratum.
signature(x = "CompactStratification", n = "numeric", type = "missing")
: randomly selects n
sampling points in each stratum.
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
A class for storing a stratification with compact strata of equal size.
Objects can be created by calls of the form new("CompactStratificationEqualArea", cells, stratumId, centroids, mssd)
. However, objects are usually created by calling stratify
.
cells
:Object of class "SpatialPixels"
, representing the area to be partitioned.
stratumId
:Object of class "integer"
, indicating to which stratum each cell in cells
belong.
centroids
:Object of class "SpatialPoints"
, representing the centers of gravity of each stratum.
mssd
:Object of class "numeric"
, representing the mean squared shortest distance.
Class "CompactStratification"
, directly.
Class "Stratification"
, by class "CompactStratification", distance 2.
signature(statistic = "SamplingVariance", stratification = "CompactStratificationEqualArea", samplingPattern = "SamplingPatternRandomComposite", data = "data.frame")
: estimates the sampling variance. See "SamplingVariance"
for more details.
signature(statistic = "SpatialMean", stratification = "CompactStratificationEqualArea", samplingPattern = "SamplingPatternRandomComposite", data = "data.frame")
: estimates the spatial mean. See "SpatialMean"
for more details.
signature(x = "CompactStratificationEqualArea", n = "missing", type = "missing")
: returns the centers of gravity of each stratum.
signature(x = "CompactStratificationEqualArea", n = "numeric", type = "missing")
: randomly selects n
sampling points in each stratum.
signature(x = "CompactStratificationEqualArea", n = "numeric", type = "character")
: randomly selects n
sampling points in each stratum. if type = "composite"
, stratified simple random sampling of composites.
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
A class for storing a stratification with compact strata, given prior sampling locations.
Objects can be created by calls of the form new("CompactStratificationPriorPoints", cells, stratumId, centroids, mssd, priorPoints)
. However, objects are usually created by calling stratify
.
priorPoints
:Object of class "SpatialPoints"
, containing the coordinates of the existing locations.
cells
:Object of class "SpatialPixels"
, representing the area to be partitioned.
stratumId
:Object of class "integer"
, indicating to which stratum each cell in cells
belong.
centroids
:Object of class"SpatialPoints"
, representing the centers of gravity of each stratum.
mssd
:Object of class "numeric"
, representing the mean squared shortest distance.
Class "CompactStratification"
, directly.
Class "Stratification"
, by class "CompactStratification", distance 2.
signature(x = "CompactStratificationPriorPoints", n = "missing", type = "missing")
: returns the centers of gravity of strata without prior points in addition to the prior points.
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
Methods for estimating statistics given a spatial sample.
estimates one of the following statistics, depending on the value of argument statistic
: spatial mean
, spatial variance
, sampling variance
, standard error
, or scdf
. See the examples below for details.
estimates one of the following statistics, depending on the value of argument statistic
: spatial mean
, sampling variance
, or standard error
.
estimates the sampling variance. See "SamplingVariance"
for more details.
estimates the standard error of the spatial mean. See "StandardError"
for more details.
estimates the spatial cumulative distribution function (SCDF). See "SamplingPatternRandomSamplingUnits"
for more details.
estimates the spatial mean. See "SpatialMean"
for more details.
estimates the spatial variance. See "SpatialVariance"
for more details.
# Note: the example below requires the 'sf'-package. if (require(sf)) { # read vector representation of the "Mijdrecht" area shp <- as(st_read( dsn = system.file("maps", package = "spcosa"), layer = "mijdrecht"), "Spatial") # stratify into 30 strata myStratification <- stratify(shp, nStrata = 30, nTry = 10, verbose = TRUE) # random sampling of two sampling units per stratum mySamplingPattern <- spsample(myStratification, n = 2) # plot sampling pattern plot(myStratification, mySamplingPattern) # simulate data # (in real world cases these data have to be obtained by field work etc.) myData <- as(mySamplingPattern, "data.frame") myData$observation <- rnorm(n = nrow(myData), mean = 10, sd = 1) # design-based inference estimate("spatial mean", myStratification, mySamplingPattern, myData["observation"]) estimate("sampling variance", myStratification, mySamplingPattern, myData["observation"]) estimate("standard error", myStratification, mySamplingPattern, myData["observation"]) estimate("spatial variance", myStratification, mySamplingPattern, myData["observation"]) estimate("scdf", myStratification, mySamplingPattern, myData["observation"]) }
# Note: the example below requires the 'sf'-package. if (require(sf)) { # read vector representation of the "Mijdrecht" area shp <- as(st_read( dsn = system.file("maps", package = "spcosa"), layer = "mijdrecht"), "Spatial") # stratify into 30 strata myStratification <- stratify(shp, nStrata = 30, nTry = 10, verbose = TRUE) # random sampling of two sampling units per stratum mySamplingPattern <- spsample(myStratification, n = 2) # plot sampling pattern plot(myStratification, mySamplingPattern) # simulate data # (in real world cases these data have to be obtained by field work etc.) myData <- as(mySamplingPattern, "data.frame") myData$observation <- rnorm(n = nrow(myData), mean = 10, sd = 1) # design-based inference estimate("spatial mean", myStratification, mySamplingPattern, myData["observation"]) estimate("sampling variance", myStratification, mySamplingPattern, myData["observation"]) estimate("standard error", myStratification, mySamplingPattern, myData["observation"]) estimate("spatial variance", myStratification, mySamplingPattern, myData["observation"]) estimate("scdf", myStratification, mySamplingPattern, myData["observation"]) }
Methods for extracting the area of objects.
returns the area of each stratum.
Methods for extracting centroids
returns the centers of gravity of each stratum.
Methods for extracting the number of strata of objects.
returns the number of strata in a compact stratification.
Methods for extracting the objective function value
extracts the mean squared shortest distance.
Methods for extracting relative areas of objects. The total area equals unity.
returns the relative area of each stratum. The sum of the relative areas equals 1.
Methods for extracting the sample size.
returns the sample size.
returns the number of composites
The plot
method can be used to visualize compact stratifications and sampling patterns. Since it has
been built on top of the ggplot2 package, functions provided by this package can be used to
modify the plots.
plots stratification x
.
plots sampling pattern y
on top of stratification x
.
plots sampling pattern y
on top of stratification x
.
plots sampling pattern y
on top of stratification x
.
plots sampling pattern x
.
plots sampling pattern x
.
plots sampling pattern x
.
ggplot2-package
A class for storing a sampling pattern.
Objects can be created by calls of the form new("SamplingPattern", ...)
. However, objects are usually created by calling spsample
.
sample
:Object of class "SpatialPoints"
, containing the sampling locations.
signature(from = "SamplingPattern", to = "data.frame")
: coerces to "data.frame"
.
signature(from = "SamplingPattern", to = "SpatialPoints")
: coerces to "SpatialPoints"
.
signature(object = "SamplingPattern")
: returns the sample size.
signature(x = "CompactStratification", y = "SamplingPattern")
: plots sampling pattern y
on top of stratification x
.
signature(x = "SamplingPattern", y = "missing")
: plots sampling pattern x
.
signature(object = "SamplingPattern")
: prints object
on the output device.
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
A class for storing a sampling pattern, where the sampling locations are the centers of gravity of each stratum.
Objects can be created by calls of the form new("SamplingPatternCentroids", ...)
. However, objects are usually created by calling spsample
.
sample
:Object of class "SpatialPoints"
, containing the sampling locations
Class "SamplingPatternPurposive"
, directly.
Class "SamplingPattern"
, by class "SamplingPatternPurposive", distance 2.
No methods defined with class "SamplingPatternCentroids" in the signature.
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
A class for storing a sampling pattern consisting of existing points and new points. The new points are the centers of gravity of their stratum.
Objects can be created by calls of the form new("SamplingPatternPriorPoints", ...)
. However, objects are usually created by calling spsample
.
isPriorPoint
:Object of class "logical"
, which is TRUE
is the location is a prior point, and FALSE
if it is not.
sample
:Object of class "SpatialPoints"
, containing the sampling locations
Class "SamplingPatternPurposive"
, directly.
Class "SamplingPattern"
, by class "SamplingPatternPurposive", distance 2.
signature(x = "CompactStratification", y = "SamplingPatternPriorPoints")
: plots sampling pattern y
on top of stratification x
.
signature(x = "SamplingPatternPriorPoints", y = "missing")
: plots sampling pattern x
.
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
An ancestor class for storing purposive sampling patterns.
Objects can be created by calls of the form new("SamplingPatternPurposive", ...)
.
sample
:Object of class "SpatialPoints"
, containing the sampling locations
Class "SamplingPattern"
, directly.
No methods defined with class "SamplingPatternPurposive" in the signature.
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
An ancestor class for storing random sampling patterns.
Objects can be created by calls of the form new("SamplingPatternRandom", ...)
.
sample
:Object of class "SpatialPoints"
, containing the sampling locations
Class "SamplingPattern"
, directly.
No methods defined with class "SamplingPatternRandom" in the signature.
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
A class for storing composites obtained by random sampling.
Objects can be created by calls of the form new("SamplingPatternRandomComposite", ...)
. However, objects are usually created by calling spsample
.
composite
:Object of class "integer"
, indicating to which composite sample a sampling unit belongs.
sample
:Object of class "SpatialPoints"
, containing the sampling locations.
Class "SamplingPatternRandom"
, directly.
Class "SamplingPattern"
, by class "SamplingPatternRandom", distance 2.
signature(from = "SamplingPatternRandomComposite", to = "data.frame")
: coerces to "data.frame"
.
signature(from = "SamplingPatternRandomComposite", to = "SpatialPointsDataFrame")
: coerces to "SpatialPointsDataFrame"
.
signature(statistic = "SamplingVariance", stratification = "CompactStratificationEqualArea", samplingPattern = "SamplingPatternRandomComposite", data = "data.frame")
: estimates the sampling variance. See "SamplingVariance"
for more details.
signature(statistic = "SpatialMean", stratification = "CompactStratificationEqualArea", samplingPattern = "SamplingPatternRandomComposite", data = "data.frame")
: estimates the spatial mean. See "SpatialMean"
for more details.
signature(object = "SamplingPatternRandomComposite")
: returns the sample size per stratum.
signature(x = "CompactStratification", y = "SamplingPatternRandomComposite")
: plots sampling pattern y
on top of stratification x
.
signature(x = "SamplingPatternRandomComposite", y = "missing")
: plots sampling pattern x
.
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
A class for storing sampling units obtained by random sampling.
Objects can be created by calls of the form new("SamplingPatternRandomSamplingUnits", ...)
. However, objects are usually created by calling spsample
.
sample
:Object of class "SpatialPoints"
, containing the sampling locations.
Class "SamplingPatternRandom"
, directly.
Class "SamplingPattern"
, by class "SamplingPatternRandom", distance 2.
signature(statistic = "SamplingVariance", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates the sampling variance. See "SamplingVariance"
for more details.
signature(statistic = "SpatialCumulativeDistributionFunction", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates the spatial cumulative distribution function (SCDF). See "SamplingPatternRandomSamplingUnits"
for more details.
signature(statistic = "SpatialMean", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates the spatial mean. See "SpatialMean"
for more details.
signature(statistic = "SpatialVariance", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates the spatial variance. See "SpatialVariance"
for more details.
signature(statistic = "StandardError", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates the standard error of the spatial mean. See "StandardError"
for more details.
signature(statistic = "character", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates statistic
, i.e., "spatial mean"
, "spatial variance"
, "sampling variance"
, "standard error"
, SCDF
.
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
The sampling variance is estimated by means of Equation 7.14 in de Gruijter et al., (2006).
Objects can be created by calls of the form new("SamplingVariance", ...)
.
description
:Object of class "character"
A description op the statistic.
Class "Statistic"
, directly.
signature(statistic = "SamplingVariance", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates the sampling variance, given a stratification, a sampling pattern and data.
signature(statistic = "SamplingVariance", stratification = "CompactStratificationEqualArea", samplingPattern = "SamplingPatternRandomComposite", data = "data.frame")
: estimates the sampling variance, given a stratification, a sampling pattern and data.
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
de Gruijter, J. J., Brus, D. J., Bierkens, M. F. P., and Knotters, M. (2006) Sampling for Natural Resource Monitoring Berlin: Springer-Verlag.
The spatial cumulative distribution function (SCDF) is estimated by applying Equation 7.13 in de Gruijter et al., (2006) to indicator transformations of the data. See also page 83 of de Gruijter et al., (2006).
Objects can be created by calls of the form new("SpatialCumulativeDistributionFunction", ...)
.
description
:Object of class "character"
A description op the statistic.
Class "Statistic"
, directly.
signature(statistic = "SpatialCumulativeDistributionFunction", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates the spatial cumulative distribution function (SCDF), given a stratification, a sampling pattern and data.
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
de Gruijter, J. J., Brus, D. J., Bierkens, M. F. P., and Knotters, M. (2006) Sampling for Natural Resource Monitoring Berlin: Springer-Verlag.
The spatial mean is estimated by means of Equation 7.13 in de Gruijter et al., (2006).
Objects can be created by calls of the form new("SpatialMean", ...)
.
description
:Object of class "character"
A description op the statistic.
Class "Statistic"
, directly.
signature(statistic = "SpatialMean", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates the spatial mean, given a stratification, a sampling pattern and data.
signature(statistic = "SpatialMean", stratification = "CompactStratificationEqualArea", samplingPattern = "SamplingPatternRandomComposite", data = "data.frame")
: estimates the spatial mean, given a stratification, a sampling pattern and data.
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
de Gruijter, J. J., Brus, D. J., Bierkens, M. F. P., and Knotters, M. (2006) Sampling for Natural Resource Monitoring Berlin: Springer-Verlag.
The spatial variance is estimated by means of Equation 7.16 in de Gruijter et al., (2006).
Objects can be created by calls of the form new("SpatialVariance", ...)
.
description
:Object of class "character"
A description op the statistic.
Class "Statistic"
, directly.
signature(statistic = "SpatialVariance", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates the spatial variance, given a stratification, a sampling pattern and data.
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
de Gruijter, J. J., Brus, D. J., Bierkens, M. F. P., and Knotters, M. (2006) Sampling for Natural Resource Monitoring Berlin: Springer-Verlag.
Methods for sampling in compact strata.
samples the centroids of each stratum.
stratified simple random sampling with samples per stratum.
if type = "composite"
, stratified simple random sampling of composites.
spatial infill sampling
stratify
for stratification, spsample
for other types of spatial sampling, and estimate
for inference.
# 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) # sample two sampling units per stratum mySamplingPattern <- spsample(myStratification, n = 2) # plot the resulting sampling pattern on # top of the stratification plot(myStratification, mySamplingPattern) }
# 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) # sample two sampling units per stratum mySamplingPattern <- spsample(myStratification, n = 2) # plot the resulting sampling pattern on # top of the stratification plot(myStratification, mySamplingPattern) }
The standard error is estimated by means of the square root of Equation 7.14 in de Gruijter et al., (2006).
Objects can be created by calls of the form new("StandardError", ...)
.
description
:Object of class "character"
A description op the statistic.
Class "SamplingVariance"
, directly.
Class "Statistic"
, by class "SamplingVariance", distance 2.
signature(statistic = "StandardError", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame")
: estimates the standard error, given a stratification, a sampling pattern and data.
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
de Gruijter, J. J., Brus, D. J., Bierkens, M. F. P., and Knotters, M. (2006) Sampling for Natural Resource Monitoring Berlin: Springer-Verlag.
A superclass (ancestor class) for statistics to estimate.
A virtual Class: No objects may be created from it.
description
:A description op the statistic
signature(object = "Statistic")
: prints the statistic
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
Virtual class to store a spatial stratification.
A virtual Class: No objects may be created from it.
signature(object = "Stratification")
: a method for printing objects of class Stratification
Dennis J. J. Walvoort [email protected], D.J. Brus, J.J. de Gruijter
showClass("Stratification")
showClass("Stratification")
Methods for partitioning a spatial object into compact strata by means of -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
.
## 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"))
## 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"))
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 |
Stratify a raster representation of the study area.
Stratify a vector representation of the study area.
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.
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 -means. Computers & Geosciences 36: 1261-1267 (doi:10.1016/j.cageo.2010.04.005)
spsample
for sampling, and estimate
for inference.
# 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) }
# 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) }