Learn R Programming

PracTools (version 1.6)

wtdvar: Compute weighted variance

Description

Compute an estimate of a population unit variance from a complex sample with survey weights.

Usage

wtdvar(x,w,na.rm=TRUE)

Value

numeric estimate of population unit variance

Arguments

x

data vector

w

vector of survey weights; must be same length as x

na.rm

remove missing values (TRUE or FALSE)

Author

Richard Valliant, Jill A. Dever, Frauke Kreuter

Details

wtdvar is also used by BW3stagePPSe in estimating relvariance components.

References

Valliant, R., Dever, J., Kreuter, F. (2018, chap. 9). Practical Tools for Designing and Weighting Survey Samples, 2nd edition. Springer.

Examples

Run this code
x <- c(1:3)
wts <- c(4, 6, 8)
wtdvar(x=x, w=wts)

Run the code above in your browser using DataLab