pcaMethods (version 1.64.0)

DModX,pcaRes-method: DModX

Description

Distance to the model of X-space.

Usage

DModX(object, dat, newdata=FALSE, type=c("normalized","absolute"), ...)

Arguments

object
a pcaRes object
dat
the original data, taken from completeObs if left missing.
newdata
logical indicating if this data was part of the training data or not. If it was, it is adjusted by a near one factor $v=(N/ (N-A-A0))^-1$
type
if absolute or normalized values should be given. Normalized values are adjusted to the the total RSD of the model.
...
Not used

Value

A vector with distances from observations to the PCA model

Details

Measures how well described the observations are, i.e. how well they fit in the mode. High DModX indicate a poor fit. Defined as:

$\frac{\sqrt{\frac{SSE_i}{K-A}}}{\sqrt{\frac{SSE}{(N-A-A_0)(K-A)}}}$

For observation $i$, in a model with $A$ components, $K$ variables and $N$ obserations. SSE is the squared sum of the residuals. $A_0$ is 1 if model was centered and 0 otherwise. DModX is claimed to be approximately F-distributed and can therefore be used to check if an observation is significantly far away from the PCA model assuming normally distributed data.

Pass original data as an argument if the model was calculated with completeObs=FALSE.

References

Introduction to Multi- and Megavariate Data Analysis using Projection Methods (PCA and PLS), L. Eriksson, E. Johansson, N. Kettaneh-Wold and S. Wold, Umetrics 1999, p. 468

Examples

Run this code
data(iris)
pcIr <- pca(iris[,1:4])
with(iris, plot(DModX(pcIr)~Species))

Run the code above in your browser using DataLab