# how to perform double ML with binary data (either in the treatment or in the outcome)?

I have grown interested in double Machine Learning (ML) for causal inference because it answers an intuitive question: if the relationship between a variable $$X$$ (the treatment) and a variable $$Y$$ (the outcome) is confounded by a third variable $$Z$$ (the confounder), can't we extract some unconfounded signal to get an unbiased estimate of $$X$$ on $$Y$$?

That's what double ML does! By extracting the residuals $$\epsilon_{X}$$ and $$\epsilon_{Y}$$ (from the regressions of $$X$$ and $$Y$$ on $$Z$$), we "purify" the effect of $$Z$$ on $$X$$ and $$Y$$. We can then estimate the effect of $$X$$ on $$Y$$ from those residuals which are, by construction, unconfounded.

However, as I wanted to apply this at work, I rapidly stumbled upon another difficulty: how can we apply this approach when the treatment $$X$$ or the outcome $$Y$$ is a binary variable?

In this book, it is recommended to not use double ML in a binary outcome context (but I even fail to see how it can implemented) : "If the treatment or the outcome is binary, one might think it is better to replace the machine learning regression models for their classification versions. However, this does not work. The theory of orthogonalization only functions under regression models, similarly with what we’ve seen a long time ago when talking about Instrumental Variables. To be honest, it is not that the model will fail miserably if you replace regression by classification, but I would advise against it."

Is there any workaround solution in this case?

• There's always the backdoor adjustment formula. If it's possible to insert a variable $T$ between $X$ and $Y$ such that you have only the arrows $X\to T$ and $T\to Y,$ then you can use the frontdoor adjustment. And as you've already mentioned, sometimes it is possible to find an instrumental variable - a technique that might also work in a logistic regression (though I have no knowledge of whether that is feasible or not). Commented Jul 7, 2022 at 20:34
• Did you find an answer to this question? I am highly interested! Commented Nov 14, 2022 at 11:37
• unfortunately not, only workarounds such as the one suggested by @AdrianKeister Commented Nov 14, 2022 at 18:30