Introduction to Conditional Parallel Trends Estimation
In recent years, there has been a growing interest in estimating causal effects using the conditional parallel trends (CPT) assumption. This assumption states that the trend in the outcome variable depends on the treatment group, but not on other variables that may be correlated with the treatment. In this blog post, we will explore how to include “regular” covariates in the estimation equation when using the CPT assumption.
Background
The conditional parallel trends assumption is a key component of doubly robust estimation methods. These methods combine two different estimation techniques: one that estimates the trend in the outcome variable for each treatment group (CPT), and another that uses a propensity score to balance the distribution of covariates between treatment groups. The CPT assumption is essential because it ensures that the estimated effect is not confounded by unmeasured heterogeneity.
One popular package for estimating causal effects using the CPT assumption is the did package in R, which was introduced by Callaway and Sant’Anna (2021). This package allows users to estimate causal effects with conditional parallel trends according to this assumption. However, one of the limitations of the package is that it only includes “conditional” covariates, which are those that are already included in the propensity score model.
Including Regular Covariates
In this section, we will explore how to include “regular” covariates in the estimation equation when using the CPT assumption. We will examine the existing code and propose alternative approaches to achieve our goal.
The att_gt function in the did package takes an argument called covariates, which is used to specify the covariates that are included in the propensity score model. However, this argument only includes “conditional” covariates, which means that it does not allow us to include “regular” covariates.
To include “regular” covariates, we need to use an alternative approach. One possible solution is to estimate a separate regression model for each treatment group using lm (linear model). This will allow us to include the “regular” covariates in the estimation equation. However, this approach would require us to specify the same set of covariates for all treatment groups, which may not be desirable.
Alternative Approach: Using a Custom Estimation Function
Another possible solution is to use a custom estimation function that includes the desired “regular” covariates. This will allow us to estimate the causal effect using our preferred specification, while still ensuring that we are meeting the CPT assumption.
To achieve this, we can modify the att_gt function in the did package to accept an additional argument called custom_estimation. This argument would take a function that specifies the estimation equation, including the “regular” covariates. Here is an example of how we might implement this:
# Define a custom estimation function
est_custom <- function(y_name = outcome_var, tname = year, idname = treatment_group, gname = first.treat,
xformla = ~ conditional_vars, allow_unbalanced_panel = T, clustervars = clusters, data = data) {
# Estimate the propensity score using the original method
ps <- att_psm(y_name = y_name, tname = tname, idname = idname, gname = gname, xformla = xformla, allow_unbalanced_panel = allow_unbalanced_panel, clustervars = clusters, data = data)
# Create a new data frame with the estimated propensity scores
df_ps <- data.frame(ps = predict(ps))
# Merge the original data with the propensity score data
df_merged <- merge(data, df_ps, by.x = c(idname, treatment_group), by.y = c("ps"))
# Estimate the causal effect using the custom specification
est_result <- lm(outcome_var ~ covariate_1 + covariate_2 + interaction(covariate_1, covariate_2) + treatment_group, data = df_merged)
return(est_result)
}
Conclusion
In this blog post, we explored how to include “regular” covariates in the estimation equation when using the conditional parallel trends (CPT) assumption. We examined the existing code and proposed alternative approaches to achieve our goal. Specifically, we discussed two possible solutions: estimating a separate regression model for each treatment group and using a custom estimation function that includes the desired “regular” covariates.
We also explored how to implement the second solution, including defining a custom estimation function that accepts an additional argument called custom_estimation. This will allow us to estimate the causal effect using our preferred specification, while still ensuring that we are meeting the CPT assumption.
Overall, this post provides a comprehensive overview of the challenges and solutions related to including “regular” covariates in the estimation equation when using the CPT assumption. We hope that this post has been informative and helpful for users who want to estimate causal effects using this method.
Last modified on 2023-05-15