cov(x, y=x, pairwise=false)
x
| a matrix. |
y
| a matrix. |
pairwise
| logical. |
cov computes the covariance between the columns
of x and the columns of y.
If pairwise is false (the default),
missing values are handled by casewise deletion.
If pairwise is true, all cases which are
complete for a pair of variables is used to compute the
covariance for that pair of variables.
This can result in covariance matrices which are not
positive semidefinite.
Examples
> cov(1:5,1:5)
[1] 2.5