
Compare sample representation within sraster strata
Source:R/calculate_representation.R
calculate_representation.RdCompare sample representation within sraster strata
Arguments
- sraster
spatRaster. Stratification raster.
- existing
sf 'POINT'. Existing plot network.
- drop
Numeric. Numeric value between 0-1 representing the
srasterfrequency (srasterFreq) below which strata will be dropped from comparison (e.g.. This parameter can be useful for when comparing stratum where percent coverage of strata may be ~ 0 percent and should be dropped. This could occur when mapping multiple stratifications.- plot
Logical. Plot frequency of strata coverage and sampling coverage for
srasterandexisting. Will return a list ifTRUE.
Value
Returns a tibble where:
strata -
srasterstrata ID.srasterFreq -
srastercoverage frequency.sampleFreq - Sampling frequency within
srasterstrata.diffFreq - Difference between
srasterFreq&sampleFreq. Positive values indicate over representation.nSamp - Number of samples within each strata in
existing.need -
srasterFreq * sum(nSamp). Total theoretical number of required samples to be representative of strata coverage. This values is rounded. It is important for the user to considerdiffFreq. A small difference - e.g. 1 insampleFreqvs.srasterFreqfrequency could make the algorithm allocate or remove samples that could likely be ignored.
See also
Other calculate functions:
calculate_allocation(),
calculate_allocation_existing(),
calculate_coobs(),
calculate_distance(),
calculate_pcomp(),
calculate_pop(),
calculate_sampsize()
Examples
### --- generate example stratification ---###
#--- load ALS metrics from sgsR internal data ---#
r <- system.file("extdata", "mraster.tif", package = "sgsR")
#--- read ALS metrics using the terra package ---#
mraster <- terra::rast(r)
#--- perform stratification ---#
sraster <- strat_kmeans(
mraster = mraster$zq90,
nStrata = 6
)
#> K-means being performed on 1 layers with 6 centers.
### --- create existing sample network ---###
#--- simple random sampling ---#
existing <- sample_srs(
raster = mraster$zq90,
nSamp = 100
)
#--- calculate representation ---#
calculate_representation(
sraster = sraster,
existing = existing
)
#> # A tibble: 6 × 6
#> strata srasterFreq sampleFreq diffFreq nSamp need
#> <int> <dbl> <dbl> <dbl> <int> <dbl>
#> 1 1 0.24 0.32 0.08 32 -8
#> 2 2 0.09 0.06 -0.03 6 3
#> 3 3 0.09 0.15 0.06 15 -6
#> 4 4 0.27 0.23 -0.04 23 4
#> 5 5 0.12 0.11 -0.0100 11 1
#> 6 6 0.18 0.13 -0.05 13 5