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

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", ...)

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

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.

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)

Author(s)

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

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

Examples

# 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)

pcaPP

Robust PCA by Projection Pursuit

v1.9-74
GPL (>= 3)
Authors
Peter Filzmoser, Heinrich Fritz, Klaudius Kalcher
Initial release
2021-04-22

We don't support your browser anymore

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