Learn R Programming

descriptio (version 1.3)

weighted.sd: Weighted standard deviation

Description

Computes the weighted standard deviation of a distribution.

Usage

weighted.sd(x, weights = NULL, na.rm = FALSE)

Value

a length-one numeric vector

Arguments

x

numeric vector

weights

numeric vector of weights. If NULL (default), uniform weights (i.e. all equal to 1) are used.

na.rm

logical, indicating whether NA values should be silently removed before the computation proceeds. Default is FALSE.

Author

Nicolas Robette

See Also

weighted.cor

Examples

Run this code
data(Movies)
weighted.sd(Movies$Critics, weights = rep(c(.8,1.2), 500))

Run the code above in your browser using DataLab