View source: R/calculate_representation.R
calculate_representation | R Documentation |
Compare sample representation within sraster strata
calculate_representation(sraster, existing, drop = NULL, plot = FALSE)
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 |
Calculate how sraster strata are represented in existing samples
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 consider diffFreq
. A small difference - e.g. 1
in sampleFreq
vs. srasterFreq
frequency could make the algorithm allocate or remove samples that could likely be ignored.
Tristan R.H. Goodbody, Martin Queinnec
Other calculate functions:
calculate_allocation()
,
calculate_allocation_existing()
,
calculate_coobs()
,
calculate_distance()
,
calculate_pcomp()
,
calculate_pop()
,
calculate_sampsize()
### --- 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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.