Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

covClassic

Classical Covariance Estimation


Description

Compute an estimate of the covariance/correlation matrix and location vector using classical methods.

Usage

covClassic(data, corr = FALSE, center = TRUE, distance = TRUE,
  na.action = na.fail, unbiased = TRUE)

Arguments

data

a numeric matrix or data frame containing the data.

corr

a logical flag. If corr = TRUE then the estimated correlation matrix is computed.

center

a logical flag or a numeric vector of length p (where p is the number of columns of x) specifying the center. If center = TRUE then the center is estimated. Otherwise the center is taken to be 0.

distance

a logical flag. If distance = TRUE the Mahalanobis distances are computed.

na.action

a function to filter missing data. The default na.fail produces an error if missing values are present. An alternative is na.omit which deletes observations that contain one or more missing values.

unbiased

a logical flag. If TRUE the unbiased estimator is returned (computed with denominator equal to n-1), else the MLE (computed with denominator equal to n) is returned.

Details

Its main intention is to return an object compatible to that produced by covRob, but fit using classical methods.

Value

a list with class “covClassic” containing the following elements:

call

an image of the call that produced the object with all the arguments named.

cov

a numeric matrix containing the estimate of the covariance/correlation matrix.

center

a numeric vector containing the estimate of the location vector.

dist

a numeric vector containing the squared Mahalanobis distances. Only present if distance = TRUE in the call.

corr

a logical flag. If corr = TRUE then cov contains an estimate of the correlation matrix of x.

Note

Originally, and in S-PLUS, this function was called cov; it has been renamed, as that did mask the function in the standard package stats.

Examples

data(wine)
round( covClassic(wine)$cov, 2)

RobStatTM

Robust Statistics: Theory and Methods

v1.0.2
GPL (>= 3)
Authors
Matias Salibian-Barrera [cre], Victor Yohai [aut], Ricardo Maronna [aut], Doug Martin [aut], Gregory Brownson [aut] (ShinyUI), Kjell Konis [aut], Kjell Konis [cph] (erfi), Christophe Croux [ctb] (WBYlogreg, BYlogreg), Gentiane Haesbroeck [ctb] (WBYlogreg, BYlogreg), Martin Maechler [cph] (lmrob.fit, lmrob..M..fit, lmrob.S), Manuel Koller [cph] (lmrob.fit, .vcov.avar1, lmrob.S, lmrob.lar), Matias Salibian-Barrera [aut]
Initial release
2020-03-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.