TITLE(var @@ Covariance Matrices)
USAGE(
var(x, y=x, na.rm=FALSE, use)
)
ALIAS(var)
ARGUMENTS(
ARG(x @@ a matrix or vector.)
ARG(y @@ a matrix or vector.)
ARG(na.rm @@ logical.)
ARG(use @@ an optional character string giving a
method for computing covariances in the presence
of missing values.  This must be one of LANG("all.obs"),
LANG("complete.obs") or LANG("pairwise.complete.obs"),
with abbreviation being permited.)
)
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 the complete observations (rows)
are use to compute the variance.  If LANG(na.rm) is LANG(FALSE)
and there are missing values, then LANG(var) will fail.
PARA
The argument LANG(use) can also be used for describing how
to handle missing values.
Specifying LANG(use="all") is equivalent to specifying
LANG(na.rm=FALSE) and specifying LANG(use="pair") is equivalent to
LANG(na.rm=TRUE).
If LANG(use="pair"), then all the observations 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
)
