View source: R/calculate_sampsize.R
calculate_sampsize | R Documentation |
Determine a samples size for simple random sampling using relative standard error
calculate_sampsize(
mraster,
rse = NULL,
start = 0.01,
end = 0.05,
increment = 0.001,
plot = FALSE
)
mraster |
spatRaster. Metrics raster. All values must be numeric. |
rse |
Numeric. Desired relative standard error (coefficient of variation of the mean) threshold to determine sample size. |
start |
Numeric. First rse value to begin rse sequence. default = |
end |
Numeric. Final rse value to end rse sequence. default = |
increment |
Numeric. Value to increment between |
plot |
Logical. if |
A data.frame of sample size and rse by raster variable.
rse = (100 * SE) / mean)
Where:
SE
- Standard error of the mean
s
- Standard deviation of the observations
n
- Number of observations
Tristan R.H. Goodbody
Benedetti, R., Piersimoni, F., & Postiglione, P. (2015). Sampling spatial units for agricultural surveys. pp 202-203. Berlin: Springer.
Other calculate functions:
calculate_allocation()
,
calculate_allocation_existing()
,
calculate_coobs()
,
calculate_distance()
,
calculate_pcomp()
,
calculate_pop()
,
calculate_representation()
#--- Load raster ---#
r <- system.file("extdata", "mraster.tif", package = "sgsR")
mr <- terra::rast(r)
calculate_sampsize(
mraster = mr,
rse = 0.01
)
calculate_sampsize(
mraster = mr
)
calculate_sampsize(
mraster = mr,
rse = 0.025,
start = 0.01,
end = 0.08,
increment = 0.01
)
#--- higher variance leads to need for more samples ---#
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.