# varEst: Estimator of the approximated variance for balanced sampling In StratifiedSampling: Different Methods for Stratified Sampling

## Description

Estimator of the approximated variance for balanced sampling

## Usage

 `1` ```varEst(X, strata, pik, s, y) ```

## Arguments

 `X` A matrix of size (N x p) of auxiliary variables on which the sample must be balanced. `strata` A vector of integers that represents the categories. `pik` A vector of inclusion probabilities. `s` A sample (vector of 0 and 1, if rejected or selected). `y` A variable of interest.

## Details

This function gives an estimator of the approximated variance of the Horvitz-Thompson total estimator presented by Hasler C. and Tillé Y. (2014).

## Value

a scalar, the value of the estimated variance.

## Author(s)

Raphaël Jauslin raphael.jauslin@unine.ch

## References

Hasler, C. and Tillé, Y. (2014). Fast balanced sampling for highly stratified population. Computational Statistics and Data Analysis, 74:81-94.

`varApp`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17``` ```N <- 1000 n <- 400 x1 <- rgamma(N,4,25) x2 <- rgamma(N,4,25) strata <- as.matrix(rep(1:40,each = 25)) # 25 strata Xcat <- disjMatrix(strata) pik <- rep(n/N,N) X <- as.matrix(matrix(c(x1,x2),ncol = 2)) s <- stratifiedcube(X,strata,pik) y <- 20*strata + rnorm(1000,120) # variable of interest # y_ht <- sum(y[which(s==1)]/pik[which(s == 1)]) # Horvitz-Thompson estimator # (sum(y_ht) - sum(y))^2 # true variance varEst(X,strata,pik,s,y) varApp(X,strata,pik,y) ```