Confounder
A confounder is a variable that is associated with both a dependent and independent variable.
Contents
Description
Confounders are one possible failure of causal inference. An association has been identified between two variables, X and Y, but in actuality there is a confounder Z that causes both.
In this example, controlling for Z explains all correlation. (Note that in R, the Bernoulli distribution is handled as a special case of the Binomial distribution.)
> Z <- rbinom(1000, 1, 0.5) > X <- rbinom(1000, 1, 0.9*(1-Z) + 0.1*Z) > Y <- rbinom(1000, 1, 0.9*(1-Z) + 0.1*Z) > cor(X,Y) [1] 0.6458128 > cor(X[Z==1], Y[Z==1]) [1] -0.0191339 > cor(X[Z==0], Y[Z==0]) [1] 0.01227915
