Learn R Programming

laeken (version 0.5.3)

calibWeights: Calibrate sample weights

Description

Calibrate sample weights according to known marginal population totals. Based on initial sample weights, the so-called g-weights are computed by generalized raking procedures.

Usage

calibWeights(
  X,
  d,
  totals,
  q = NULL,
  method = c("raking", "linear", "logit"),
  bounds = c(0, 10),
  maxit = 500,
  tol = 1e-06,
  eps = .Machine$double.eps
)

Value

A numeric vector containing the g-weights.

Arguments

X

a matrix of binary calibration variables (see calibVars).

d

a numeric vector giving the initial sample weights.

totals

a numeric vector of population totals corresponding to the calibration variables in X.

q

a numeric vector of positive values accounting for heteroscedasticity. Small values reduce the variation of the g-weights.

method

a character string specifying the calibration method to be used. Possible values are "linear" for the linear method, "raking" for the multiplicative method known as raking and "logit" for the logit method.

bounds

a numeric vector of length two giving bounds for the g-weights to be used in the logit method. The first value gives the lower bound (which must be smaller than or equal to 1) and the second value gives the upper bound (which must be larger than or equal to 1).

maxit

a numeric value giving the maximum number of iterations.

tol

the desired accuracy for the iterative procedure.

eps

the desired accuracy for computing the Moore-Penrose generalized inverse (see ginv).

Author

Andreas Alfons

Details

The final sample weights need to be computed by multiplying the resulting g-weights with the initial sample weights.

References

Deville, J.-C. and Särndal, C.-E. (1992) Calibration estimators in survey sampling. Journal of the American Statistical Association, 87(418), 376--382.

Deville, J.-C., Särndal, C.-E. and Sautory, O. (1993) Generalized raking procedures in survey sampling. Journal of the American Statistical Association, 88(423), 1013--1020.

See Also

calibVars, bootVar

Examples

Run this code
data(eusilc)
# construct auxiliary 0/1 variables for genders
aux <- calibVars(eusilc$rb090)
# population totals
totals <- c(3990798, 4191431)
# compute g-weights
g <- calibWeights(aux, eusilc$rb050, totals)
# compute final weights
weights <- g * eusilc$rb050
summary(weights)

Run the code above in your browser using DataLab