Methods for estimating statistics given a spatial sample.

- statistic = "character", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame"
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.- statistic = "character", stratification = "CompactStratificationEqualArea", samplingPattern = "SamplingPatternRandomComposite", data = "data.frame"
estimates one of the following statistics, depending on the value of argument

`statistic`

:`spatial mean`

,`sampling variance`

, or`standard error`

.- statistic = "SamplingVariance", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame"
estimates the sampling variance. See

`"SamplingVariance"`

for more details.- statistic = "StandardError", stratification = "CompactStratificationEqualArea", samplingPattern = "SamplingPatternRandomComposite", data = "data.frame"
estimates the standard error of the spatial mean. See

`"StandardError"`

for more details.- statistic = "SpatialCumulativeDistributionFunction", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame"
estimates the spatial cumulative distribution function (SCDF). See

`"SamplingPatternRandomSamplingUnits"`

for more details.- statistic = "SpatialMean", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame"
estimates the spatial mean. See

`"SpatialMean"`

for more details.- statistic = "SpatialVariance", stratification = "CompactStratification", samplingPattern = "SamplingPatternRandomSamplingUnits", data = "data.frame"
estimates the spatial variance. See

`"SpatialVariance"`

for more details.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ```
# Note: the example below requires the 'rgdal'-package.
# You may consider the 'maptools'-package as an alternative
if (require(rgdal)) {
# read vector representation of the "Mijdrecht" area
shp <- readOGR(
dsn = system.file("maps", package = "spcosa"),
layer = "mijdrecht"
)
# 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"])
}
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.