Learn R Programming

pcaPP (version 2.0-5)

plotcov: Compare two Covariance Matrices in Plots

Description

allows a direct comparison of two estimations of the covariance matrix (e.g. resulting from covPC) in a plot.

Usage

plotcov(cov1, cov2, method1, labels1, method2, labels2, ndigits, ...)

Value

only the plot is generated

Arguments

cov1

a covariance matrix (from cov, covMcd, covPC, covPCAgrid, covPCAproj, etc.

cov2

a covariance matrix (from cov, covMcd, covPC, covPCAgrid, covPCAproj, etc.

method1

legend for ellipses of estimation method1

method2

legend for ellipses of estimation method2

labels1

legend for numbers of estimation method1

labels2

legend for numbers of estimation method2

ndigits

number of digits to use for printing covariances, by default ndigits=4

...

additional arguments for text or plot

Author

Heinrich Fritz, Peter Filzmoser <P.Filzmoser@tuwien.ac.at>

Details

Since (robust) PCA can be used to re-compute the (robust) covariance matrix, one might be interested to compare two different methods of covariance estimation visually. This routine takes as input objects for the covariances to compare the output of cov, but also the return objects from covPCAgrid, covPCAproj, covPC, and covMcd. The comparison of the two covariance matrices is done by numbers (the covariances) and by ellipses.

References

C. Croux, P. Filzmoser, M. Oliveira, (2007). Algorithms for Projection-Pursuit Robust Principal Component Analysis, Chemometrics and Intelligent Laboratory Systems, Vol. 87, pp. 218-225.

See Also

PCAgrid, PCAproj, princomp

Examples

Run this code
  # multivariate data with outliers
  library(mvtnorm)
  x <- rbind(rmvnorm(200, rep(0, 6), diag(c(5, rep(1,5)))),
             rmvnorm( 15, c(0, rep(20, 5)), diag(rep(1, 6))))
  plotcov(covPCAproj(x),covPCAgrid(x))

Run the code above in your browser using DataLab