Skip to contents

Internal functions for secondary sampling. Should not be directly; designed for use in wt_strata.

Usage

ssu_fixed(weights, ssu, schema, reuse_weights = TRUE, ...)

ssu_fuzzy(weights, ssu, schema, reuse_weights = TRUE, ...)

ssu_ideal(weights, ssu, schema, ...)

ssu_relative(weights, ssu, schema, reuse_weights = TRUE, ...)

Arguments

weights

A weights raster according to wt_strata cropped to the geometry of a primary sampling unit.

ssu

Character vector or factor representing the secondary sampling unit (SSU) according to wt_strata of a single primary sampling unit.

schema

An SSU schema created by ssu_schema. See wt_strata.

reuse_weights

If TRUE and ssu is provided, uses the weights dataset defined in the weights argument both for generating SSUs and as a weights raster for wt_sample. This would result in a double weighting where locations can only be sampled in certain regions of weights and within these regions have a certain probability to be sampled in a specific part of the region. If FALSE, performs random sampling after SSU assignment. Defaults to TRUE to reduce randomness. Ignored if ssu is not provided.

Set to FALSE if performance is at a premium or if this behavior is not desired. For example, in high-value regions of a population raster, the probability of people living in regions with lower population densities is still very high and might not be properly represented by weighted sampling. Generally, if the assignment of sampling zones using schema is already detailed and leaves little space within each zone, reusing weights can be superfluous.

Only relevant if the schema is threshold-based, i.e., the argument is silently ignored if the schema is of type ideal.

...

Further arguments passed to wt_sample.

Value

The new sampled points for group.

Examples

# the use of secondary sampling functions is declared by defining schemas
ssu_schema(class1 = c(0, 10), class2 = c(10, 20), type = "fixed")
#> SSU schema using fixed thresholds
#> Points are only sampled within these thresholds.
#> 
#> class1 = [0, 10)
#> class2 = [10, 20]