Grooms and Ortega (2019) study whether the Affordable Care Act Medicaid expansion changed the supply and payment practices of substance use disorder treatment facilities. This project asks you to reproduce the basic state-level comparison and then extend it to another facility outcome.
TODO: In 3-5 sentences, state the research question and explain why Medicaid eligibility could affect treatment providers.
project_data <- read_csv("../data/derived/facility_panel.csv", show_col_types = FALSE)
# These checks should pass before you continue.
stopifnot(!anyDuplicated(project_data[c("state", "year")]))
stopifnot(all(c("state", "year", "facilities", "no_medicaid_pay") %in% names(project_data)))
glimpse(project_data)
## Rows: 392
## Columns: 4
## $ state <chr> "AK", "AK", "AK", "AK", "AK", "AK", "AK", "AL", "AL", …
## $ year <dbl> 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2010, 2011, …
## $ facilities <dbl> 77, 76, 95, 93, 91, 88, 94, 138, 147, 148, 154, 144, 1…
## $ no_medicaid_pay <dbl> 37, 36, 43, 44, 46, 44, 50, 105, 102, 109, 116, 102, 1…
TODO: Report the unit of observation, years covered, and number of states or districts.
For this classroom exercise, the treatment group contains states whose ACA Medicaid expansions took effect in 2014. States without expansion by the end of the sample form the comparison group. States with later adoption dates and territories are omitted so that treatment timing is unambiguous.
expansion_2014 <- c(
"AR", "AZ", "CA", "CO", "CT", "DC", "DE", "HI", "IA", "IL", "KY",
"MA", "MD", "MN", "ND", "NJ", "NM", "NV", "NY", "OH", "OR", "RI",
"VT", "WA", "WV"
)
nonexpansion_through_2017 <- c(
"AL", "FL", "GA", "ID", "KS", "ME", "MO", "MS", "NC", "NE", "OK",
"SC", "SD", "TN", "TX", "UT", "VA", "WI", "WY"
)
analysis_data <- project_data |>
filter(state %in% c(expansion_2014, nonexpansion_through_2017)) |>
mutate(
treated = as.integer(state %in% expansion_2014),
post = as.integer(year >= 2014),
treated_post = treated * post
)
count(analysis_data, treated, year)
## # A tibble: 14 × 3
## treated year n
## <int> <dbl> <int>
## 1 0 2010 19
## 2 0 2011 19
## 3 0 2012 19
## 4 0 2013 19
## 5 0 2014 19
## 6 0 2015 19
## 7 0 2016 19
## 8 1 2010 25
## 9 1 2011 25
## 10 1 2012 25
## 11 1 2013 25
## 12 1 2014 25
## 13 1 2015 25
## 14 1 2016 25
TODO: Explain what treated,
post, and treated_post mean. What states are
excluded, and why?
# TODO: Calculate the mean number of facilities by year and treatment group.
trend_data <- analysis_data |>
group_by(TODO, TODO) |>
summarize(mean_facilities = mean(TODO, na.rm = TRUE), .groups = "drop")
# TODO: Plot mean_facilities over year, using color for the treatment group.
TODO: Describe the pre-2014 patterns and whether the groups appear to move similarly before expansion.
Estimate:
\[ Y_{st}=\beta_0+\beta_1 Treated_s+\beta_2 Post_t+\beta_3(Treated_s\times Post_t)+\varepsilon_{st}. \]
# TODO: Replace OUTCOME with facilities and DATA with analysis_data.
did_model <- feols(OUTCOME ~ treated + post + treated_post, data = DATA)
# summary(did_model)
TODO: Interpret the magnitude, sign, and statistical
uncertainty of the coefficient on treated_post. State
clearly that the design relies on a parallel-trends assumption.
# TODO: Complete the outcome and data arguments. The omitted year is 2013.
event_model <- feols(
OUTCOME ~ i(year, treated, ref = 2013),
data = DATA
)
# iplot(event_model, xlab = "Year", main = "Event-study estimates")
TODO: Discuss the pre-period coefficients before interpreting the post-period pattern. Does the graph support the design’s identifying assumption?
Repeat the descriptive graph, difference-in-differences model, and
event study using no_medicaid_pay, the number of facilities
that did not accept Medicaid.
# TODO: Add your graph and models here.
TODO: Compare these estimates with the results for total facilities.
Choose either beds or ownership. Import the corresponding file and
join it by state and year.
# Choose ONE file:
# extension_data <- read_csv("../data/derived/beds.csv", show_col_types = FALSE)
# extension_data <- read_csv("../data/derived/ownership.csv", show_col_types = FALSE)
# TODO: Join extension_data to analysis_data using left_join().
# extended_data <- ...
# TODO: Confirm that the join did not change the row count.
TODO: State your extension question and hypothesis, then produce one descriptive graph, one difference-in-differences estimate, and one event study. Explain what the extension adds to the original analysis.
TODO: Summarize the main result, the extension, the identifying assumption, one limitation, and one useful next step. Separate what the estimates show from what would require stronger evidence.
Grooms, Jevay, and Alberto Ortega. 2019. “Examining Medicaid Expansion and the Treatment of Substance Use Disorders.” AEA Papers and Proceedings 109: 187-192. https://doi.org/10.1257/pandp.20191090.
sessionInfo()
## R version 4.4.1 (2024-06-14 ucrt)
## Platform: x86_64-w64-mingw32/x64
## Running under: Windows 11 x64 (build 26200)
##
## Matrix products: default
##
##
## locale:
## [1] LC_COLLATE=English_United States.utf8
## [2] LC_CTYPE=English_United States.utf8
## [3] LC_MONETARY=English_United States.utf8
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United States.utf8
##
## time zone: America/Los_Angeles
## tzcode source: internal
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] fixest_0.13.2 lubridate_1.9.3 forcats_1.0.0 stringr_1.5.1
## [5] dplyr_1.1.4 purrr_1.0.2 readr_2.1.5 tidyr_1.3.1
## [9] tibble_3.2.1 ggplot2_4.0.1 tidyverse_2.0.0
##
## loaded via a namespace (and not attached):
## [1] sandwich_3.1-1 sass_0.4.9 generics_0.1.4
## [4] dreamerr_1.5.0 stringi_1.8.4 lattice_0.22-6
## [7] hms_1.1.3 digest_0.6.37 magrittr_2.0.3
## [10] evaluate_1.0.0 grid_4.4.1 timechange_0.3.0
## [13] RColorBrewer_1.1-3 fastmap_1.2.0 jsonlite_2.0.0
## [16] Formula_1.2-5 scales_1.4.0 stringmagic_1.2.0
## [19] numDeriv_2016.8-1.1 jquerylib_0.1.4 cli_3.6.3
## [22] crayon_1.5.3 rlang_1.1.7 bit64_4.6.0-1
## [25] withr_3.0.2 cachem_1.1.0 yaml_2.3.10
## [28] parallel_4.4.1 tools_4.4.1 tzdb_0.4.0
## [31] vctrs_0.6.5 R6_2.6.1 zoo_1.8-12
## [34] lifecycle_1.0.5 bit_4.5.0.1 vroom_1.6.5
## [37] pkgconfig_2.0.3 pillar_1.11.1 bslib_0.8.0
## [40] gtable_0.3.6 glue_1.8.0 Rcpp_1.0.13
## [43] xfun_0.47 tidyselect_1.2.1 knitr_1.48
## [46] farver_2.1.2 htmltools_0.5.8.1 nlme_3.1-164
## [49] rmarkdown_2.28 compiler_4.4.1 S7_0.2.1