I found an outlier using the outlierTest function in the car package. However, I can see from the results that the Externally Studentized Residual and p-values. This is a result.

enter image description here

This indicates that the 718th observation has an outlier. right??

The code to derive the result is as follows.

credit<-read.csv("german.csv", header = TRUE)

for(i in F) credit[,i]=as.factor(credit[,i])

german_logit<-glm(Creditability~.,data=credit, family = "binomial")

If so, is it correct to delete the 718th observation?

I want to know what variable has outlier and its value, because I want to change that value as proper value. What function do I have to use?


2 Answers 2


So few points of clarity:

What do you mean by an outlier? Here observation 718 is such that its dependent variable in the glm model has an unusual value based on its independent variables. If you look at the dataset in a different way i.e. using say bivariate analysis on another variable, the same observation or may not get flagged as an outlier.

To display data values use credit[718,] for more information on subsetting use ?'[' in console to pull up the help page.

You're passing all variables to the model using formula Creditability ~. so your outlier will be a row, and not a single variable.

Now onto deleting observations, it is advised to instead create a column or a list as an indicator of outliers / outlier row numbers. In such a way, you can subset your data set according and you never lose data.

  • $\begingroup$ I can't understand that creating a cloumn or a list as an indicator of outliers. 718 is not variable. it is an observation. I want to know that what independent variable has outlier. So I will change the outlier value as other value. But If i use outlierTest function, I can know just what observation has outlier not variable. $\endgroup$
    – 신익수
    Commented Jul 6, 2017 at 12:11
  • 2
    $\begingroup$ You should be very wary of changing your data! outlier detection is meant to flag observations that might be in error, so you can investigate them. It is not a license to change the data. An outlier could very well be a legitimate observation. $\endgroup$ Commented Jan 5, 2019 at 13:37

Read the result of outlierTest() again.

It found zero outliers as it says "No Studentized residuals with Bonferonni p < 0.05"

It then lists the largest studentized residual it DID find, which happens to be at row 718.

The function is not saying that 718 is an outlier; rather, it is saying that it did not find any outliers. Observation 718 is merely the largest studentised residual. That is to say, 718 is the closest thing to an outlier it has found. However, since the Bonferroni Correction has a minimum value of around 3.51 at n=23, the value of -2.888274 for row 718 is still not close to being considered an outlier under this threshold.

Regardless, do not delete data points just because they do not fit your model, and you really want your model to be correct.

  • You must have a good, objective reason for deleting data points.

  • If you delete any data after you've collected it, justify and describe it in your reports.

  • If you are not sure what to do about a data point, analyze the data twice — once with and once without the data point — and report the results of both analyses.

There's a famous story that the hole in the Ozone layer over Antarctica would have been discovered a decade earlier had outliers collected via satellite not been automatically discarded.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.