DModX,pcaRes-method {pcaMethods} | R Documentation

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

### 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{√{\frac{SSE_i}{K-A}}}{√{\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`.

### Value

A vector with distances from observations to the PCA model

### Author(s)

Henning Redestig

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

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

[Package pcaMethods version 1.78.0 Index]