calculate_allocation {sgsR} | R Documentation |
Sample allocation type and count
Description
Determine how many samples to allocate within strata.
Usage
calculate_allocation(
sraster,
nSamp,
allocation = "prop",
weights = NULL,
mraster = NULL,
existing = NULL,
force = FALSE
)
Arguments
sraster |
spatRaster. Stratification raster to be used for sampling. |
nSamp |
Numeric. Number of desired samples. |
allocation |
Character. Allocation algorithm to be used. Either |
weights |
Numeric. Only applicable when |
mraster |
spatRaster. ALS metric raster. Required when |
existing |
sf 'POINT' or data.frame. Existing plot network. |
force |
Logical. |
Value
Returns a data.frame of:
strata - Strata ID.
total - Number of samples to be allocated. Values correspond to under representation (samples needed; positive value) or over representation (too many samples; negative value) based on the
nSamp
provided.need - Required samples per strata based on allocation method. Rounded.
Author(s)
Tristan R.H. Goodbody
References
Gregoire, T.G., & Valentine, H.T. (2007). Sampling Strategies for Natural Resources and the Environment (1st ed.). Chapman and Hall/CRC. https://doi.org/10.1201/9780203498880
See Also
Other calculate functions:
calculate_allocation_existing()
,
calculate_coobs()
,
calculate_distance()
,
calculate_pcomp()
,
calculate_pop()
,
calculate_representation()
,
calculate_sampsize()
Examples
## Not run:
#--- Load strata raster and existing samples---#
r <- system.file("extdata", "sraster.tif", package = "sgsR")
sr <- terra::rast(r)
e <- system.file("extdata", "existing.shp", package = "sgsR")
e <- sf::st_read(e)
#--- proportional allocation ---#
calculate_allocation(
sraster = sr,
nSamp = 10,
allocation = "prop"
)
## End(Not run)