DModX(object, dat, newdata=FALSE, type=c("normalized","absolute"), ...)
completeObs
if
left missing.$\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
.
data(iris)
pcIr <- pca(iris[,1:4])
with(iris, plot(DModX(pcIr)~Species))
Run the code above in your browser using DataLab