# Outliers in binary columns

Is it possible to exist outliers in binary columns? At first I thought it was impossible based on this Outlier detection for a univariate categorical variable? , assuming that binary columns also mean categorical data in this example.

But then, while working on a dataset on kaggle, I saw this notebook: https://www.kaggle.com/bariscal/stroke-entirely-ml-project-and-eda/comments

In the Anomaly Detection section, the author removed rows where IQR (InterQuartile Range) identified their respective columns as containing outliers, among those columns there were binary data (categorical), such as a column that said if a person was or wasn't married, and even the target variable (the column the author was trying to predict) that was also a binary column.

Can someone clarify this to me? Is it correct to remove outliers from a binary column like that?

• I'm not going to read that notebook, but in an univariate binary situation the only way to see an observation as outlier is for it to belong to a category with very, very low probability. Even then it is strange because the fact that the category is there should normally mean that it's legitimate to observe something there. However, with more than one variable there can surely be outlying multivariate binary observations with very rare combinations of values that "lie out" according to a suitable distance measure. Mar 29, 2021 at 23:01
• Ok, this is really silly territory. You mean delete everything outside the central 50%? For continuous data that would be stupid to put it mildly. For binary data what does it mean? Randomly picking 50% of the 0's and 1's and deleting them? Or deleting all 0's and 1's when the percentage is less than 25%? I can't see any way of describing this whole enterprise other than utter BS. Mar 30, 2021 at 11:06
• The problem of course may be that the thread opener has misunderstood the notebook, or that the notebook is written in a misleading way... Mar 30, 2021 at 13:30
• The question misrepresents the procedure: it uses the fences in a boxplot to detect outliers, not the IQR itself. This remains a counterproductive way to deal with binary data, though, because it will eradicate any values that have a frequency of less than 25%. Maybe the best solution is to ignore that notebook and move on. And yes, there are legitimate, useful concepts of "geometric" or "multivariate" binary outliers which stand out from most other data due to combinations of values. See stats.stackexchange.com/questions/108741, for instance.
– whuber
Mar 30, 2021 at 16:08
• Although that link explains some basic things correctly, imho it goes too far in implicitly taking a univariate outlier always to be a value beyond one of the hinges. You can find much more thoughtful and useful accounts of outlier detection both here on CV (look at the results of this site search) and in the better stats textbooks.
– whuber
Mar 31, 2021 at 14:28