Activity 12: Compliance status and local average treatment effects#
2025-04-03
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
Part 1: Monotonicity violation#
Here are the four compliance types in a study:
Always-taker: takes treatment regardless of the instrument encouragement
Never-taker: does not take treatment regardless of the instrument encouragement
Complier: takes treatment only when the instrument encourages it
Defier: takes treatment only when NOT encouraged by the instrument
Discuss with folks around you which scenario corresponds to a likely violation of the monotonicity assumption (no defiers):
A. Some patients offered a new medication (Z=1) refuse to take it (T=0), while others not offered the medication obtain it through alternative means.
B. Some consumers who see repeated targeted ads for a streaming service (Z=1) become annoyed by the aggressive marketing and decide not to subscribe (T=0), whereas they might have subscribed if they hadnβt been bombarded with ads.
C. Some homeowners given rebates for energy-efficient appliances (Z=1) still choose not to upgrade (T=0), while others upgrade their appliances even without rebates.
D. Some employees who arenβt offered a retirement savings workshop (Z=0) contribute to their 401(k) plan (T=1), while some who are offered the workshop still donβt contribute.
Your response: pollev.com/tliu
Part 2: Calculating compliance types and LATE#
Suppose for our smart thermostat study, we have the following data:
\(Z\): household was given a smart thermostat
\(T\): used energy-efficient thermostat settings
\(Y\): household energy consumption
We collected data on 1000 households:
Group |
Z=1 |
Z=0 |
Total |
---|---|---|---|
T=1 |
300 |
100 |
400 |
T=0 |
200 |
400 |
600 |
Total |
500 |
500 |
1000 |
thermo_df = pd.DataFrame({
'Z=1': [300, 200],
'Z=0': [100, 400],
}, index=['T=1', 'T=0'])
thermo_df.head()
Z=1 | Z=0 | |
---|---|---|
T=1 | 300 | 100 |
T=0 | 200 | 400 |
2.1#
We assume that monotonicity holds, so there are no defiers.
We can calculate the proportions of each compliance type as follows:
Always-takers are people who take treatment even without encouragement:
Never-takers are people who donβt take treatment even with encouragement:
Defiers: 0, based on monotonicity
Since all of the probabilities need to sum to 1, we can therefore calculate the proportion of compliers as follows:
The proportion of compliers is also equivalent to:
Compute, either manually or by using the thermo_df
dataframe, the proportions of each compliance type in our data:
Always-takers: TODO
Never-takers: TODO
Compliers: TODO
# TODO your calculations here
2.2#
We saw earlier that the intent-to-treat (ITT) effect is as follows:
And we have just defined the local average treatment effect (LATE) as:
Suppose that the intent-to-treat effect is -10 kilowatt-hours (kWh). What is the local average treatment effect (LATE)?
Your response: pollev.com/tliu
# TODO your calculations here
2.3#
From lecture last time we saw that under linear outcomes, the ATE is identified in the exact same way as the LATE:
Researchers often choose whether to interpret their instrumental variable results as a LATE or ATE:
ATE: \(E[Y(1) - Y(0)]\)
LATE: \(E[Y(1) - Y(0) \mid \text{compliers}]\)
Which causal quantity seems more useful in the context of the smart thermostat study? Feel free to discuss with folks around you.
Your response: pollev.com/tliu