Compute an estimate of the covariance/correlation matrix and location vector using classical methods.
covClassic(data, corr = FALSE, center = TRUE, distance = TRUE,
na.action = na.fail, unbiased = TRUE)
a numeric matrix or data frame containing the data.
a logical flag. If corr = TRUE
then the estimated correlation matrix is computed.
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.
a logical flag. If distance = TRUE
the Mahalanobis distances are computed.
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.
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.
a list with class “covClassic” containing the following elements:
an image of the call that produced the object with all the arguments named.
a numeric matrix containing the estimate of the covariance/correlation matrix.
a numeric vector containing the estimate of the location vector.
a numeric vector containing the squared Mahalanobis distances. Only present if distance = TRUE
in the call
.
a logical flag. If corr = TRUE
then cov
contains an estimate of the correlation matrix of x
.
Its main intention is to return an object compatible to that
produced by covRob
, but fit using classical methods.
# NOT RUN {
data(wine)
round( covClassic(wine)$cov, 2)
# }
Run the code above in your browser using DataLab