weighted.cov {factormodel} | R Documentation |
weighted.cov
Description
This function is to compute an unbiased sample weighted covariance. The function uses only pairwise complete observations.
Usage
weighted.cov(x, y, w = NULL)
Arguments
x |
An input vector to compute a covariance, cov(x,y) |
y |
An input vector to compute a covariance, cov(x,y) |
w |
A weight vector |
Value
Returns an unbiased sample weighted covariance
Author(s)
Yujung Hwang, yujungghwang@gmail.com
Examples
# If you do not specify weights,
# it returns the usual unweighted sample covariance
weighted.cov(x=c(1,3,5),y=c(2,3,1))
weighted.cov(x=c(1,3,5),y=c(2,3,1),w=c(0.1,0.5,0.4))
[Package factormodel version 1.0 Index]