Suppose that one wants to estimate the effect of X on Y in the following causal diagram

enter image description here

Should one take Z as a covariate (and why/why not?)

For example, suppose that one wants to estimate the effect of gender on strength. Let's assume, for the sake of the example, that men are on average taller than women. Should one use height as a covariate when estimating the effect of gender on strength?

  • 2
    $\begingroup$ In the DAG drawn, $Y \perp Z$ so I don't think conditioning on $Z$ provides any value. Choice to condition on $Z$ also depends on the substantive knowledge of the arrow (or lack thereof) between $Z$ and $Y$. $Z$ could be a moderator, and hence this can change the interpretation of the effect of $X$ on $Y$. $\endgroup$ Jan 15 at 16:09
  • 1
    $\begingroup$ Additionally, this can hurt your inference depending on how string the correlation is between $Z$ and $X$. If the two are strongly correlated and $Y$ is independent of $Z$, then the estimate of the effect of $X$ will be less precise (i.e. will have lower statistical power to detect an effect) $\endgroup$ Jan 15 at 16:28

3 Answers 3


First, if you want to estimate the effect of X on Y, then you only need to control for Z if it is (potentially) correlated with both X and Y. This is because if it is only correlated with one of them, then failing to control for it will not bias your estimate of the relationship between X and Y. In graphical terms, there needs to be a "back door" path between X and Y that runs through Z. Controlling for Z means "blocking" that path so that the only path between X and Y is the one you want to estimate.

So if I want to estimate the effect of gender (X) on strength (Y), then I probably don't need to control for hair length, because although being female might be associated with having longer hair, I can't think of a good reason why hair length, on its own, would be correlated with strength (unless you believe the story of Samson).

But just being correlated with X and Y isn't enough. In addition, I only want to control for Z if it is a potential confounder, but not if it is a potential mediator. In a path diagram like you included above Z would be a confounder if it had arrows pointing to both X and Y, indicating that Z actually causes both X and Y. For example, if I were looking at the effect of education on income, a confounder might be parental wealth. Having rich parents could cause people to get more education, and also cause people to earn more income for reasons that have nothing to do with education. If I didn't control for parental wealth, I might get a biased estimate of how much education actually causes a change in income.

But if there is an arrow going from X to Z, and then another one going from Z to Y, then Z is a mediator: that is, Z is part of the mechanism by which X causes Z. So in the education and income example, "interviewing skill" could be a mediator. Being good in interviews is likely to be correlated with both income and education, but that's because on of the reasons that education improves income is that it makes you better in interviews. So you do not want to control for interviewing skill if you want to know the causal effect of education, because you would be "controlling away" part of the very effect you are looking for.

So going back to your example: Height is clearly correlated both with strength and gender. But being taller doesn't cause you to be male, so it can't be a confounder. On the other hand, being taller might be part of why men tend to be stronger (having a Y chromosome makes you bigger, and bigger people tend to be stronger). So you probably don't want to control for height in this model.

Note that there is no way to tell whether a variable is a confounder or mediator just by looking at correlations. You need to bring in theoretical or substantive knowledge (like the non-statistical observation that height doesn't cause gender) to sort this out.

There are some additional complications about when to control for different variables, but what I have described are the most important issues.

  • 1
    $\begingroup$ Can correlations help with deciding whether a variable is a confounder or a mediator? $\endgroup$
    – Sam
    Jan 16 at 9:10
  • $\begingroup$ There is a whole field called "causal discovery" that aims to learn the causal graph from data so as to know what to control for when estimating effects. Many of the methods used to this end employ correlation measures, so correlations can indeed help in deciding whether a variable is a confounder or mediator (or what to control for in general). $\endgroup$
    – Scriddie
    Jan 16 at 11:49
  • 1
    $\begingroup$ One warning on "causal discovery." It will only identity the correct causal structure of a set of correlations if a number of very strong assumptions are true. There are ways in which it can use correlations to help figure out if a variable is a mediator or confounder under certain circumstances, and making certain assumptions, but even in this method correlational data alone can't do it. $\endgroup$ Jan 29 at 14:58

I'm not sure how your DAG relates to either your general question (when to include covariates?) or your specific one (sex, strength, and height).

What you should do depends on what you want to know. Do you want to know:

  • If men are usually stronger than women?
  • If men of a given height are usually stronger than women of that height?
  • If sex has an effect on strength beyond its effect on height? (this is slightly different than the bullet right above, because it adds causation).
  • Something else?

For the first, don't control for height. For the second, do control for height. For the last .... you're going to need a lot more than just data on height, sex, and strength to come close to making a causal statement. I think you'd need to add a lot of biology and maybe some other things. For causal statements the gold standard is an experiment, and that isn't possible here. But you'd surely want data on time spent in a gym (and doing what while there), time doing strenuous physical activity, and so on. But that still is just controlling for some possible things, it's not definitive to cause. Maybe you could try to show that testosterone causes muscle growth or something like that (either by looking at the literature or doing more work).

Other reasons to include a covariate:

  • It's part of your hypotheses.
  • You want to show that the relationship with the DV is weak.
  • Everyone else includes it. They would laugh at you if you didn't.
  • You want to replicate a study.
  • It's part of an interaction.

and probably some others that I am not thinking of right now.

(As an aside, the variable is sex, not gender. Male and female are sexes (not the only ones). Masculine and feminine are genders (and that gets really complex).


Q: When should one control for covariates?

A: When one thinks that (has an argument in favor of the hypothesis that) a covariate affects/co-determines directly or indirectly the dependent variable.


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.