powered by
This functions works quite equally as the wtd.var function from the Hmisc package.
wtd.var
Hmisc
wtdVar(x , weights , na.rm = FALSE)
a scalar
numeric vector
a numeric vector of non-negative weights
set to FALSE to suppress checking for NAs. If TRUE, NAs are removed from x as well as from weights prior to variance estimation.
FALSE
TRUE
x
weights
Benjamin Becker
x <- c(50, 1, 25) w <- c(1, 4, 1) wtdVar(x, w)
Run the code above in your browser using DataLab