1

I have a data set of 167 observations of 3 variables. I am trying to assess and remove multivariate outliers using the robust Mahalanobis distance. To do this I have been playing around with the Moutlier function from the chemometrics package.

I am pretty new to R, so I have some questions:

Here is my code:

data<-isotopes  
  x=data[,c(3:5)] #columns 3-5 contain the data I need to assess  
  require(robustbase)  
  res <- Moutlier(data[,c(3:5)] ,quantile=0.975,plot=TRUE)  
  res  
  which(res$rd>res$cutoff) 

1) Has anyone used this code before, have I done this correctly?

2) Do I need to standardize the data before doing this function, or does it not matter?

3) After using the which function, the result was:

# [1]  13  28  29  47  79  84  89  91 104 128 153 154 

Does this mean that these numbers correspond to observation #13, #28, #29, etc?
So those would be the outliers that I want to remove, for all 3 variables?

Thank you very much to anyone who can help...

Cyrus Mohammadian
  • 4,982
  • 6
  • 33
  • 62
  • The which function output is giving you the row numbers where the values are greater than your quantiles. To remove those rows I think you can use this:. `res <- res[!which(res$rd>res$cutoff),]` – s_scolary Mar 17 '16 at 17:18
  • Thank you for the help! I tried that, and this was the error message "incorrect number of dimensions." Thoughts? – Emily Moffitt Mar 17 '16 at 17:54

0 Answers0