Journal of Financial and Quantitative Analysis · 2026 · 10.1017/s0022109025102275

Opioid Crisis and Real Estate Prices

Cláudia Custódio; Dragana Cvijanović; Moritz Wiedemann

The research recipe, read from the replication code

dataverse · package · stata, r
2013–…
sample period in the code
6
keep/drop statements
52
winsorizations
19
missing-data rules
6
de-duplications
23
distinct estimations
Sample period in the code: the latest start and earliest end its separate keep/drop filters impose — [D] DataPreparationsDiD.do:176; other windows in the code: 2016–2016.
These tiles count distinct estimations (one per command, method, inference, fixed effects and file) and keep/drop statements. "How the code gets from data to results" below counts every estimating statement (47) and keep/drop statements plus winsorized variables (42).
1 · Data and structure
Databases read: HMDA
Panel declared as: countyfips × year (annual)
2 · How the sample is built
  • keep prior model sample ×2
  • keep missing data ×1
  • drop time period ×1
  • keep time period ×1
  • drop value range ×1
Reshaping: collapse to a coarser unit ×8; drop duplicate rows ×6
3 · Design and validation
Identification: difference in differences, event study, instrumental variables, regression discontinuity
DiD checks: heterogeneity robust estimator
IV diagnostics: first stage f
4 · What it estimates
CommandMethodFixed effects absorbedInferenceFile
lm
(AbsPrescriptions ~ cancercount + medicarehospicecount + medicareambulatorysurgerycount + LogTotPop + YEARFactor, data = subset_resid[which(subset_resid$N_pillMills < 8), ])
ols default [A] DiDGoodmanBaconDecomp.R
lm
(COCPOSS_PC0913 ~ Avg0913MaleRatio + Avg0913WhiteRatio + Avg0913BlackRatio + Avg0913IARatio + Avg0913HispanicRatio + Avg0913Age20t64ratio + Avg0913Age65pratio + Avg0913UnemploymentRate + Avg0913LogHHIncome + PopDensity + DemocraticGovernorShare0913, data = df0913)
ols default [D] CreateOpioidMaster.R
reghdfe
reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct, absorb(year) residuals(prescriptionrate_r)
panel feyear default [D] DataPreparationsCorrelationsIV.do
reghdfe
reghdfe absprescriptions cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop, absorb(year) cluster(countyfips)
panel feyear cluster by countyfips [D] DataPreparationsCorrelationsIV.do
reghdfe
reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct if n_pillmills < 8, absorb(year)
panel feyear default [D] DataPreparationsDiD.do
reghdfe
reghdfe PC_avghomevalue post l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate l_laborpartrate l_neoplasmsrate, absorb(countyfips year) vce(cluster statefips)
panel fecountyfips, year cluster by statefips [D] DataPreparationsDiD.do
reghdfe
reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct if n_pillmills < 8, absorb(year)
panel feyear default [D] DataPreparationsStateLawRD.do
reghdfe
reghdfe `y`Y'' ${xvar} L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physicians_w, absorb(countyfips year) vce(cluster countyfips)
panel fecountyfips, year cluster by countyfips [R] CorrelationsOpioidAbuseHomeValues.do
reghdfe
reghdfe `y`Y'' ${xvar} L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physicians_w, absorb(state_year) vce(cluster countyfips)
panel festate_year cluster by countyfips [R] CorrelationsOpioidAbuseHomeValues.do
reghdfe
reghdfe `y`Y'' ${xvar} L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physicians_w, absorb(`f`F'') vce(cluster countyfips)
panel fe`f`F'' cluster by countyfips [R] CorrelationsOpioidAbuseHomeValues.do
ivreghdfe
ivreghdfe LogPC_HomeValue5YR L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physicians_w (L1presr_pm8r = pivchg9704), absorb(state_year) vce(clus
ivstate_year cluster by countyfips [R] IVRegresions.do
reghdfe
quietly reghdfe L1presr_pm8r pivchg9704 L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physicians_w, absorb(state_year) vce(cluster countyfips)
panel festate_year cluster by countyfips [R] IVRegresions.do
ivreghdfe
ivreghdfe LogPC_HomeValue5YR L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physicians_w (L1presr_pm8r = L1sup), absorb(countyfips year) vce(clus
ivcountyfips, year cluster by countyfips [R] IVRegresions.do
reghdfe
quietly reghdfe L1d_o_rate L1sup L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physicians_w, absorb(countyfips year) vce(cluster countyfips)
panel fecountyfips, year cluster by countyfips [R] IVRegresions.do
reghdfe
reghdfe `y`Y'' `x`X'' l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate l_laborpartrate l_neoplasmsrate l_physicians, absorb(countyfips year) vce(cluster statefips)
panel fecountyfips, year cluster by statefips [R] StateLawDiDInteractions.do
reghdfe
reghdfe `y`Y'' `x`X'', absorb(countyfips year) vce(cluster statefips)
panel fecountyfips, year cluster by statefips [R] StateLawDiDSunAbrahm.do
eventstudyinteract
eventstudyinteract PC_avghomevalue L*event F*event, vce(cluster statefips) absorb(countyfips year) cohort(TreatYear) control_cohort(lastcohort) covariates(l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate
didcountyfips, year cluster by statefips [R] StateLawDiDSunAbrahmHomeValueAdditional.do
reghdfe
reghdfe lawpassed avgprescriptionrate ageadjustedoverdosedeathrate, noabsorb vce(robust)
panel fe robust [R] StateLawPredictors.do
rdrobust
rdrobust `y`Y'' borderdis, covs(`x`X'') vce(hc0) p(`p`P'') `h`H''
rd robust [R] StateLawRD.do
rdrobust
rdrobust : word `Y' of YR2015povertyratio YR2015unemploymnentrate YR2015laborpartrate YR2015avghomevalue borderdis, vce(hc0) p(1)
rd robust [R] StateLawRDPriorDensity.do
reghdfe
reghdfe PC_avghomevalue post l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate l_laborpartrate l_neoplasmsrate l_physicians, absorb(countyfips year) vce(cluster statefips)
panel fecountyfips, year cluster by statefips [S] SummaryStatisticsDiD.do
reghdfe
reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct, absorb(year)
panel feyear default [S] SummaryStatisticsGeneral.do
reghdfe
reghdfe absprescriptions cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop, absorb(year) cluster(countyfips)
panel feyear cluster by countyfips [S] SummaryStatisticsGeneral.do
5 · What it produces
13 table files and 4 figure files (tex 12, pdf 3, ? 2).
ChannelHousingDynamics.texChannelMigration.texDiDCounts.texHomeValueMeasures.texOpioidAbuseMeasures.texPrescriptionLegitimateDrivers.texCorrHVOn`XChoice'R`RChoice'.texCorrHVOn`XChoice'R`RChoice'NoSD.texLawDiDX`XChoice'.texStateLawPassagePredictor.texIVPurdue.texIVSupplyChain.texRDPreControlsYR2015Dif1_dth_opioid_rate.pdfRDPreControls`yvar'.pdfRDdis`y`Y''`xx`X''Poly`p`P''`hh`H''PillD`m`M''.pdf
How the code gets from data to results own page
24
scripts
34
input files
8
file hand-offs
45
merges
42
sample steps
47
estimations

1 · Data in — files the code reads and no script of the package writes

Datasets this package uses (item detector / README): HMDA Mortgage Lending
  • ../data_src/MasterDataSrc/HMDA.csv CSV
    [D] CreateOpioidMaster.R:50
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 50 HMDA = read_csv("../data_src/MasterDataSrc/HMDA.csv", guess_max = 50000)
Other input files 33 files
  • ../data_src/MasterDataSrc/OpioidStateLaws.xlsx Excel · read by 3 scripts
    [D] CreateOpioidMaster.R:168
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 168 Laws = read_excel("../data_src/MasterDataSrc/OpioidStateLaws.xlsx")
  • ../data_src/MasterDataSrc/StatePartyPowerGovernorsSenateHouse.csv CSV · read by 2 scripts
    [D] CreateOpioidMaster.R:89
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 89 politics = read_csv("../data_src/MasterDataSrc/StatePartyPowerGovernorsSenateHouse.csv", guess_max = 10000)
  • ../data_src/MasterDataSrc/USCensus.csv CSV · read by 2 scripts
    [D] CreateOpioidMaster.R:26
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 26 USCensus = read_csv("../data_src/MasterDataSrc/USCensus.csv", guess_max = 100000)
  • ../data_src/MasterDataSrc/ACS5yrHousing.csv CSV
    [D] CreateOpioidMaster.R:69
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 69 ACSHousing = read_csv("../data_src/MasterDataSrc/ACS5yrHousing.csv", guess_max = 50000)
  • ../data_src/MasterDataSrc/ArcosPillMillCounties.csv CSV
    [D] CreateOpioidMaster.R:55
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 55 PillMills = read_csv("../data_src/MasterDataSrc/ArcosPillMillCounties.csv")
  • ../data_src/MasterDataSrc/BLS.csv CSV
    [D] CreateOpioidMaster.R:34
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 34 BureauLS = read_csv("../data_src/MasterDataSrc/BLS.csv", guess_max = 100000)
  • ../data_src/MasterDataSrc/ConsumerFinanceMortgagesPastDue.csv CSV
    [D] CreateOpioidMaster.R:47
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 47 Mortgages = read_csv("../data_src/MasterDataSrc/ConsumerFinanceMortgagesPastDue.csv", guess_max = 100000)
  • ../data_src/MasterDataSrc/CountyDrugCrimeUCR.csv CSV
    [D] CreateOpioidMaster.R:85
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 85 CountyDrugCrime = read_csv("../data_src/MasterDataSrc/CountyDrugCrimeUCR.csv")
25 more
  • ../data_src/MasterDataSrc/CountyInflowMigrationSOITAX.csv CSV
    [D] CreateOpioidMaster.R:62
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 62 CountyInflow = read_csv("../data_src/MasterDataSrc/CountyInflowMigrationSOITAX.csv", guess_max = 20000)
  • ../data_src/MasterDataSrc/CountyPolygons.rds RDS
    [D] CreateOpioidMaster.R:224
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 224 cty = readRDS("../data_src/MasterDataSrc/CountyPolygons.rds")
  • ../data_src/MasterDataSrc/MedicareSurgeryLongTermCare.csv CSV
    [D] CreateOpioidMaster.R:78
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 78 MedicareSurgeries = read_csv("../data_src/MasterDataSrc/MedicareSurgeryLongTermCare.csv", guess_max = 100000)
  • ../data_src/MasterDataSrc/NeoplasmsDeath.csv CSV
    [D] CreateOpioidMaster.R:82
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 82 Neoplasms = read_csv("../data_src/MasterDataSrc/NeoplasmsDeath.csv", guess_max = 100000)
  • ../data_src/MasterDataSrc/OpioidPhysicianPayments.csv CSV
    [D] CreateOpioidMaster.R:58
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 58 drugsFull = read_csv("../data_src/MasterDataSrc/OpioidPhysicianPayments.csv", guess_max = 10000)
  • ../data_src/MasterDataSrc/OpioidPrescription.csv CSV
    [D] CreateOpioidMaster.R:41
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 41 Opioid = read_csv("../data_src/MasterDataSrc/OpioidPrescription.csv", guess_max = 100000)
  • ../data_src/MasterDataSrc/PhysiciansQuery.csv CSV
    [D] CreateOpioidMaster.R:44
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 44 Physicians = read_csv("../data_src/MasterDataSrc/PhysiciansQuery.csv", guess_max = 100000)
  • ../data_src/MasterDataSrc/PurdueIVdata.csv CSV
    [D] CreateOpioidMaster.R:72
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 72 PurdueIV = read_csv("../data_src/MasterDataSrc/PurdueIVdata.csv", guess_max = 10000)
  • ../data_src/MasterDataSrc/RestrictedAccessDataCoverage.csv CSV
    [D] CreateOpioidMaster.R:96
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 96 pseudo_coverage = read_csv("../data_src/MasterDataSrc/RestrictedAccessDataCoverage.csv")
  • ../data_src/MasterDataSrc/StatePolygons.rds RDS
    [D] CreateOpioidMaster.R:219
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 219 st = readRDS("../data_src/MasterDataSrc/StatePolygons.rds")
  • ../data_src/MasterDataSrc/SupplyChainIV.csv CSV
    [D] CreateOpioidMaster.R:74
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 74 SupplyChainIV = read_csv("../data_src/MasterDataSrc/SupplyChainIV.csv", guess_max = 10000)
  • ../data_src/MasterDataSrc/UrbanityInfo.csv CSV
    [D] CreateOpioidMaster.R:153
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 153 df_urbanity = read_csv("../data_src/MasterDataSrc/UrbanityInfo.csv")
  • ../data_src/MasterDataSrc/ZillowHomeValue.csv CSV
    [D] CreateOpioidMaster.R:38
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 38 HomeValue = read_csv("../data_src/MasterDataSrc/ZillowHomeValue.csv", guess_max = 100000)
  • ../data_src/StateLawPredDataSrc/AgeAdjustedOverdoseDeathRate2015.csv CSV
    [D] DiDStateLawPredictor.R:32
    ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 32 Overdose2015 = read_csv("../data_src/StateLawPredDataSrc/AgeAdjustedOverdoseDeathRate2015.csv")
  • ../data_src/StateLawPredDataSrc/ChildWelfare_statelevel2014.csv CSV
    [D] DiDStateLawPredictor.R:64
    ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 64 child_df = read_csv("../data_src/StateLawPredDataSrc/ChildWelfare_statelevel2014.csv", guess_max = 50000)
  • ../data_src/StateLawPredDataSrc/GDPbyState.csv CSV
    [D] DiDStateLawPredictor.R:46
    ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 46 GDP = read_csv("../data_src/StateLawPredDataSrc/GDPbyState.csv")
  • ../data_src/StateLawPredDataSrc/GovtFinances_statelevel.csv CSV
    [D] DiDStateLawPredictor.R:60
    ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 60 GovFin_df = read_csv("../data_src/StateLawPredDataSrc/GovtFinances_statelevel.csv", guess_max = 50000)
  • ../data_src/StateLawPredDataSrc/MedianHouseholdIncome.xlsx Excel
    [D] DiDStateLawPredictor.R:38
    ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 38 MHI = read_xlsx("../data_src/StateLawPredDataSrc/MedianHouseholdIncome.xlsx")
  • ../data_src/StateLawPredDataSrc/OpiodPrescriptionsByState.csv CSV
    [D] DiDStateLawPredictor.R:26
    ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 26 StateOpioid = read_csv(paste("../data_src/StateLawPredDataSrc/OpiodPrescriptionsByState.csv", sep = ""))
  • ../data_src/StateLawPredDataSrc/Population2015.csv CSV
    [D] DiDStateLawPredictor.R:52
    ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 52 Pop = read_csv("../data_src/StateLawPredDataSrc/Population2015.csv")
  • ../data_src/StateLawPredDataSrc/PovertyRatio.xlsx Excel
    [D] DiDStateLawPredictor.R:42
    ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 42 Pov = read_xlsx("../data_src/StateLawPredDataSrc/PovertyRatio.xlsx")
  • ../data_src/StateLawPredDataSrc/UCR_statelevel.csv CSV
    [D] DiDStateLawPredictor.R:56
    ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 56 StateCRIME = read_csv("../data_src/StateLawPredDataSrc/UCR_statelevel.csv", guess_max = 50000)
  • ../data_src/StateLawPredDataSrc/Unemployment2015.xlsx Excel
    [D] DiDStateLawPredictor.R:35
    ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 35 Unemploy = read_xlsx("../data_src/StateLawPredDataSrc/Unemployment2015.xlsx")
  • ../esttab/03DiDStateLaws/CoefsDiDPC_avghomevalue.csv CSV
    [A] DiDRothPretrends.R:22
    ReplicationCodeImputed/R/[A] DiDRothPretrends.R, line 22 beta = read_delim("../esttab/03DiDStateLaws/CoefsDiDPC_avghomevalue.csv", delim = "\t")
  • ../esttab/03DiDStateLaws/VCmatDiDPC_avghomevalue.csv CSV
    [A] DiDRothPretrends.R:35
    ReplicationCodeImputed/R/[A] DiDRothPretrends.R, line 35 sigma = read_delim("../esttab/03DiDStateLaws/VCmatDiDPC_avghomevalue.csv", delim = "\t")

2 · The file pipeline — which script writes which file that a later script reads

24 scripts, in the order the master script runs them; 8 hand-offs through 6 intermediate files. 2 hand-offs run against this order (dashed), so the order is low-confidence: the scripts share a file both ways, or the order is not the one stated.

2 master scripts, run in this order —
[M] OpioidMasterFileR.R before [M] MasterOpioid.do: their scripts read each other's files; file-name order

Low-confidence order also: [M] OpioidMasterFileR.R and [M] MasterOpioid.do read each other's files.

ReplicationCodeImputed/R/[D] CreateOpioidMaster.R → ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R: OpioidMaster.csvReplicationCodeImputed/R/[D] CreateOpioidMaster.R → ReplicationCodeImputed/R/[P] CorrelationMap.R: OpioidMaster.csvReplicationCodeImputed/Stata/[R] StateLawDiDSunAbrahm.do → ReplicationCodeImputed/R/[S] DiDPlotSunAbraham.R: LawRegDiDSunAbrahamLowAbuse.csv, LawRegDiDSunAbrahamMain.csvReplicationCodeImputed/Stata/[R] StateLawRD.do → ReplicationCodeImputed/R/[S] RDTables.R: RDCoefficientsMainSpecs.csv, RDCoefficientsPillMills.csvReplicationCodeImputed/R/[D] CreateOpioidMaster.R → ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do: OpioidMaster.csvReplicationCodeImputed/R/[D] CreateOpioidMaster.R → ReplicationCodeImputed/Stata/[D] DataPreparationsDiD.do: OpioidMaster.csvReplicationCodeImputed/R/[D] CreateOpioidMaster.R → ReplicationCodeImputed/Stata/[D] DataPreparationsStateLawRD.do: OpioidMaster.csvReplicationCodeImputed/R/[D] DiDStateLawPredictor.R → ReplicationCodeImputed/Stata/[R] StateLawPredictors.do: StateLawPredictorDataset.csv ReplicationCodeImputed/R/CreateLatexTableContentRowsOnly.R 1. CreateLatexTableContentRowsOnly.R ReplicationCodeImputed/R/[M] OpioidMasterFileR.R 2. [M] OpioidMasterFileR.R ReplicationCodeImputed/R/[D] CreateOpioidMaster.R · reads 22 input files · 1 estimation 3. [D] CreateOpioidMaster.R 1 est.ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R · reads 13 input files 4. [D] DiDStateLawPredictor.R ReplicationCodeImputed/R/[P] CorrelationMap.R 5. [P] CorrelationMap.R ReplicationCodeImputed/R/[S] DiDPlotSunAbraham.R 6. [S] DiDPlotSunAbraham.R ReplicationCodeImputed/R/[A] DiDRothPretrends.R · reads 2 input files 7. [A] DiDRothPretrends.R ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R · 1 estimation 8. [A] DiDGoodmanBaconDecomp.R 1 est.ReplicationCodeImputed/R/[P] DiDMapYearLawPassed.R · reads 1 input files 9. [P] DiDMapYearLawPassed.R ReplicationCodeImputed/R/[S] RDTables.R 10. [S] RDTables.R ReplicationCodeImputed/Stata/[M] MasterOpioid.do 11. [M] MasterOpioid.do ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do · 4 estimations 12. [D] DataPreparationsCorrelationsIV.do 4 est.ReplicationCodeImputed/Stata/[S] SummaryStatisticsGeneral.do · 4 estimations 13. [S] SummaryStatisticsGeneral.do 4 est.ReplicationCodeImputed/Stata/[R] CorrelationsOpioidAbuseHomeValues.do · 3 estimations 14. [R] CorrelationsOpioidAbuseHomeValues.do 3 est.ReplicationCodeImputed/Stata/[R] IVRegresions.do · 12 estimations 15. [R] IVRegresions.do 12 est.ReplicationCodeImputed/Stata/[D] DataPreparationsDiD.do · 3 estimations 16. [D] DataPreparationsDiD.do 3 est.ReplicationCodeImputed/Stata/[S] SummaryStatisticsDiD.do · 3 estimations 17. [S] SummaryStatisticsDiD.do 3 est.ReplicationCodeImputed/Stata/[R] StateLawDiDSunAbrahm.do · 1 estimation 18. [R] StateLawDiDSunAbrahm.do 1 est.ReplicationCodeImputed/Stata/[R] StateLawDiDInteractions.do · 1 estimation 19. [R] StateLawDiDInteractions.do 1 est.ReplicationCodeImputed/Stata/[R] StateLawDiDSunAbrahmHomeValueAdditional.do · 1 estimation 20. [R] StateLawDiDSunAbrahmHomeValueAdditional… 1 est.ReplicationCodeImputed/Stata/[R] StateLawPredictors.do · 4 estimations 21. [R] StateLawPredictors.do 4 est.ReplicationCodeImputed/Stata/[D] DataPreparationsStateLawRD.do · 1 estimation 22. [D] DataPreparationsStateLawRD.do 1 est.ReplicationCodeImputed/Stata/[R] StateLawRD.do · 2 estimations 23. [R] StateLawRD.do 2 est.ReplicationCodeImputed/Stata/[R] StateLawRDPriorDensity.do · 6 estimations 24. [R] StateLawRDPriorDensity.do 6 est.
  1. 1.ReplicationCodeImputed/R/CreateLatexTableContentRowsOnly.R setup file sourced by 2 scripts
  2. 2.ReplicationCodeImputed/R/[M] OpioidMasterFileR.R master script
  3. 3.ReplicationCodeImputed/R/[D] CreateOpioidMaster.R run by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 21 reads 22 input files · 30 merges · 1 estimation
    writes OpioidMaster.csv → read by [P] CorrelationMap.R, [A] DiDGoodmanBaconDecomp.R, [D] DataPreparationsCorrelationsIV.do, [D] DataPreparationsDiD.do, [D] DataPreparationsStateLawRD.do
  4. 4.ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R run by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 23 reads 13 input files · 12 merges ·
    writes StateLawPredictorDataset.csv → read by [R] StateLawPredictors.do
  5. 5.ReplicationCodeImputed/R/[P] CorrelationMap.R run by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 31
    reads what [D] CreateOpioidMaster.R wrote
  6. 6.ReplicationCodeImputed/R/[S] DiDPlotSunAbraham.R run by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 34
    reads what [R] StateLawDiDSunAbrahm.do wrote
  7. 7.ReplicationCodeImputed/R/[A] DiDRothPretrends.R run by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 36 reads 2 input files ·
  8. 8.ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R run by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 38 1 merge · 1 estimation
    reads what [D] CreateOpioidMaster.R wrote
  9. 9.ReplicationCodeImputed/R/[P] DiDMapYearLawPassed.R run by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 40 reads 1 input file · 2 merges ·
  10. 10.ReplicationCodeImputed/R/[S] RDTables.R run by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 43
    reads what [R] StateLawRD.do wrote
  11. 11.ReplicationCodeImputed/Stata/[M] MasterOpioid.do master script
  12. 12.ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do run by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 22 4 estimations
    reads what [D] CreateOpioidMaster.R wrote
  13. 13.ReplicationCodeImputed/Stata/[S] SummaryStatisticsGeneral.do run by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 25 4 estimations
  14. 14.ReplicationCodeImputed/Stata/[R] CorrelationsOpioidAbuseHomeValues.do run by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 28 3 estimations
  15. 15.ReplicationCodeImputed/Stata/[R] IVRegresions.do run by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 31 12 estimations
  16. 16.ReplicationCodeImputed/Stata/[D] DataPreparationsDiD.do run by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 37 3 estimations
    reads what [D] CreateOpioidMaster.R wrote
  17. 17.ReplicationCodeImputed/Stata/[S] SummaryStatisticsDiD.do run by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 40 3 estimations
  18. 18.ReplicationCodeImputed/Stata/[R] StateLawDiDSunAbrahm.do run by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 43 1 estimation
    writes LawRegDiDSunAbrahamLowAbuse.csv → read by [S] DiDPlotSunAbraham.R
    writes LawRegDiDSunAbrahamMain.csv → read by [S] DiDPlotSunAbraham.R
  19. 19.ReplicationCodeImputed/Stata/[R] StateLawDiDInteractions.do run by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 46 1 estimation
  20. 20.ReplicationCodeImputed/Stata/[R] StateLawDiDSunAbrahmHomeValueAdditional.do run by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 49 1 estimation
  21. 21.ReplicationCodeImputed/Stata/[R] StateLawPredictors.do run by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 53 4 estimations
    reads what [D] DiDStateLawPredictor.R wrote
  22. 22.ReplicationCodeImputed/Stata/[D] DataPreparationsStateLawRD.do run by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 59 1 estimation
    reads what [D] CreateOpioidMaster.R wrote
  23. 23.ReplicationCodeImputed/Stata/[R] StateLawRD.do run by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 62 2 estimations
    writes RDCoefficientsMainSpecs.csv → read by [S] RDTables.R
    writes RDCoefficientsPillMills.csv → read by [S] RDTables.R
  24. 24.ReplicationCodeImputed/Stata/[R] StateLawRDPriorDensity.do run by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 65 6 estimations

3 · Merges — 45 joins, 0 followed by a check of the merge result

JoinsHowOn keysCheck that followsWhere
USCensus ← BureauLS join (outer) CountyFIPS YEAR none
[D] CreateOpioidMaster.R:35
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 35 OpioidMaster = full_join(USCensus, BureauLS, by = c("CountyFIPS", "YEAR"))
OpioidMaster ← HomeValue join (outer) CountyFIPS YEAR none
[D] CreateOpioidMaster.R:39
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 39 OpioidMaster = full_join(OpioidMaster, HomeValue, by = c("CountyFIPS", "YEAR"))
OpioidMaster ← Opioid join (outer) CountyFIPS YEAR none
[D] CreateOpioidMaster.R:42
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 42 OpioidMaster = full_join(OpioidMaster, Opioid[, c("CountyFIPS", "YEAR", "PrescriptionRate")], by = c("CountyFIPS", "YEAR"))
OpioidMaster ← Physicians join (left) CountyFIPS YEAR none
[D] CreateOpioidMaster.R:45
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 45 OpioidMaster = left_join(OpioidMaster, Physicians, by = c("CountyFIPS", "YEAR"))
OpioidMaster ← Mortgages join (left) CountyFIPS YEAR none
[D] CreateOpioidMaster.R:48
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 48 OpioidMaster = left_join(OpioidMaster, Mortgages[, c("CountyFIPS", "YEAR", "PercMortgages90PlusDaysPast")], by = c("CountyFIPS", "YEAR"))
OpioidMaster ← HMDA join (left) CountyFIPS YEAR none
[D] CreateOpioidMaster.R:53
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 53 OpioidMaster = left_join(OpioidMaster, HMDA, by = c("CountyFIPS", "YEAR"))
OpioidMaster ← PillMills join (left) CountyFIPS none
[D] CreateOpioidMaster.R:56
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 56 OpioidMaster = left_join(OpioidMaster, PillMills[, c("CountyFIPS", "N_pillMills")], by = c("CountyFIPS"))
OpioidMaster ← drugsFull join (left) CountyFIPS YEAR none
[D] CreateOpioidMaster.R:59
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 59 OpioidMaster = left_join(OpioidMaster, drugsFull, by = c("CountyFIPS", "YEAR"))
OpioidMaster ← CountyInflow join (left) CountyFIPS YEAR none
[D] CreateOpioidMaster.R:67
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 67 OpioidMaster = left_join(OpioidMaster, CountyInflow, by = c("CountyFIPS", "YEAR"))
OpioidMaster ← ACSHousing join (left) CountyFIPS YEAR none
[D] CreateOpioidMaster.R:70
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 70 OpioidMaster = left_join(OpioidMaster, ACSHousing, by = c("CountyFIPS", "YEAR"))
OpioidMaster ← PurdueIV join (left) CountyFIPS none
[D] CreateOpioidMaster.R:73
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 73 OpioidMaster = left_join(OpioidMaster, PurdueIV[, c("CountyFIPS", "PIVYr1997", "PIVYr2004")], by = c("CountyFIPS"))
OpioidMaster ← SupplyChainIV join (left) CountyFIPS YEAR none
[D] CreateOpioidMaster.R:75
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 75 OpioidMaster = left_join(OpioidMaster, SupplyChainIV, by = c("CountyFIPS", "YEAR"))

4 · The sample — 4 keep/drop steps, 38 variables winsorized or trimmed

Filters, by kind
time period ×2
  • drop if year < 2013
    [D] DataPreparationsDiD.do:176
    ReplicationCodeImputed/Stata/[D] DataPreparationsDiD.do, line 176 drop if year < 2013
  • keep if lawpassaget0 == 1 | treat == 0 & year == 2016
    [D] DataPreparationsStateLawRD.do:73
    ReplicationCodeImputed/Stata/[D] DataPreparationsStateLawRD.do, line 73 keep if lawpassaget0 == 1 | treat == 0 & year == 2016
value ranges ×1
  • drop if n_pillmills > `m`M''
    [R] StateLawRD.do:77
    ReplicationCodeImputed/Stata/[R] StateLawRD.do, line 77 drop if n_pillmills > `m`M''
missing values ×1
  • keep if !missing(TreatYear)
    [S] SummaryStatisticsDiD.do:34
    ReplicationCodeImputed/Stata/[S] SummaryStatisticsDiD.do, line 34 keep if !missing(TreatYear)
Outliers
winsorize at 2/98 · 38 variables
l_logtotpop l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate l_laborpartrate +26
[D] DataPreparationsStateLawRD.do:70
ReplicationCodeImputed/Stata/[D] DataPreparationsStateLawRD.do, line 70 winsor2 /*Market Controls: */ l_logtotpop l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate l_laborpartrate l_neoplasmsrate l_physicians, cuts( …
[D] DataPreparationsCorrelationsIV.do:94
ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 94 winsor2 LogPC_HomeValue3YR LogPC_HomeValue4YR LogPC_HomeValue5YR , cuts(2 98) replace
[D] DataPreparationsCorrelationsIV.do:96
ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 96 winsor2 L1maleratio L1whiteratio L1blackratio L1iaratio L1hispanicratio L1age20t64ratio L1age65pratio L1miginflowratio L1povertyratio L1unemploymnentrate L1laborpartrate L1neoplasmsrate L1physicians, cuts(2 98)
[D] DataPreparationsDiD.do:78
ReplicationCodeImputed/Stata/[D] DataPreparationsDiD.do, line 78 winsor2 Difdth_opioid_rate Difdth_illicid_rate Difdth_prescription_rate, cuts(2 98)
Missing values
filled with a value ×11
  • STATE
    [D] CreateOpioidMaster.R:28
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 28 USCensus = USCensus %>% group_by(CountyFIPS) %>% fill(STATE, COUNTY, STNAME, CTYNAME, .direction = "updown")
  • County
    [D] CreateOpioidMaster.R:111
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 111 OpioidMaster = OpioidMaster %>% group_by(CountyFIPS) %>% fill(County, .direction = "updown")
  • State
    [D] CreateOpioidMaster.R:114
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 114 OpioidMaster = OpioidMaster %>% group_by(StateFIPS) %>% fill(State, .direction = "updown")
  • Post
    [D] CreateOpioidMaster.R:195
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 195 OpioidMaster = OpioidMaster %>% group_by(CountyFIPS) %>% fill(Post, .direction = "down")
  • StateFIPS → substr(OpioidMaster$CountyFIPS, 1, 2)[is.na(OpioidMaster$Sta
    [D] CreateOpioidMaster.R:112
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 112 OpioidMaster$StateFIPS[is.na(OpioidMaster$StateFIPS)] = substr(OpioidMaster$CountyFIPS, 1, 2)[is.na(OpioidMaster$StateFIPS)]
  • BorderDis → -DisFinal$BorderDisControl[is.na(DisFinal$BorderDis)]
    [D] CreateOpioidMaster.R:243
    ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 243 DisFinal$BorderDis[is.na(DisFinal$BorderDis)] = -DisFinal$BorderDisControl[is.na(DisFinal$BorderDis)]
common sample across variables (listwise) ×6
  • [S] SummaryStatisticsDiD.do:8
    ReplicationCodeImputed/Stata/[S] SummaryStatisticsDiD.do, line 8 gen DID_homevalue = e(sample)
  • [S] SummaryStatisticsDiD.do:10
    ReplicationCodeImputed/Stata/[S] SummaryStatisticsDiD.do, line 10 gen DID_death = e(sample)
  • [S] SummaryStatisticsDiD.do:12
    ReplicationCodeImputed/Stata/[S] SummaryStatisticsDiD.do, line 12 gen DID_pres = e(sample)
  • [R] CorrelationsOpioidAbuseHomeValues.do:38
    ReplicationCodeImputed/Stata/[R] CorrelationsOpioidAbuseHomeValues.do, line 38 keep if e(sample) == 1
  • [R] CorrelationsOpioidAbuseHomeValues.do:40
    ReplicationCodeImputed/Stata/[R] CorrelationsOpioidAbuseHomeValues.do, line 40 keep if e(sample) == 1
  • [D] DataPreparationsDiD.do:120
    ReplicationCodeImputed/Stata/[D] DataPreparationsDiD.do, line 120 gen insample = e(sample)
dropped ×1
  • [S] SummaryStatisticsDiD.do:34
    ReplicationCodeImputed/Stata/[S] SummaryStatisticsDiD.do, line 34 keep if !missing(TreatYear)
set to zero ×1
  • LawPassed → 0
    [D] DiDStateLawPredictor.R:97
    ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 97 LawPassage$LawPassed[is.na(LawPassage$LawPassed)] = 0

5 · Key variables — what enters the models, and where the code builds it

VariableUsed in models asBuilt by
LogPC_HomeValue5YR outcome in 6
LogPC_HomeValue5YR = log(F4.avghomevalue / L.avghomevalue) * 100 (gen)
[D] DataPreparationsCorrelationsIV.do:88
ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 88 generate LogPC_HomeValue5YR = log(F4.avghomevalue / L.avghomevalue) * 100
prescriptionrate outcome in 6 no statement builds it — a column of an input file, or made by a reshape/merge we do not trace
absprescriptions outcome in 5 no statement builds it — a column of an input file, or made by a reshape/merge we do not trace
L1d_o_rate outcome in 3, endogenous in 3
L1d_o_rate = L1dth_opioid_rate (gen)
[R] IVRegresions.do:8
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 8 gen L1d_o_rate = L1dth_opioid_rate
L1presr_pm8r outcome in 3, endogenous in 3
L1presr_pm8r = L1prescriptionrate_pm8_r (gen)
[R] IVRegresions.do:6
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 6 gen L1presr_pm8r = L1prescriptionrate_pm8_r
lawpassed outcome in 4 no statement builds it — a column of an input file, or made by a reshape/merge we do not trace
PC_avghomevalue outcome in 3 no statement builds it — a column of an input file, or made by a reshape/merge we do not trace
YR2015Dif1_dth_opioid_rate outcome in 2 no statement builds it — a column of an input file, or made by a reshape/merge we do not trace
YR2015Dif1_presrate_pm8_r outcome in 2
YR2015Dif1_presrate_pm8_r = Dif1_prescriptionrate_pm8_r (gen)
[D] DataPreparationsStateLawRD.do:65
ReplicationCodeImputed/Stata/[D] DataPreparationsStateLawRD.do, line 65 gen YR2015Dif1_presrate_pm8_r = Dif1_prescriptionrate_pm8_r if year == 2015
YR2015Dif1_presrate_pm8_r = YR2015Dif1_presrate_pm8_r[_n-1] (replace)
[D] DataPreparationsStateLawRD.do:66
ReplicationCodeImputed/Stata/[D] DataPreparationsStateLawRD.do, line 66 bysort countyfips (YR2015Dif1_presrate_pm8_r) : replace YR2015Dif1_presrate_pm8_r = YR2015Dif1_presrate_pm8_r[_n-1] if missing(YR2015Dif1_presrate_pm8_r)
AbsPrescriptions outcome in 1
AbsPrescriptions = OpioidMaster$PrescriptionRate*OpioidMaster$TOT_POP/100 (assign)
[D] CreateOpioidMaster.R:122
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 122 OpioidMaster$AbsPrescriptions = OpioidMaster$PrescriptionRate*OpioidMaster$TOT_POP/100
COCPOSS_PC0913 outcome in 1 no statement builds it — a column of an input file, or made by a reshape/merge we do not trace
Difdth_opioid_rate outcome in 1
Difdth_opioid_rate = df$dth_opioid_rate - df$l_dth_opioid_rate (assign)
[A] DiDGoodmanBaconDecomp.R:49
ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 49 df$Difdth_opioid_rate = df$dth_opioid_rate - df$l_dth_opioid_rate
Difdth_opioid_rate = dth_opioid_rate - L1dth_opioid_rate (gen)
[D] DataPreparationsCorrelationsIV.do:75
ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 75 gen Difdth_opioid_rate = dth_opioid_rate - L1dth_opioid_rate
prescriptionrate_pm8_r outcome in 1
prescriptionrate_pm8_r = prescriptionrate - yhat (gen)
[D] DataPreparationsCorrelationsIV.do:29
ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 29 gen prescriptionrate_pm8_r = prescriptionrate - yhat
prescriptionrate_pm8_r = prescriptionrate - yhat_rate (gen)
[D] DataPreparationsDiD.do:95
ReplicationCodeImputed/Stata/[D] DataPreparationsDiD.do, line 95 gen prescriptionrate_pm8_r = prescriptionrate - yhat_rate
prescriptionrate_pm8_r = prescriptionrate - yhat_rate (gen)
[D] DataPreparationsStateLawRD.do:18
ReplicationCodeImputed/Stata/[D] DataPreparationsStateLawRD.do, line 18 gen prescriptionrate_pm8_r = prescriptionrate - yhat_rate
L1sup instrument in 4, regressor in 4
L1sup = L1supplychainivmmepercapita (rename)
[D] DataPreparationsCorrelationsIV.do:56
ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 56 rename L1supplychainivmmepercapita L1sup
pivchg9704 instrument in 2, regressor in 2
pivchg9704 = (pivyr2004 - pivyr1997) / pivyr1997 (gen)
[D] DataPreparationsCorrelationsIV.do:51
ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 51 gen pivchg9704 = (pivyr2004 - pivyr1997) / pivyr1997

6 · Models, by the table or figure they feed — 47 estimations, 0 traced into 0 exhibits

Estimations not traced to a table or figure · 47
CommandOutcomeRegressors Fixed effectsStandard errorsWhere
lm
ols
COCPOSS_PC0913 Avg0913MaleRatio Avg0913WhiteRatio Avg0913BlackRatio Avg0913IARatio Avg0913HispanicRatio Avg0913Age20t64ratio Avg0913Age65pratio Avg0913UnemploymentRate Avg0913LogHHIncome PopDensity DemocraticGovernorShare0913 — default
[D] CreateOpioidMaster.R:160
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 160 model <- lm(COCPOSS_PC0913 ~ Avg0913MaleRatio + Avg0913WhiteRatio + Avg0913BlackRatio + Avg0913IARatio + Avg0913HispanicRatio + Avg0913Age20t64ratio + Avg0913Age65pratio + Avg0913UnemploymentRate + Avg0913LogHHIncome + PopDens …
lm
ols
AbsPrescriptions cancercount medicarehospicecount medicareambulatorysurgerycount LogTotPop YEARFactor — default
[A] DiDGoodmanBaconDecomp.R:32
ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 32 reg_ap_pm8 = lm(AbsPrescriptions ~ cancercount + medicarehospicecount + medicareambulatorysurgerycount + LogTotPop + YEARFactor, data = subset_resid[which(subset_resid$N_pillMills < 8), ])
reghdfe
panel fe
prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct year default
[D] DataPreparationsCorrelationsIV.do:23
ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 23 reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct, absorb(year) residuals(prescriptionrate_r)
reghdfe
panel fe
prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct year default
[D] DataPreparationsCorrelationsIV.do:27
ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 27 reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct if n_pillmills < 8, absorb(year)
reghdfe
panel fe
absprescriptions cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop year cluster: countyfips
[D] DataPreparationsCorrelationsIV.do:37
ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 37 reghdfe absprescriptions cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop, absorb(year) cluster(countyfips)
reghdfe
panel fe
absprescriptions cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop year cluster: countyfips
[D] DataPreparationsCorrelationsIV.do:43
ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 43 reghdfe absprescriptions cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop if n_pillmills < 8, absorb(year) cluster(countyfips)
reghdfe
panel fe
prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct year default
[S] SummaryStatisticsGeneral.do:25
ReplicationCodeImputed/Stata/[S] SummaryStatisticsGeneral.do, line 25 reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct, absorb(year)
reghdfe
panel fe
prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct year default
[S] SummaryStatisticsGeneral.do:31
ReplicationCodeImputed/Stata/[S] SummaryStatisticsGeneral.do, line 31 reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct if n_pillmills < 8, absorb(year)
reghdfe
panel fe
absprescriptions cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop year cluster: countyfips
[S] SummaryStatisticsGeneral.do:37
ReplicationCodeImputed/Stata/[S] SummaryStatisticsGeneral.do, line 37 reghdfe absprescriptions cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop, absorb(year) cluster(countyfips)
reghdfe
panel fe
absprescriptions cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop year cluster: countyfips
[S] SummaryStatisticsGeneral.do:43
ReplicationCodeImputed/Stata/[S] SummaryStatisticsGeneral.do, line 43 reghdfe absprescriptions cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop if n_pillmills < 8, absorb(year) cluster(countyfips)
reghdfe
panel fe
`y`Y'' ${xvar} L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w +2 more countyfips, year cluster: countyfips
[R] CorrelationsOpioidAbuseHomeValues.do:37
ReplicationCodeImputed/Stata/[R] CorrelationsOpioidAbuseHomeValues.do, line 37 reghdfe `y`Y'' ${xvar} L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physicians_w, a …
reghdfe
panel fe
`y`Y'' ${xvar} L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w +2 more state_year cluster: countyfips
[R] CorrelationsOpioidAbuseHomeValues.do:39
ReplicationCodeImputed/Stata/[R] CorrelationsOpioidAbuseHomeValues.do, line 39 reghdfe `y`Y'' ${xvar} L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physicians_w, a …
reghdfe
panel fe
`y`Y'' ${xvar} L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w +2 more `f`F'' cluster: countyfips
[R] CorrelationsOpioidAbuseHomeValues.do:42
ReplicationCodeImputed/Stata/[R] CorrelationsOpioidAbuseHomeValues.do, line 42 reghdfe `y`Y'' ${xvar} L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physicians_w, a …
ivreghdfe
iv
LogPC_HomeValue5YR L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w +1 more
endogenous: L1presr_pm8r
instruments: pivchg9704
state_year cluster: countyfips
[R] IVRegresions.do:16
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 16 ivreghdfe LogPC_HomeValue5YR L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physician …
reghdfe
panel fe
L1presr_pm8r pivchg9704 L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w +2 more state_year cluster: countyfips
[R] IVRegresions.do:27
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 27 quietly reghdfe L1presr_pm8r pivchg9704 L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w …
ivreghdfe
iv
LogPC_HomeValue5YR L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w +1 more
endogenous: L1d_o_rate
instruments: pivchg9704
state_year cluster: countyfips
[R] IVRegresions.do:31
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 31 ivreghdfe LogPC_HomeValue5YR L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physician …
reghdfe
panel fe
L1d_o_rate pivchg9704 L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w +2 more state_year cluster: countyfips
[R] IVRegresions.do:42
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 42 quietly reghdfe L1d_o_rate pivchg9704 L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1 …
ivreghdfe
iv
LogPC_HomeValue5YR L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w +1 more
endogenous: L1presr_pm8r
instruments: L1sup
countyfips, year cluster: countyfips
[R] IVRegresions.do:64
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 64 ivreghdfe LogPC_HomeValue5YR L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physician …
reghdfe
panel fe
L1presr_pm8r L1sup L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w +2 more state_year cluster: countyfips
[R] IVRegresions.do:79
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 79 quietly reghdfe L1presr_pm8r L1sup L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1phy …
ivreghdfe
iv
LogPC_HomeValue5YR L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w +1 more
endogenous: L1presr_pm8r
instruments: L1sup
state_year cluster: countyfips
[R] IVRegresions.do:83
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 83 ivreghdfe LogPC_HomeValue5YR L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physician …
reghdfe
panel fe
L1presr_pm8r L1sup L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w +2 more state_year cluster: countyfips
[R] IVRegresions.do:98
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 98 quietly reghdfe L1presr_pm8r L1sup L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1phy …
ivreghdfe
iv
LogPC_HomeValue5YR L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w +1 more
endogenous: L1d_o_rate
instruments: L1sup
countyfips, year cluster: countyfips
[R] IVRegresions.do:103
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 103 ivreghdfe LogPC_HomeValue5YR L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physician …
reghdfe
panel fe
L1d_o_rate L1sup L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w +2 more countyfips, year cluster: countyfips
[R] IVRegresions.do:118
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 118 quietly reghdfe L1d_o_rate L1sup L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physi …
ivreghdfe
iv
LogPC_HomeValue5YR L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w +1 more
endogenous: L1d_o_rate
instruments: L1sup
state_year cluster: countyfips
[R] IVRegresions.do:122
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 122 ivreghdfe LogPC_HomeValue5YR L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physician …
reghdfe
panel fe
L1d_o_rate L1sup L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w +2 more state_year cluster: countyfips
[R] IVRegresions.do:137
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 137 quietly reghdfe L1d_o_rate L1sup L1maleratio_w L1whiteratio_w L1blackratio_w L1iaratio_w L1hispanicratio_w L1age20t64ratio_w L1age65pratio_w L1miginflowratio_w L1povertyratio_w L1unemploymnentrate L1laborpartrate_w L1neoplasmsrate_w L1physi …
reghdfe
panel fe
prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct year default
[D] DataPreparationsDiD.do:93
ReplicationCodeImputed/Stata/[D] DataPreparationsDiD.do, line 93 reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct if n_pillmills < 8, absorb(year)
reghdfe
panel fe
absprescriptions cancerrate medicarehospicepct medicareambulatorysurgerypct year default
[D] DataPreparationsDiD.do:99
ReplicationCodeImputed/Stata/[D] DataPreparationsDiD.do, line 99 reghdfe absprescriptions cancerrate medicarehospicepct medicareambulatorysurgerypct if n_pillmills < 8, absorb(year)
reghdfe
panel fe
PC_avghomevalue post l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate l_laborpartrate +1 more countyfips, year cluster: statefips
[D] DataPreparationsDiD.do:119
ReplicationCodeImputed/Stata/[D] DataPreparationsDiD.do, line 119 reghdfe PC_avghomevalue post l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate l_laborpartrate l_neoplasmsrate, absorb(countyfips year) vce(clus …
reghdfe
panel fe
PC_avghomevalue post l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate l_laborpartrate +2 more countyfips, year cluster: statefips
[S] SummaryStatisticsDiD.do:7
ReplicationCodeImputed/Stata/[S] SummaryStatisticsDiD.do, line 7 reghdfe PC_avghomevalue post l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate l_laborpartrate l_neoplasmsrate l_physicians, absorb(countyfips y …
reghdfe
panel fe
Difdth_opioid_rate post l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate l_laborpartrate +2 more countyfips, year cluster: statefips
[S] SummaryStatisticsDiD.do:9
ReplicationCodeImputed/Stata/[S] SummaryStatisticsDiD.do, line 9 reghdfe Difdth_opioid_rate post l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate l_laborpartrate l_neoplasmsrate l_physicians, absorb(countyfip …
reghdfe
panel fe
prescriptionrate_pm8_r post l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate l_laborpartrate +2 more countyfips, year cluster: statefips
[S] SummaryStatisticsDiD.do:11
ReplicationCodeImputed/Stata/[S] SummaryStatisticsDiD.do, line 11 reghdfe prescriptionrate_pm8_r post l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate l_laborpartrate l_neoplasmsrate l_physicians, absorb(count …
reghdfe
panel fe
`y`Y'' `x`X'' countyfips, year cluster: statefips
[R] StateLawDiDSunAbrahm.do:76
ReplicationCodeImputed/Stata/[R] StateLawDiDSunAbrahm.do, line 76 reghdfe `y`Y'' `x`X'', absorb(countyfips year) vce(cluster statefips)
reghdfe
panel fe
`y`Y'' `x`X'' l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate l_laborpartrate +2 more countyfips, year cluster: statefips
[R] StateLawDiDInteractions.do:40
ReplicationCodeImputed/Stata/[R] StateLawDiDInteractions.do, line 40 reghdfe `y`Y'' `x`X'' l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age65pratio l_miginflowratio l_povertyratio l_unemploymnentrate l_laborpartrate l_neoplasmsrate l_physicians, absorb(countyfips year) vc …
eventstudyinteract
did
PC_avghomevalue L*event F*event countyfips, year cluster: statefips
[R] StateLawDiDSunAbrahmHomeValueAdditional.do:5
ReplicationCodeImputed/Stata/[R] StateLawDiDSunAbrahmHomeValueAdditional.do, line 5 eventstudyinteract PC_avghomevalue L*event F*event, vce(cluster statefips) absorb(countyfips year) cohort(TreatYear) control_cohort(lastcohort) covariates(l_maleratio l_whiteratio l_blackratio l_iaratio l_hispanicratio l_age20t64ratio l_age …
reghdfe
panel fe
lawpassed avgprescriptionrate ageadjustedoverdosedeathrate — robust
[R] StateLawPredictors.do:24
ReplicationCodeImputed/Stata/[R] StateLawPredictors.do, line 24 reghdfe lawpassed avgprescriptionrate ageadjustedoverdosedeathrate, noabsorb vce(robust)
reghdfe
panel fe
lawpassed avgprescriptionrate ageadjustedoverdosedeathrate unemploymentrate logmhi povertyratio loggdppercapita violent_crime_rate property_crime_rate lnpolicerelperc lnchildwelfaresperc — robust
[R] StateLawPredictors.do:26
ReplicationCodeImputed/Stata/[R] StateLawPredictors.do, line 26 reghdfe lawpassed avgprescriptionrate ageadjustedoverdosedeathrate unemploymentrate logmhi povertyratio loggdppercapita violent_crime_rate property_crime_rate lnpolicerelperc lnchildwelfaresperc, noabsorb vce(robust)
reghdfe
panel fe
lawpassed avgprescriptionrate ageadjustedoverdosedeathrate democratic republican — robust
[R] StateLawPredictors.do:28
ReplicationCodeImputed/Stata/[R] StateLawPredictors.do, line 28 reghdfe lawpassed avgprescriptionrate ageadjustedoverdosedeathrate democratic republican, noabsorb vce(robust)
reghdfe
panel fe
lawpassed avgprescriptionrate ageadjustedoverdosedeathrate unemploymentrate logmhi povertyratio loggdppercapita violent_crime_rate property_crime_rate lnpolicerelperc lnchildwelfaresperc democratic republican — robust
[R] StateLawPredictors.do:30
ReplicationCodeImputed/Stata/[R] StateLawPredictors.do, line 30 reghdfe lawpassed avgprescriptionrate ageadjustedoverdosedeathrate unemploymentrate logmhi povertyratio loggdppercapita violent_crime_rate property_crime_rate lnpolicerelperc lnchildwelfaresperc democratic republican, noabsorb vce(robust)
reghdfe
panel fe
prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct year default
[D] DataPreparationsStateLawRD.do:16
ReplicationCodeImputed/Stata/[D] DataPreparationsStateLawRD.do, line 16 reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct if n_pillmills < 8, absorb(year)
rdrobust
rd
`y`Y'' borderdis — robust
[R] StateLawRD.do:78
ReplicationCodeImputed/Stata/[R] StateLawRD.do, line 78 rdrobust `y`Y'' borderdis, covs(`x`X'') vce(hc0) p(`p`P'') `h`H''
Tables and figures the code writes: ChannelHousingDynamics.tex
[S] SummaryStatisticsDiD.do:27
ReplicationCodeImputed/Stata/[S] SummaryStatisticsDiD.do, line 27 esttab HDynamnicsSS using "${esttab_directory}/01Descriptives/ChannelHousingDynamics.tex", replace cells("count(fmt(0)) min(fmt(3)) p25(fmt(3)) p50(fmt(3)) p75(fmt(3)) max(fmt(3)) mean(fmt(3)) sd(fmt(3))") booktabs compress l wrap fragment …
· ChannelMigration.tex
[S] SummaryStatisticsDiD.do:30
ReplicationCodeImputed/Stata/[S] SummaryStatisticsDiD.do, line 30 esttab MigrationSS using "${esttab_directory}/01Descriptives/ChannelMigration.tex", replace cells("count(fmt(0)) min(fmt(3)) p25(fmt(3)) p50(fmt(3)) p75(fmt(3)) max(fmt(3)) mean(fmt(3)) sd(fmt(3))") booktabs compress l wrap fragment varwid …
· CorrHVOn`XChoice'R`RChoice'.tex
[R] CorrelationsOpioidAbuseHomeValues.do:57
ReplicationCodeImputed/Stata/[R] CorrelationsOpioidAbuseHomeValues.do, line 57 esttab Tab_y1f1 Tab_y2f1 Tab_y3f1 Tab_y1f2 Tab_y2f2 Tab_y3f2 using ${esttab_directory}/02Correlations/CorrHVOn`XChoice'R`RChoice'.tex, replace substitute("\_" "_")
· CorrHVOn`XChoice'R`RChoice'NoSD.tex
[R] CorrelationsOpioidAbuseHomeValues.do:69
ReplicationCodeImputed/Stata/[R] CorrelationsOpioidAbuseHomeValues.do, line 69 esttab Tab_y1f1 Tab_y2f1 Tab_y3f1 Tab_y1f2 Tab_y2f2 Tab_y3f2 using ${esttab_directory}/02Correlations/CorrHVOn`XChoice'R`RChoice'NoSD.tex, replace substitute("\_" "_")
· DiDCounts.tex
[S] SummaryStatisticsDiD.do:49
ReplicationCodeImputed/Stata/[S] SummaryStatisticsDiD.do, line 49 esttab DIDcounts using "${esttab_directory}/01Descriptives/DiDCounts.tex", replace cells("DID_homevalue_state DID_homevalue_county DID_death_state DID_death_county DID_pres_state DID_pres_county") booktabs compress l wrap fragment varwidth …
· HomeValueMeasures.tex
[S] SummaryStatisticsGeneral.do:21
ReplicationCodeImputed/Stata/[S] SummaryStatisticsGeneral.do, line 21 esttab HomeValueSS using "${esttab_directory}/01Descriptives/HomeValueMeasures.tex", replace cells("count(fmt(0)) min(fmt(3)) p25(fmt(3)) p50(fmt(3)) p75(fmt(3)) max(fmt(3)) mean(fmt(3)) sd(fmt(3))") booktabs compress l wrap fragment varwi …
· IVPurdue.tex
[R] IVRegresions.do:47
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 47 esttab S1_ResPres* S2_ResPres S1_OpioidDR* S2_OpioidDR using ${esttab_directory}/05IVs/IVPurdue.tex, replace
· IVSupplyChain.tex
[R] IVRegresions.do:142
ReplicationCodeImputed/Stata/[R] IVRegresions.do, line 142 esttab S1_ResPres_cy* S2_ResPres_cy S1_ResPres_sxy* S2_ResPres_sxy S1_OpioidDR_cy* S2_OpioidDR_cy S1_OpioidDR_sxy* S2_OpioidDR_sxy using ${esttab_directory}/05IVs/IVSupplyChain.tex, replace
· LawDiDX`XChoice'.tex
[R] StateLawDiDInteractions.do:52
ReplicationCodeImputed/Stata/[R] StateLawDiDInteractions.do, line 52 esttab Tab_y1x1 Tab_y1x2 Tab_y2x1 Tab_y2x2 Tab_y3x1 Tab_y3x2 using ${esttab_directory}/03DiDStateLaws/LawDiDX`XChoice'.tex, replace
· OpioidAbuseMeasures.tex
[S] SummaryStatisticsGeneral.do:11
ReplicationCodeImputed/Stata/[S] SummaryStatisticsGeneral.do, line 11 esttab OpioidSS using "${esttab_directory}/01Descriptives/OpioidAbuseMeasures.tex", replace cells("count(fmt(0)) min(fmt(3)) p25(fmt(3)) p50(fmt(3)) p75(fmt(3)) max(fmt(3)) mean(fmt(3)) sd(fmt(3))") booktabs compress l wrap fragment varwid …
· PrescriptionLegitimateDrivers.tex
[S] SummaryStatisticsGeneral.do:58
ReplicationCodeImputed/Stata/[S] SummaryStatisticsGeneral.do, line 58 esttab Tab_pr Tab_ap Tab_pr_pm8 Tab_ap_pm8 using "${esttab_directory}/01Descriptives/PrescriptionLegitimateDrivers.tex", replace
· StateLawPassagePredictor.tex
[R] StateLawPredictors.do:36
ReplicationCodeImputed/Stata/[R] StateLawPredictors.do, line 36 esttab Tab_1 Tab_2 Tab_3 Tab_4 using ${esttab_directory}/03DiDStateLaws/StateLawPassagePredictor.tex, replace
· RDdis`y`Y''`xx`X''Poly`p`P''`hh`H''PillD`m`M''.pdf
[R] StateLawRD.do:94
ReplicationCodeImputed/Stata/[R] StateLawRD.do, line 94 graph export ${gph_directory}/04RDStateLaws/RDdis`y`Y''`xx`X''Poly`p`P''`hh`H''PillD`m`M''.pdf, replace
· RDPreControls`yvar'.pdf
[R] StateLawRDPriorDensity.do:21
ReplicationCodeImputed/Stata/[R] StateLawRDPriorDensity.do, line 21 graph export ${gph_directory}/04RDStateLaws/RDPreControls`yvar'.pdf, replace
· RDPreControlsYR2015Dif1_dth_opioid_rate.pdf
[R] StateLawRDPriorDensity.do:38
ReplicationCodeImputed/Stata/[R] StateLawRDPriorDensity.do, line 38 graph export ${gph_directory}/04RDStateLaws/RDPreControlsYR2015Dif1_dth_opioid_rate.pdf, replace

7 · Figures: how each is drawn — 12 figures in the code (command, layers, options, the file it is saved to)

scatter 5 · RD plot 4 · map 2 · event-study plot 1
commandlayersvariables optionssaved aswhere
ggplot
scatter
point + hline y estimate x weight by type xtitle Weight · ytitle Percentage Change \n Average Home Value (in %) · yline 0 · scheme theme_light · legend position=bottom not saved
[A] DiDGoodmanBaconDecomp.R:74
ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 74 plot = ggplot(df_bacon_conexist) +
–80
ggplot
scatter
point + hline y estimate x weight by type xtitle Weight · ytitle Opioid Death Rate · yline 0 · scheme theme_light · legend position=bottom not saved
[A] DiDGoodmanBaconDecomp.R:92
ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 92 plot = ggplot(df_bacon_conexist) +
–98
ggplot
scatter
point + hline y estimate x weight by type xtitle Weight · ytitle Prescriptions Death Rate · yline 0 · scheme theme_light · legend position=bottom not saved
[A] DiDGoodmanBaconDecomp.R:110
ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 110 plot = ggplot(df_bacon_conexist) +
–116
ggplot
scatter
point + hline y estimate x weight by type xtitle Weight · ytitle 1-Year Difference \n Opioid Death Rate · yline 0 · scheme theme_light · legend position=bottom not saved
[A] DiDGoodmanBaconDecomp.R:128
ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 128 plot = ggplot(df_bacon_conexist) +
–134
ggplot
scatter
point + hline y estimate x weight by type xtitle Weight · ytitle Residualised \n Total Prescriptions · yline 0 · scheme theme_light · legend position=bottom not saved
[A] DiDGoodmanBaconDecomp.R:146
ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 146 plot = ggplot(df_bacon_conexist) +
–152
plot_usmap
map
map not saved
[P] CorrelationMap.R:65
ReplicationCodeImputed/R/[P] CorrelationMap.R, line 65 map_plot = plot_usmap(data = OpioidMaster, values = "PC_HV_Quantile", linewidth = 0.2) +
plot_usmap
map
map not saved
[P] DiDMapYearLawPassed.R:52
ReplicationCodeImputed/R/[P] DiDMapYearLawPassed.R, line 52 mapplot = plot_usmap(data = MPStates, values = "TreatYear", labels = TRUE) +
ggplot
event-study plot
hline + point + errorbar + rect y coef x RelativeT band coef-1.96*se, coef+1.96*se by 1 xtitle Relative Year · ytitle Coefficient Estimates · yline 0 · ci geom_errorbar · scheme theme_light not saved
[S] DiDPlotSunAbraham.R:88
ReplicationCodeImputed/R/[S] DiDPlotSunAbraham.R, line 88 plot = ggplot(PlotTable, aes(x=RelativeT, y=coef, group = 1)) + geom_hline(yintercept = 0, color = "grey60") + geom_point(size = 1.8) +
–91
rdplot
RD plot
rdplot y `y`Y'' x borderdis (set at run time) xtitle Treat/Untreated border distance · ytitle `yy`Y'' (set at run time) · legend off · p `p`P'' (set at run time) RDdis`y`Y''`xx`X''Poly`p`P''`hh`H''PillD`m`M''.pdf (set at run time)
[R] StateLawRD.do:90
ReplicationCodeImputed/Stata/[R] StateLawRD.do, line 90 quietly rdplot `y`Y'' borderdis if -e(h_l)<= borderdis & borderdis <= e(h_r), covs(`x`X'') vce(hc0) p(`p`P'') h(`e(h_l)' `e(h_r)') /// graph_options(graphregion(fcolor(white)) plotregion(fcolor(white)) scale(1.6) /// le …
–92
rdplot
RD plot
rdplot y :, word, `Y', of, YR2015povertyratio, YR2015unemploymnentrate, +2 more x borderdis (set at run time) xtitle Treat/Untreated border distance · ytitle `ylab' (set at run time) · legend off · p 1 RDPreControls`yvar'.pdf (set at run time)
[R] StateLawRDPriorDensity.do:18
ReplicationCodeImputed/Stata/[R] StateLawRDPriorDensity.do, line 18 quietly rdplot `yvar' borderdis if -e(h_l)<= borderdis & borderdis <= e(h_r) & avghomevalue ~= . & prescriptionrate_pm8_r ~= ., vce(cluster `c`C'') p(1) h(`e(h_l)' `e(h_r)') /// graph_options(graphregion(fcolor(white)) …
–20
rdplot
RD plot
rdplot y YR2015Dif1_presrate_pm8_r x borderdis xtitle Treat/Untreated border distance · ytitle 2015 1-Year Diff Excess Prescription Rate · legend off · p 1 RDPreControlsYR2015Dif1_presrate_pm8_r.pdf
[R] StateLawRDPriorDensity.do:28
ReplicationCodeImputed/Stata/[R] StateLawRDPriorDensity.do, line 28 quietly rdplot YR2015Dif1_presrate_pm8_r borderdis if -e(h_l)<= borderdis & borderdis <= e(h_r) & avghomevalue ~= . & prescriptionrate_pm8_r ~= ., vce(cluster hc0) p(1) h(`e(h_l)' `e(h_r)') /// graph_options(graphregion …
–30
rdplot
RD plot
rdplot y YR2015Dif1_dth_opioid_rate x borderdis xtitle Treat/Untreated border distance · ytitle 2015 1-Year Diff Opioid Death Rate · legend off · p 1 RDPreControlsYR2015Dif1_dth_opioid_rate.pdf
[R] StateLawRDPriorDensity.do:35
ReplicationCodeImputed/Stata/[R] StateLawRDPriorDensity.do, line 35 quietly rdplot YR2015Dif1_dth_opioid_rate borderdis if -e(h_l)<= borderdis & borderdis <= e(h_r) & avghomevalue ~= . & prescriptionrate_pm8_r ~= ., vce(cluster hc0) p(1) h(`e(h_l)' `e(h_r)') /// graph_options(graphregio …
–37