# Determine treatment effect based on conditional factors

Say I have an experiment running where I give treatment to a random selection of people, and I know that the target variable is affected by a number of factors. I know most of the factors that affect the target. So with this, I can run a model on my data, predict the target variable and see if the treatment variable is picked up by the model. (let's say lin. reg. for simplicity)

I want to predict what the magnitude of a treatment effect depending some of the factors that affect the target. So maybe the treatment effect declines with subject age, or income bracket. How can I do this?

You can estimate a regression specification with all these on the right hand side:

1. a treatment indicator variable $t$
2. the covariates that influence the target, $x$s
3. interactions between treatment indicator and each covariate where you expect to see heterogeneity in the treatment effect.

Say you had one covariate $x$:

$$E[ y \vert x, t] = \alpha + \beta x + \gamma t + \eta t \cdot x.$$

The effect of treatment is then $$\frac{\partial E[ y \vert x, t]}{\partial t}= \gamma + \eta x,$$

which is a function of $x$. You can evaluate that at the typical $x$ or plot a curve for the range of the values that you see in the data. You can also just consider the coefficient $\eta$, which tells you whether $x$ alters the treatment effect $\beta$.

If you have lots of covariates, then some more sophisticated methods can be used to model the heterogeneity.

• Awesome! How are the sophisticated methods called? Any keywords I can google to go deeper into this subject? For instance, how would you do this when the target variable is binary, or multiple classes? Commented Jan 24, 2018 at 14:17
• @PeterSmit You can either do regularization (where you shrink some of the interaction coefficients) or you can use causal forests. These both require substantial data to allow for more model complexity. Commented Jan 24, 2018 at 17:30