Learn R Programming

sgsR (version 1.5.0)

calculate_sampsize: Sample size determination

Description

Determine a samples size for simple random sampling using relative standard error

Usage

calculate_sampsize(
  mraster,
  rse = NULL,
  start = 0.01,
  end = 0.05,
  increment = 0.001,
  plot = FALSE
)

Value

A data.frame of sample size and rse by raster variable.

Arguments

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 = 0.01.

end

Numeric. Final rse value to end rse sequence. default = 0.05.

increment

Numeric. Value to increment between start & end. default = 0.001.

plot

Logical. if TRUE output graphical representation of estimated sample size vs. rse.

Author

Tristan R.H. Goodbody

References

Benedetti, R., Piersimoni, F., & Postiglione, P. (2015). Sampling spatial units for agricultural surveys. pp 202-203. Berlin: Springer.

See Also

Other calculate functions: calculate_allocation(), calculate_allocation_existing(), calculate_coobs(), calculate_distance(), calculate_pcomp(), calculate_pop(), calculate_representation()

Examples

Run this code

#--- 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 ---#

Run the code above in your browser using DataLab