Description Usage Arguments Value Author(s) Examples
This function is to compute an unbiased sample weighted covariance. The function uses only pairwise complete observations.
1 | weighted.cov(x, y, w = NULL)
|
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 |
Returns an unbiased sample weighted covariance
Yujung Hwang, yujungghwang@gmail.com
1 2 3 4 5 | # 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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.