Learn R Programming

SamplingStrata (version 1.5-5)

Optimal Stratification of Sampling Frames for Multipurpose Sampling Surveys

Description

Tools for the optimization of stratified sampling design. It determines a stratification of a sampling frame that minimizes sample cost while satisfying precision constraints in a multivariate and multidomain context. The approach relies on a genetic algorithm; each candidate partition of the frame is an individual whose fitness is evaluated via the Bethel-Chromy allocation to meet target precisions. Functions support analysis of optimization results, labeling of the frame with new strata, and drawing a sample according to the optimal allocation. Algorithmic components adapt code from the 'genalg' package. See M. Ballin and G. Barcaroli (2020) "R package SamplingStrata: new developments and extension to Spatial Sampling" .

Copy Link

Version

Install

install.packages('SamplingStrata')

Monthly Downloads

1,367

Version

1.5-5

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Giulio Barcaroli

Last Published

October 8th, 2025

Functions in SamplingStrata (1.5-5)

checkInput

Checks the inputs to the package: dataframes "errors", "strata" and "sampling frame"
nations

Dataset 'nations'
optimStrata

Optimization of the stratification of a sampling frame given a sample survey
computeGamma

Function that allows to calculate a heteroscedasticity index, together with associate prediction variance, to be used by the optimization step to correctly evaluate the standard deviation in the strata due to prediction errors.
errors

Precision constraints (maximum CVs) as input for Bethel allocation
optimizeStrata

Best stratification of a sampling frame for multipurpose surveys
buildStrataDFSpatial

Builds the "strata" dataframe containing information on target variables Y's distributions in the different strata, starting from sample data or from a frame
selectSampleSystematic

Selection of a stratified sample from the frame with systematic method
selectSample

Selection of a stratified sample from the frame with srswor method
plotSamprate

Plotting sampling rates in the different strata for each domain in the solution.
strata

Dataframe containing information on strata in the frame
prepareSuggestion

Prepare suggestions for optimization with method = "continuous" or "spatial"
selectSampleSpatial

Selection of geo-referenced points from the frame
procBethel

Procedure to apply Bethel algorithm and select a sample from given strata
summaryStrata

Information on strata structure
swisserrors

Precision constraints (maximum CVs) as input for Bethel allocation
swissstrata

Dataframe containing information on strata in the swiss municipalities frame
updateFrame

Updates the initial frame on the basis of the optimized stratification
tuneParameters

Execution and compared evaluation of optimization runs
plotStrata2d

Plot bivariate distibutions in strata
updateStrata

Assigns new labels to atomic strata on the basis of the optimized aggregated strata
optimizeStrata2

Best stratification of a sampling frame for multipurpose surveys (only with continuous stratification variables)
var.bin

Allows to transform a continuous variable into a categorical ordinal one by applying a modified version of the k-means clustering function in the 'stats' package.
swissframe

Dataframe containing information on all units in the population of reference that can be considered as the final sampling unit (this example is related to Swiss municipalities)
swissmunicipalities

The Swiss municipalities population
optimizeStrataSpatial

Best stratification of a sampling frame for multipurpose surveys considering also spatial correlation
aggrStrataSpatial

Builds the "strata" dataframe containing information on target variables Y's distributions in the different strata, starting from a frame where units are spatially correlated.
aggrStrata2

Builds the "strata" dataframe containing information on target variables Y's distributions in the different strata, starting from a frame
bethel

Multivariate optimal allocation
KmeansSolution

Initial solution obtained by applying kmeans clustering of atomic strata
adjustSize

Adjustment of the sample size in case it is externally given
buildFrameSpatial

Builds the "sampling frame" dataframe from a dataset containing information all the units in the population of reference including spatial
buildFrameDF

Builds the "sampling frame" dataframe from a dataset containing information on all the units in the population of reference
KmeansSolution2

Initial solution obtained by applying kmeans clustering of frame units
expected_CV

Expected coefficients of variation of target variables Y
evalSolution

Evaluation of the solution produced by the function 'optimizeStrata' by selecting a number of samples from the frame with the optimal stratification, and calculating average CV's on the target variables Y's.
assignStrataLabel

Function to assign the optimized strata labels
buildStrataDF

Builds the "strata" dataframe containing information on target variables Y's distributions in the different strata, starting from sample data or from a frame
KmeansSolutionSpatial

Initial solution obtained by applying kmeans clustering of frame units