Re: [R] remove outlier

2015-01-02 Thread David Winsemius
On Jan 2, 2015, at 4:58 AM, Methekar, Pushpa (GE Transportation, Non-GE) wrote: > Hi , > I am working on a function . > > rm.outliers = function(dataset,model){ > dataset$predicted = predict(model) >dataset$stdres = rstudent(model) > m = 1 > for(i in 1:length(dataset$stdres)){ >

Re: [R] remove outlier

2015-01-02 Thread David Barron
Your problem is that you are subsetting the dataset on line 13 of the function, but then on the following line you attempt to add predicted values from the complete data used to fit the model. You'll have to subset that as well (and the same would be true for the following line where you attempt to

[R] remove outlier

2015-01-02 Thread Methekar, Pushpa (GE Transportation, Non-GE)
Hi , I am working on a function . rm.outliers = function(dataset,model){ dataset$predicted = predict(model) dataset$stdres = rstudent(model) m = 1 for(i in 1:length(dataset$stdres)){ dataset$outlier_counter[i] = if(dataset$stdres[i] >= 3 |