Log in from a computer to take this course

You'll need to log in from a computer to start Learn the Basics of Causal Inference with R. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store

In observational studies, when randomization is not possible, balance of measured and unmeasured confounding variables is not guaranteed. Without taking appropriate measures, the causal estimate of the effect of a treatment on an outcome of interest will be biased.

Instrumental variable (IV) estimation is one causal inference method that uses instruments to help reduce bias from both measured AND unmeasured confounding variables.

If you started this lesson hoping to learn about pianos and guitars, you may be disappointed. In IV estimation, an instrument (or instrumental variable) is a variable that is causally related to an outcome variable ONLY through another variable — typically the treatment variable of interest.

An instrumental variable would be depicted in a causal diagram as follows:

IV diagram where Treatment, Outcome, Confounders (both measured and unmeasured), and Instruments are all represented. Treatment feeds the Outcome. Instruments feeds the treatment. The Confounders feed both the Outcome and the Treatment.

In this diagram, the arrows signify the presence and direction of a causal relationship. For example, there is no arrow directly from the instrument to the outcome because the instrument only impacts the outcome through its causal relationship with the treatment.


Take a look at the animation in the learning environment. Each frame of the animation has a different example of how IV estimation could be used in practice along with a causal diagram that describes the scenario. Pause the animation as necessary to read and understand each scenario.

Pay particular attention to the third example, which describes the recycling scenario again. We will use it throughout the rest of this lesson to illustrate IV estimation.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?