Re: [R] find and remove outlier

2015-01-05 Thread John Fox
Dear Pushpa Methekar, You can use which.max(), as in > library(car) > mod <- lm(prestige~ income + education, data=Duncan) > which.max(abs(rstudent(mod))) minister 6 In fact, this is exactly what outlierTest() does, as you can see by looking at car:::outlierTest.lm Beyond that, I'd en

[R] find and remove outlier

2015-01-05 Thread Methekar, Pushpa (GE Transportation, Non-GE)
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$rstu