powered by
Computes weighted variance
weighted_var(x, w)wvar(x, w)
wvar(x, w)
Numeric scalar with the weighted variance.
A numeric vector of length \(n\).
weighted_variance implements weighted variance computation in the following form: $$% \frac{\sum_i w_i'(x_i - \bar x)^2}{(1-n)} $$
weighted_variance
where \(w_i'=w_i/\sum_i w_i\), and \(\bar x = \sum_i w_i'x_i\).
This function is used in diffmap.
diffmap