Learn R Programming

pcaPP (version 2.0-5)

covPC: Covariance Matrix Estimation from princomp Object

Description

computes the covariance matrix from a princomp object. The number of components k can be given as input.

Usage

covPC(x, k, method)

Value

cov

the estimated covariance matrix

center

the center of the data, as provided from the princomp object.

method

a string describing the method that was used to calculate the PCs.

Arguments

x

an object of class princomp.

k

number of PCs to use for covariance estimation (optional).

method

method how the PCs have been estimated (optional).

Author

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

Details

There are several possibilities to estimate the principal components (PCs) from an input data matrix, including the functions PCAproj and PCAgrid. This function uses the estimated PCs to reconstruct the covariance matrix. Not all PCs have to be used, the number k of PCs (first k PCs) can be given as input to the function.

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))))
  pc <- princomp(x)
  covPC(pc, k=2)

Run the code above in your browser using DataLab