estimate-methods: Estimating Statistics

estimate-methodsR Documentation

Estimating Statistics

Description

Methods for estimating statistics given a spatial sample.

Methods

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.

Examples


# 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"])
}

spcosa documentation built on April 11, 2023, 6:04 p.m.