Judea Pearl's "Simpson Machine", introduced in his paper
Understanding
Simpson's paradox,
is an example of a causal structure where stepwise inclusion of
control variables into a regression model switches the
sign of an estimated causal association in every step.
This example illustrates not only how certain causal
structures lead to Simpson's Paradox, but also that
deciding which variables to include in a control set
is impossible without considering the underlying causal
structure.

This web-page allows you to play around with the
Simpson machine and generate example data to
help you understand Simpson's paradox and
the relationship between causal structure, adjustment,
and bias. You can generate Simpson machines of different
sizes, adjust for different variables to see the
effect on the causal effect estimate, and
generate R code of the simulator to generate and analyse
the data yourself.