# standard_statistic_wrapper: Standard statistic wrappers In gustave: A User-Oriented Statistical Toolkit for Analytical Variance Estimation

 standard_statistic_wrapper R Documentation

## Standard statistic wrappers

### Description

Functions to be used within variance estimation wrappers in order to specify which statistic is to be estimated.

### Usage

```total(y, by = NULL, where = NULL)

ratio(num, denom, by = NULL, where = NULL)

mean(y, by = NULL, where = NULL)

diff_of_ratio(num1, denom1, num2, denom2, by = NULL, where = NULL)

ratio_of_ratio(num1, denom1, num2, denom2, by = NULL, where = NULL)
```

### Arguments

 `y` A vector corresponding to the variable to calculate the statitic on. If not numeric (character or factor), it is automatically discretized. `by` Factor vector (character vectors are coerced to factors) whose levels are used to break down the estimation by domains. `where` Logical vector indicating the domain to perform variance estimation on. `num, num1, num2` Numerical vector(s) corresponding to the numerator(s) to be used in the estimation. `denom, denom1, denom2` Numerical vector(s) corresponding to the denominator(s) to be used in the estimation.

### Details

When the estimator is not the estimator of a total, the application of analytical variance estimation formulae developed for the estimator of a total is not straightforward (Deville, 1999). An asymptotically unbiased variance estimator can nonetheless be obtained if the estimation of variance is performed on a variable obtained from the original data through a linerization step.

The `ratio`, `mean`, `diff_of_ratio` and `ratio_of_ratio` functions produce the point estimate of the statistic and derive the corresponding linearized variable which is later on passed on to the variance estimation function within the variance estimation wrapper.

Note: The `total` function does not perform any linearization (as none is needed for the estimator of a total) and solely produces the corresponding point estimator.

Martin Chevalier

### References

Caron N. (1998), "Le logiciel Poulpe : aspects méthodologiques", Actes des Journées de méthodologie statistique http://jms-insee.fr/jms1998s03_1/

Deville J.-C. (1999), "Variance estimation for complex statistics and estimators: linearization and residual techniques", Survey Methodology, 25:193–203

`define_statistic_wrapper`, `define_variance_wrapper`
```# See qvar examples