weighted.cov {descriptio} | R Documentation |
Weighted covariance
Description
Computes the weighted covariance between two distributions.
Usage
weighted.cov(x, y, weights = NULL, na.rm = FALSE)
Arguments
x |
numeric vector |
y |
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. |
Value
a length-one numeric vector
Author(s)
Nicolas Robette
See Also
weighted.sd
, weighted.cor
, weighted.cov2
Examples
data(Movies)
weighted.cov(Movies$Critics, Movies$BoxOffice, weights = rep(c(.8,1.2), 500))
[Package descriptio version 1.3 Index]