Package: SamplingStrata 1.5-4

SamplingStrata: Optimal Stratification of Sampling Frames for Multipurpose Sampling Surveys

In the field of stratified sampling design, this package offers an approach for the determination of the best stratification of a sampling frame, the one that ensures the minimum sample cost under the condition to satisfy precision constraints in a multivariate and multidomain case. This approach is based on the use of the genetic algorithm: each solution (i.e. a particular partition in strata of the sampling frame) is considered as an individual in a population; the fitness of all individuals is evaluated applying the Bethel-Chromy algorithm to calculate the sampling size satisfying precision constraints on the target estimates. Functions in the package allows to: (a) analyse the obtained results of the optimisation step; (b) assign the new strata labels to the sampling frame; (c) select a sample from the new frame accordingly to the best allocation. Functions for the execution of the genetic algorithm are a modified version of the functions in the 'genalg' package.

Authors:Giulio Barcaroli, Marco Ballin, Hanjo Odendaal, Daniela Pagliuca, Egon Willighagen, Diego Zardetto

SamplingStrata_1.5-4.tar.gz
SamplingStrata_1.5-4.zip(r-4.5)SamplingStrata_1.5-4.zip(r-4.4)SamplingStrata_1.5-4.zip(r-4.3)
SamplingStrata_1.5-4.tgz(r-4.4-any)SamplingStrata_1.5-4.tgz(r-4.3-any)
SamplingStrata_1.5-4.tar.gz(r-4.5-noble)SamplingStrata_1.5-4.tar.gz(r-4.4-noble)
SamplingStrata_1.5-4.tgz(r-4.4-emscripten)SamplingStrata_1.5-4.tgz(r-4.3-emscripten)
SamplingStrata.pdf |SamplingStrata.html
SamplingStrata/json (API)
NEWS

# Install 'SamplingStrata' in R:
install.packages('SamplingStrata', repos = c('https://barcaroli.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/barcaroli/samplingstrata/issues

Datasets:
  • errors - Precision constraints (maximum CVs) as input for Bethel allocation
  • nations - Dataset 'nations'
  • strata - Dataframe containing information on strata in the frame
  • swisserrors - Precision constraints (maximum CVs) as input for Bethel allocation
  • swissframe - Dataframe containing information on all units in the population of reference that can be considered as the final sampling unit
  • swissmunicipalities - The Swiss municipalities population
  • swissstrata - Dataframe containing information on strata in the swiss municipalities frame

On CRAN:

5.38 score 14 stars 173 scripts 488 downloads 32 exports 11 dependencies

Last updated 6 months agofrom:b0b93ea02f. Checks:ERROR: 1 WARNING: 6. Indexed: yes.

TargetResultDate
Doc / VignettesFAILOct 27 2024
R-4.5-winWARNINGOct 27 2024
R-4.5-linuxWARNINGOct 27 2024
R-4.4-winWARNINGOct 27 2024
R-4.4-macWARNINGOct 27 2024
R-4.3-winWARNINGOct 27 2024
R-4.3-macWARNINGOct 27 2024

Exports:adjustSizeaggrStrata2aggrStrataSpatialassignStrataLabelbethelbuildFrameDFbuildFrameSpatialbuildStrataDFbuildStrataDFSpatialcheckInputcomputeGammaevalSolutionexpected_CVKmeansSolutionKmeansSolution2KmeansSolutionSpatialoptimizeStrataoptimizeStrata2optimizeStrataSpatialoptimStrataplotSamprateplotStrata2dprepareSuggestionprocBethelselectSampleselectSampleSpatialselectSampleSystematicsummaryStratatuneParametersupdateFrameupdateStratavar.bin

Dependencies:cachemcodetoolsdoParallelfastmapforeachglueiteratorsmemoisepbapplyrlangSamplingBigData

Readme and manuals

Help Manual

Help pageTopics
Adjustment of the sample size in case it is externally givenadjustSize
Builds the "strata" dataframe containing information on target variables Y's distributions in the different strata, starting from a frameaggrStrata2
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.aggrStrataSpatial
Function to assign the optimized strata labelsassignStrataLabel
Multivariate optimal allocationbethel
Builds the "sampling frame" dataframe from a dataset containing information on all the units in the population of referencebuildFrameDF
Builds the "sampling frame" dataframe from a dataset containing information all the units in the population of reference including spatialbuildFrameSpatial
Builds the "strata" dataframe containing information on target variables Y's distributions in the different strata, starting from sample data or from a framebuildStrataDF
Builds the "strata" dataframe containing information on target variables Y's distributions in the different strata, starting from sample data or from a framebuildStrataDFSpatial
Checks the inputs to the package: dataframes "errors", "strata" and "sampling frame"checkInput
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.computeGamma
Precision constraints (maximum CVs) as input for Bethel allocationerrors
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.evalSolution
Expected coefficients of variation of target variables Yexpected_CV
Initial solution obtained by applying kmeans clustering of atomic strataKmeansSolution
Initial solution obtained by applying kmeans clustering of frame unitsKmeansSolution2
Initial solution obtained by applying kmeans clustering of frame unitsKmeansSolutionSpatial
Dataset 'nations'nations
Best stratification of a sampling frame for multipurpose surveysoptimizeStrata
Best stratification of a sampling frame for multipurpose surveys (only with continuous stratification variables)optimizeStrata2
Best stratification of a sampling frame for multipurpose surveys considering also spatial correlationoptimizeStrataSpatial
Optimization of the stratification of a sampling frame given a sample surveyoptimStrata
Plotting sampling rates in the different strata for each domain in the solution.plotSamprate
Plot bivariate distibutions in strataplotStrata2d
Prepare suggestions for optimization with method = "continuous" or "spatial"prepareSuggestion
Procedure to apply Bethel algorithm and select a sample from given strataprocBethel
Selection of a stratified sample from the frame with srswor methodselectSample
Selection of geo-referenced points from the frameselectSampleSpatial
Selection of a stratified sample from the frame with systematic methodselectSampleSystematic
Dataframe containing information on strata in the framestrata
Information on strata structuresummaryStrata
Precision constraints (maximum CVs) as input for Bethel allocationswisserrors
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)swissframe
The Swiss municipalities populationswissmunicipalities
Dataframe containing information on strata in the swiss municipalities frameswissstrata
Execution and compared evaluation of optimization runstuneParameters
Updates the initial frame on the basis of the optimized stratificationupdateFrame
Assigns new labels to atomic strata on the basis of the optimized aggregated strataupdateStrata
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.var.bin