wtdVar: Computed weighted variance

Description Usage Arguments Value Author(s) Examples

Description

This functions works quite equally as the wtd.var function from the Hmisc package.

Usage

1
wtdVar(x , weights , na.rm = FALSE)

Arguments

x

numeric vector

weights

a numeric vector of non-negative weights

na.rm

set to FALSE to suppress checking for NAs. If TRUE, NAs are removed from x as well as from weights prior to variance estimation.

Value

a scalar

Author(s)

Benjamin Becker

Examples

1
2
3
x <- c(50, 1, 25)
w <- c(1, 4, 1)
wtdVar(x, w)

eatTools documentation built on Nov. 10, 2021, 5:07 p.m.