observation | R Documentation |
Selection of the representative response observation for each stratification unit occurring across geographic space. One observation from a set of n observations of a response variable sampled/measured within the spatial boundaries of a given stratification unit is selected according to the following criteria: (1) maximum landscape similarity, (2) median response value, and (3) random selection. The maximum landscape similarity (mls) selects the observation at the XY spatial location where the landscape similarity value is maximized for a given stratification unit. The median response value (mrv) selects the observation whose response value is (closest to) the median of all response values, as measured from the observations spatially enclosed by a given stratification unit. The random selection, as implied by the name, randomly selects one observation from the set of observations spatially enclosed by a given stratification unit. See Details for some guidance in the use of this function for classification units.
observation(
su.rast,
obs,
col.id,
col.resp,
method = "mls",
ls.rast,
verbose = FALSE
)
su.rast |
SpatRaster, as in |
obs |
SpatVector, as in |
col.id |
Integer. Index of the ID column in the tabular attributes of obs. |
col.resp |
Integer. Index of the response' values column in the tabular attributes of obs. |
method |
Character. String specifying the selection method for the response representative observation. Options are "mls" for the maximum landscape similarity value, "mrv" for the median response value, and "random" for random selection. Default: "mls" |
ls.rast |
SpatRaster, as in |
verbose |
Boolean. Show warning messages in the console? Default: FALSE |
This selection scheme can be applied to classification units. For classification units, one should replace the multi-layer SpatRaster of landscape similarities with a multi-layer SpatRaster of spatial signatures. One should also replace the raster layer of stratification units with that of classification units.
A list with the following components:
su.repobs: Data table with the following attributes: (1) Original IDs of the selected observation, (2) representative response value, (3) stratification unit's numeric code, and (4) landscape similarity value at the XY location of the selected observation (only if method = "mls").
su.norepobs: List of the numeric codes of stratification units without observations.
su.repobs.sp: SpatVector of point geometry with the representative response observation for each stratification unit represented in su.rast.
strata
, similarity
Other Functions for Stratified Sampling:
locations()
require(terra)
p <- system.file("exdat", package = "rassta")
# Single-layer SpatRaster of stratification units
fsu <- list.files(path = p, pattern = "strata.tif", full.names = TRUE)
su <- terra::rast(fsu)
# Observations with response values.
## For this example, soil organic carbon (SOC) collected at 15 cm soil depth
fob <- list.files(path = p, pattern = "soc.shp", full.names = TRUE)
ob <- terra::vect(fob)
# Column indices for ID and measured response value
id <- 1
re <- 2
# Multi-layer SpatRaster of landscape similarities
fls <- list.files(path = p, pattern = "su_", full.names = TRUE)
ls <- terra::rast(fls)
# Selection of representative response observations for stratification units
ro <- observation(su.rast = su, obs = ob, col.id = id, col.resp = re,
ls.rast = ls
)
# Plot representative observations
if(interactive()){plot(su, type = "classes",
fun = function() points(ro$su_repobs.sp)
)}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.