calculate_representation {sgsR} | R Documentation |
Compare sample representation within sraster strata
Description
Compare sample representation within sraster strata
Usage
calculate_representation(sraster, existing, drop = NULL, plot = FALSE)
Arguments
sraster |
spatRaster. Stratification raster. |
existing |
sf 'POINT'. Existing plot network. |
drop |
Numeric. Numeric value between 0-1 representing the |
plot |
Logical. Plot frequency of strata coverage and sampling coverage
for |
Details
Calculate how sraster strata are represented in existing samples
Value
Returns a tibble where:
strata -
sraster
strata ID.srasterFreq -
sraster
coverage frequency.sampleFreq - Sampling frequency within
sraster
strata.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 insampleFreq
vs.srasterFreq
frequency could make the algorithm allocate or remove samples that could likely be ignored.
Author(s)
Tristan R.H. Goodbody, Martin Queinnec
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
)
### --- create existing sample network ---###
#--- simple random sampling ---#
existing <- sample_srs(
raster = mraster$zq90,
nSamp = 100
)
#--- calculate representation ---#
calculate_representation(
sraster = sraster,
existing = existing
)