weighted_var: Computes weighted variance

View source: R/plot_diffnet2.r

weighted_varR Documentation

Computes weighted variance

Description

Computes weighted variance

Usage

weighted_var(x, w)

wvar(x, w)

Arguments

x

A numeric vector of length n.

w

A numeric vector of length n.

Details

weighted_variance implements weighted variance computation in the following form:

% \frac{\sum_i w_i'(x_i - \bar x)^2}{(1-n)}

where w_i'=w_i/\sum_i w_i, and \bar x = \sum_i w_i'x_i.

Value

Numeric scalar with the weighted variance.

See Also

This function is used in diffmap.


netdiffuseR documentation built on Aug. 30, 2023, 5:07 p.m.