weighted_se {diagis}R Documentation

Weighted standard error

Description

Computes a weighted standard error of a vector or matrix.

Usage

weighted_se(x, w, na.rm)

Arguments

x

A numeric vector or matrix. For matrix, standard errors are computed for each column

w

A numeric vector of non-negative weights. Will be automatically normalised to sum to one.

na.rm

If TRUE, NA values in x (and corresponding weights in w) are omitted from the computation. Default is FALSE.

Value

A weighted variance.

Note

Compared to some other R functions, here the weights are regarded as probability weights, not frequency weights.


[Package diagis version 0.2.3 Index]