TITLE(var @@ Covariance Matrices)
USAGE(
var(x, y=x, na.rm=FALSE, pairwise=FALSE)
)
ALIAS(var)
ARGUMENTS(
ARG(x @@ a matrix or vector.)
ARG(y @@ a matrix or vector.)
ARG(pairwise @@ logical.)
ARG(na.rm @@ logical.)
)
DESCRIPTION(
LANG(var) computes the variance of LANG(x) and the
covariance of LANG(x) and LANG(y) if LANG(x) and LANG(y)
are vectors. If LANG(x) and LANG(y) are matrices then
the covariance between the columns of LANG(x) and the
the columns of LANG(y) are computed.
PARA
If LANG(na.rm) is LANG(TRUE) then missing values are
removed from the vectors before calculation.
If LANG(pairwise) is LANG(FALSE) (the default),
missing values in matrices are handled by casewise deletion.
If LANG(pairwise) is LANG(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(
var(1:10)
# 9.166667
BLANK
var(1:5,1:5)
# 2.5
)
