Codecademy Logo

Conceptual Foundations of Causal Inference

Association vs. Causation

An association is a relationship between two variables that has a strength or pattern, but is not necessarily causal in nature.

An example of an association is shown in the plot. Because swimming pool sales and forest fires are both high in the summer months (May to August), we might conclude that swimming pools cause forest fires, but really the two variables are similar because they are associated with the heat of summer.

Line plot showing the rate of forest fires and swimming pool sales. The lines follow similar curves that rise in the summer months.

Potential Outcomes Definition

Under the potential outcomes framework for causal inference, potential outcomes are the possible results that could happen under different treatment assignments.

Counterfactual Outcomes Example

Under the potential outcomes framework for causal inference, the observed outcome is what actually happened, while the counterfactual outcome is what would have happened had a different treatment been assigned. The included animation shows what the counterfactual outcomes would be when an individual is in the treatment group (universe T) and in the control group (universe C).

An animation that shows what the counterfactual outcomes would be when an individual is in the treatment group and in the control group. 

In the center of the animation there is a white  horizontal dotted line. 

To the left of the dotted line there is a person icon.  Above the line there is the label 'Universe T'. There is an arrow from the central person icon to another person icon with a dog and a cat icon to the right of the person. This arrow is labeled 'Treatment'. To the right of the person with the dog and cat icons there is an arrow pointing right that is labeled 'Outcome' and has the text 'Factual: Universe T' and 'Counterfactual: Universe C' to the right of the outcome arrow. 

The section below the horizontal line is labeled 'Universe C'. There is an arrow pointing from the central person icon to another person icon below the horizontal line. This arrow is labeled 'Control'. To the right of the person icon there is an arrow pointing right labeled 'Outcome' and to the right of the outcome arrow there's the text 'Factual: Universe C' and 'Counterfactual: Universe T.

Potential Outcomes Notation

Under the potential outcomes framework of causal inference, we use the following notation to represent the treatment and outcome variables:

  • Z: treatment group assignment (1 = treatment, 0 = control)
  • Y: outcome actually observed
  • Y1 potential outcome given that the individual was in the treatment group (Z = 1)
  • Y0 potential outcome given that the individual was in the control group (Z = 0)

Individual Treatment Effects

Under the potential outcome framework for causal inference, an individual treatment effect is a comparison of the potential outcomes for a specific individual. One example of an individual treatment effect is Y1 - Y0, where Y1 is the potential outcome if the individual was in the treatment group and Y0 is the potential outcome if the individual was in the control group.

Average Treatment Effect

Under the potential outcomes framework for causal inference, the average treatment effect (ATE) is the average of the individual treatment effects of all individuals in a sample. This can be expressed in two ways:

  • average of all differences Y1 - Y0; or
  • average of all Y1 minus the average of all Y0

Causal Fundamental Problem

The fundamental problem of causal inference is that we can never observe both potential outcomes, only the one that actually occurs.

Substitutes for Counterfactuals

In causal inference, when randomization is not possible, we strive to use close substitutes as estimated counterfactuals for our observed outcomes in order to find our causal estimand of interest.

Confounder Variable Definition

In causal inference, confounders are variables that are associated with both the treatment status and the outcome. The included image depicts how a confounder impacts a causal relationship.

Two diagrams with boxes labeled with letters and arrows connecting the boxes. Diagram 1 shows no confounding because the Z box has an arrow pointing to the Y box. Diagram 2 shows confounding because there is an additional X box with arrows pointing to both the Z and Y boxes.

Selection Bias Definition

Selection bias is bias that happens because of how individuals were put into the treatment or control groups. For example, selection bias could occur if individuals select which treatment they receive themselves.

Conditional Exchangeability Assumption

The conditional exchangeability assumption of causal inference states that, so long as we account for confounders, we would obtain the same outcomes if the groups swapped treatment assignments. This is also known as the ignorability or unconfoundedness assumption.

Learn More on Codecademy