gustave

Provides a toolkit for analytical variance estimation in survey sampling. Apart from the implementation of standard variance estimators, its main feature is to help the sampling expert produce easy-to-use variance estimation "wrappers", where systematic operations (linearization, domain estimation) are handled in a consistent and transparent way.

Gustave (Gustave: a User-oriented Statistical Toolkit for Analytical Variance Estimation) is an R package that provides a toolkit for analytical variance estimation in survey sampling.

Apart from the implementation of standard variance estimators (Sen-Yates-Grundy, Deville-Tillé), its main feature is to help he methodologist produce easy-to-use variance estimation wrappers, where systematic operations (statistic linearization, domain estimation) are handled in a consistent and transparent way.

The ready-to-use variance estimation wrapper qvar(), adapted for common cases (e.g. stratified simple random sampling, non-response correction through reweighting in homogeneous response groups, calibration), is also included. The core functions of the package (e.g. define_variance_wrapper()) are to be used for more complex cases.

gustave is available on CRAN and can therefore be installed with the install.packages() function:

install.packages("gustave")

However, if you wish to install the latest version of gustave, you can use devtools::install_github() to install it directly from the github.com repository:

Example

In this example, we aim at estimating the variance of estimators computed using simulated data inspired from the Information and communication technology (ICT) survey. This survey has the following characteristics:

stratified one-stage sampling design;

non-response correction through reweighting in homogeneous response groups based on economic sub-sector and turnover;

calibration on margins (number of firms and turnover broken down by economic sub-sector).

The survey methodology description is however cumbersome when several variance estimations are to be conducted. As it does not change from one estimation to another, it could be defined once and for all and then re-used for all variance estimations. qvar() allows for this by defining a so-called variance wrapper, that is an easy-to-use function where the variance estimation methodology for the given survey is implemented and all the technical data used to do so included.

Colophon

From the methodological point of view, this package is related to the Poulpe SAS macro (in French) developed at the French statistical institute. From the implementation point of view, some inspiration was found in the ggplot2 package. The idea of developing an R package on this specific topic was stimulated by the icarus package and its author.

News

0.4.0

Breaking: Heavy remanufacturing of define_variance_wrapper

New: technical_data argument offers a more consistent way to include technical data within the enclosing environment of the wrapper. objects_to_include is kept for non-data objects (such as additional statistic wrappers) or advanced customization.

New: technical_param argument offers a more convenient way to specify default values for parameters used by the variance function.

New: reference_weight replaces default$weight. This means that the reference weight used for point estimation and linearization is set while defining the variance wrapper and not at run-time.

Deprecated: stat, which was a remain of an early implementation of linearization functions, is not a parameter of the variance wrappers anymore. Its purpose (to apply a given variance wrapper to several variables without having to type the name of the linearization wrapper) is now covered by the standard evaluation capabilities of statistic wrappers (see below).

Deprecated: default is replaced by default_id, as default$weight and default$stat are no longer needed. As for default$alpha, its value is set to 0.05 and cannot be changed anymore while defining the variance wrapper (as this can easily be done afterwards using formals<-).

Deprecated: objects_to_include_from

Breaking: Rebranding and heavy remanufacturing of define_statistic_wrapper (previously known as define_linearization_wrapper), added support for standard evaluation (see define_variance_wrapper examples).

New: the qvar function allows for a straigthforward variance estimation in common cases (stratified simple random sampling with non-response through reweighting and calibration) and performs both technical and methodological checks.