Weighted Covariance Estimation

DESCRIPTION:
Returns a list containing estimates of the covariance matrix and of the mean vector for the data, and optionally of the correlation matrix.

USAGE:
cov.wt(x, wt=rep(1, nrow(x)), cor=F, center=T)

REQUIRED ARGUMENTS:
x:
matrix of data. Rows represent observations and columns represent variables. Missing values are not accepted.

OPTIONAL ARGUMENTS:
wt:
vector of weights for each observation. This must have the same length as the number of rows in x, and missing values are not accepted.
cor:
logical flag: if TRUE, then the estimated correlation matrix will be returned as a component of the answer.
center:
a logical value or a numeric vector providing the center about which the covariance is to be taken. If center is TRUE, then the mean of each column is used. If center is FALSE, then zero is used for each variable. When center is numeric, then its length must equal the number of columns in x.

VALUE:
a list with the following components:
cov:
the estimated covariance matrix.
center:
an estimate for the center (mean) of the data.
wt:
the weights that were used in the computation. This is only returned if the wt argument was given.
n.obs:
the number of observations (rows) in x.
cor:
the estimated correlation matrix for the data. This is only returned if the input cor is TRUE.

SEE ALSO:
cov.mve , var , mahalanobis .

EXAMPLES:
cov.wt(freeny.x) # unweighted estimate
cov.wt(freeny.x, center=F) # take covariance about zero