Learn R Programming

pcaPP (version 2.0-5)

PCdiagplot: Diagnostic plot for principal components

Description

Computes Orthogonal Distances (OD) and Score Distances (SD) for already computed principal components using the projection pursuit technique.

Usage

PCdiagplot(x, PCobj, crit = c(0.975, 0.99, 0.999), ksel = NULL, plot = TRUE,
           plotbw = TRUE, raw = FALSE, colgrid = "black", ...)

Value

ODist

matrix with OD for each observation (rows) and each selected PC (cols)

SDist

matrix with SD for each observation (rows) and each selected PC (cols)

critOD

matrix with critical values for OD for each selected PC (rows) and each critical value (cols)

critSD

matrix with critical values for SD for each selected PC (rows) and each critical value (cols)

Arguments

x

a numeric matrix or data frame which provides the data for the principal components analysis.

PCobj

a PCA object resulting from PCAproj or PCAgrid

crit

quantile(s) used for the critical value(s) for OD and SD

ksel

range for the number of PCs to be used in the plot; if NULL all PCs provided are used

plot

if TRUE a plot is generated, otherwise only the values are returned

plotbw

if TRUE the plot uses gray, otherwise color representation

raw

if FALSE, the distribution of the SD will be transformed to approach chisquare distribution, otherwise the raw values are reported and used for plotting

colgrid

the color used for the grid lines in the plot

...

additional graphics parameters as used in par

Author

Peter Filzmoser <P.Filzmoser@tuwien.ac.at>

Details

Based on (robust) principal components, a diagnostics plot is made using Orthogonal Distance (OD) and Score Distance (SD). This plot can provide important information about the multivariate data structure.

References

P. Filzmoser and H. Fritz (2007). Exploring high-dimensional data with robust principal components. In S. Aivazian, P. Filzmoser, and Yu. Kharin, editors, Proceedings of the Eighth International Conference on Computer Data Analysis and Modeling, volume 1, pp. 43-50, Belarusian State University, Minsk.

M. Hubert, P.J. Rousseeuwm, K. Vanden Branden (2005). ROBCA: a new approach to robust principal component analysis Technometrics 47, pp. 64-79.

See Also

PCAproj, PCAgrid

Examples

Run this code
  # multivariate data with outliers
  library(mvtnorm)
  x <- rbind(rmvnorm(85, rep(0, 6), diag(c(5, rep(1,5)))),
             rmvnorm( 15, c(0, rep(20, 5)), diag(rep(1, 6))))
  # Here we calculate the principal components with PCAgrid
  pcrob <- PCAgrid(x, k=6)
  resrob <- PCdiagplot(x,pcrob,plotbw=FALSE)

  # compare with classical method:
  pcclass <- PCAgrid(x, k=6, method="sd")
  resclass <- PCdiagplot(x,pcclass,plotbw=FALSE)

Run the code above in your browser using DataLab