[R] find and remove outlier

Methekar, Pushpa (GE Transportation, Non-GE) pushpa.methekar at ge.com
Mon Jan 5 13:20:15 CET 2015



Hi, this is my function to find rstudent of model which will give me outlier
But I wonder if I could find out the exact no. of outlier in data set.
Like outlierTest() does from car package .


rm.outliers = function(dataset,model){
dataset$rstudent = rstudent(model)
for(i in 1:length(dataset$rstudent)){
       if(dataset$rstudent[i]>=-3 & dataset$rstudent[i]<=3)
             {print(dataset$rstudent[i])}
else { print("this is an outlier")
            library(car)
       print(outlierTest(model,n.max=1, order=TRUE) )  }
i<-i+1
}
}


	[[alternative HTML version deleted]]



More information about the R-help mailing list