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
Learn

In order to generalize our understanding of the potential outcomes framework, we will now introduce some notation that will be used throughout the rest of this course.

  • Z represents the treatment or exposure condition. When Z is binary, there are only two possible treatment conditions: treatment (Z = 1) or control (Z = 0).

    (Z could also be a continuous variable, such as medication dosage or number of days in the hospital, but our example assumes that there are only two treatment conditions for simplicity.)

  • Y represents the observed value of the outcome variable.

In the potential outcomes framework, we consider how the Y values we observe would change if the treatment were different:

  • When Z is binary, the two potential outcomes are represented with Y1 and Y0:
    • Y1 is the potential outcome under the treatment condition (Z = 1).
    • Y0 is the potential outcome under the control condition (Z = 0).

In real life, an individual can only be in one treatment group at any specific point in time. Thus, we can never know the value of both potential outcomes for an individual. We will discuss how to deal with this problem in future exercises. For now, assume that we could know the values of both Y0 and Y1.

Instructions

The interactive table in the learning environment shows the potential outcomes of five hospital patients under the two treatment conditions. The Y1 column shows what each patient’s potential cortisol level would be if they interacted with a therapy animal. The Y0 column shows what each patient’s potential cortisol level would be if they did NOT interact with a therapy animal. The Y column shows the observed (factual) outcome.

Play around with entering values in the Z column to see how the observed value in the Y column changes (remember: Z = 1 is the treatment condition, and Z = 0 is the control condition). When Z is 1, the value in the Y1 column should appear in the Y column. When Z is 0, the value from the Y0 column appears.

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?