Multivariate outlier detection for PLS model

I am working with a PLS model (library pls) in R, where I am developing calibration models for NIRS data. I have been using other commercial software before that allowed me to detect outliers based on Mahalanobis distances.

However, although R has proven to be superior in all senses to any software I have used before, I cannot find a good way of detecting potential outliers in a new dataset to be predicted. my model follows the structure:

model<-plsr(as.matrix(dataset)~constituent, CV=TRUE, ncomp=15)


And then I predict:

predictions<-predict(model, newdata=NEWDATA,ncomp=15)


But how can I assess the fitness of the predictions?

When I try to apply the "mahalanobis" command from {stats}, I do the following:

mahalanobis.data<-mahalanobis(new-dataset,colMeans(dataset),var(dataset))


And either R crashes, or gives error messages. I have tried also with some of the rrcovHD and mvoutlier commands, but I suddenly get half of my dataset detected as outlier.

Since I have n< p, conventional multivariate outlier detection does not apply here, as far as I am concerned.

Is there any package I have overlooked, or something I am not applying properly?

• and what is $n$ and $p$? Also, are all your variable continuous? Are all your cases complete or do you have missing cells in some rows? – user603 Nov 4 '14 at 18:30