Learn R Programming

SciencesPo (version 1.3.9)

wtd.var: Weighted Variance

Description

Weighted Variance Formula

Usage

wtd.var(x, w, na.rm = FALSE)

Arguments

x
the variable.
w
the variance.
na.rm
A logical if NA should be disregarded.

Examples

Run this code
wt=c(1.23, 2.12, 1.23, 0.32, 1.53, 0.59, 0.94, 0.94, 0.84, 0.73)
x = c(5, 5, 4, 4, 3, 4, 3, 2, 2, 1)
wtd.var(x, wt)

Run the code above in your browser using DataLab