Berkson's Paradox Simulator

Filter independent traits on a shared selection rule and see the selected-sample association emerge.

At a glance

Computes
Association between two independent traits inside a sample filtered on a shared rule.
You supply
Probability of each trait, population per run, and a random seed.
Use when
You need to show how selecting on an outcome manufactures a correlation.
Not for
Confounding, where a third cause creates the association before any selection. Simpson's Paradox Simulator

Population x trials must be at most 5,000,000.

Population x trials must be at most 5,000,000.

The population traits are independent. The selected sample is filtered.

Population phi

0.000

Selected phi

-0.500

Selection rule
selected if A or B
Selection rate
75.0%
Mean simulated selected phi
Not run
Expected tables
CellPopulationSelected

Value by category

0.00.20.40.60.81.0P(B given A)P(B given not A)PopulationSelected

Run the simulation to fill Monte Carlo metrics and convergence.

Mean selected phi against Trial; reference at Exact selected phi

020406080100−0.500−0.490−0.480−0.470−0.460−0.450Exact selected phiMean selected phi
Monte Carlo convergence
TrialMean selected phi
Export

phi = (both * neither - A-only * B-only) / sqrt(row and column margins) How?

How this is calculated

The full population starts with independent binary traits. The selected sample keeps only cases where trait A or trait B is present, which removes the neither cell and can create a negative association.

Berkson's paradox is collider bias: use the causal DAG builder to trace how conditioning on a shared effect opens a non-causal path.

Formula: phi = (both * neither - A-only * B-only) / sqrt(row and column margins)

Sources

  1. Berkson's paradox overview. Wikipedia. Retrieved .
  2. Collider effect educational note. arXiv. Retrieved .

Method last reviewed