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
| Command | Method | Fixed effects absorbed | Inference | File |
|---|---|---|---|---|
|
ols | default | [A] DiDGoodmanBaconDecomp.R | |
|
ols | default | [D] CreateOpioidMaster.R | |
|
panel fe | year | default | [D] DataPreparationsCorrelationsIV.do |
|
panel fe | year | cluster by countyfips | [D] DataPreparationsCorrelationsIV.do |
|
panel fe | year | default | [D] DataPreparationsDiD.do |
|
panel fe | countyfips, year | cluster by statefips | [D] DataPreparationsDiD.do |
|
panel fe | year | default | [D] DataPreparationsStateLawRD.do |
|
panel fe | countyfips, year | cluster by countyfips | [R] CorrelationsOpioidAbuseHomeValues.do |
|
panel fe | state_year | cluster by countyfips | [R] CorrelationsOpioidAbuseHomeValues.do |
|
panel fe | `f`F'' | cluster by countyfips | [R] CorrelationsOpioidAbuseHomeValues.do |
|
iv | state_year | cluster by countyfips | [R] IVRegresions.do |
|
panel fe | state_year | cluster by countyfips | [R] IVRegresions.do |
|
iv | countyfips, year | cluster by countyfips | [R] IVRegresions.do |
|
panel fe | countyfips, year | cluster by countyfips | [R] IVRegresions.do |
|
panel fe | countyfips, year | cluster by statefips | [R] StateLawDiDInteractions.do |
|
panel fe | countyfips, year | cluster by statefips | [R] StateLawDiDSunAbrahm.do |
|
did | countyfips, year | cluster by statefips | [R] StateLawDiDSunAbrahmHomeValueAdditional.do |
|
panel fe | robust | [R] StateLawPredictors.do | |
|
rd | robust | [R] StateLawRD.do | |
|
rd | robust | [R] StateLawRDPriorDensity.do | |
|
panel fe | countyfips, year | cluster by statefips | [S] SummaryStatisticsDiD.do |
|
panel fe | year | default | [S] SummaryStatisticsGeneral.do |
|
panel fe | year | 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''.pdfHow 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
HMDA Mortgage Lending
1 file
../data_src/MasterDataSrc/HMDA.csvCSV[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.xlsxExcel · 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.csvCSV · 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.csvCSV · 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.csvCSV[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.csvCSV[D] CreateOpioidMaster.R:55
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 55 PillMills = read_csv("../data_src/MasterDataSrc/ArcosPillMillCounties.csv")../data_src/MasterDataSrc/BLS.csvCSV[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.csvCSV[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.csvCSV[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.csvCSV[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.rdsRDS[D] CreateOpioidMaster.R:224
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 224 cty = readRDS("../data_src/MasterDataSrc/CountyPolygons.rds")../data_src/MasterDataSrc/MedicareSurgeryLongTermCare.csvCSV[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.csvCSV[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.csvCSV[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.csvCSV[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.csvCSV[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.csvCSV[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.csvCSV[D] CreateOpioidMaster.R:96
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 96 pseudo_coverage = read_csv("../data_src/MasterDataSrc/RestrictedAccessDataCoverage.csv")../data_src/MasterDataSrc/StatePolygons.rdsRDS[D] CreateOpioidMaster.R:219
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 219 st = readRDS("../data_src/MasterDataSrc/StatePolygons.rds")../data_src/MasterDataSrc/SupplyChainIV.csvCSV[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.csvCSV[D] CreateOpioidMaster.R:153
ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 153 df_urbanity = read_csv("../data_src/MasterDataSrc/UrbanityInfo.csv")../data_src/MasterDataSrc/ZillowHomeValue.csvCSV[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.csvCSV[D] DiDStateLawPredictor.R:32
ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 32 Overdose2015 = read_csv("../data_src/StateLawPredDataSrc/AgeAdjustedOverdoseDeathRate2015.csv")../data_src/StateLawPredDataSrc/ChildWelfare_statelevel2014.csvCSV[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.csvCSV[D] DiDStateLawPredictor.R:46
ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 46 GDP = read_csv("../data_src/StateLawPredDataSrc/GDPbyState.csv")../data_src/StateLawPredDataSrc/GovtFinances_statelevel.csvCSV[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.xlsxExcel[D] DiDStateLawPredictor.R:38
ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 38 MHI = read_xlsx("../data_src/StateLawPredDataSrc/MedianHouseholdIncome.xlsx")../data_src/StateLawPredDataSrc/OpiodPrescriptionsByState.csvCSV[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.csvCSV[D] DiDStateLawPredictor.R:52
ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 52 Pop = read_csv("../data_src/StateLawPredDataSrc/Population2015.csv")../data_src/StateLawPredDataSrc/PovertyRatio.xlsxExcel[D] DiDStateLawPredictor.R:42
ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 42 Pov = read_xlsx("../data_src/StateLawPredDataSrc/PovertyRatio.xlsx")../data_src/StateLawPredDataSrc/UCR_statelevel.csvCSV[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.xlsxExcel[D] DiDStateLawPredictor.R:35
ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 35 Unemploy = read_xlsx("../data_src/StateLawPredDataSrc/Unemployment2015.xlsx")../esttab/03DiDStateLaws/CoefsDiDPC_avghomevalue.csvCSV[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.csvCSV[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 orderLow-confidence order also: [M] OpioidMasterFileR.R and [M] MasterOpioid.do read each other's files.
-
1.
ReplicationCodeImputed/R/CreateLatexTableContentRowsOnly.Rsetup file sourced by 2 scripts -
2.
ReplicationCodeImputed/R/[M] OpioidMasterFileR.Rmaster script -
3.
ReplicationCodeImputed/R/[D] CreateOpioidMaster.Rrun by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 21 reads 22 input files · 30 merges · 1 estimationwritesOpioidMaster.csv→ read by[P] CorrelationMap.R,[A] DiDGoodmanBaconDecomp.R,[D] DataPreparationsCorrelationsIV.do,[D] DataPreparationsDiD.do,[D] DataPreparationsStateLawRD.do -
4.
ReplicationCodeImputed/R/[D] DiDStateLawPredictor.Rrun by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 23 reads 13 input files · 12 merges ·writesStateLawPredictorDataset.csv→ read by[R] StateLawPredictors.do -
5.
ReplicationCodeImputed/R/[P] CorrelationMap.Rrun by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 31reads what[D] CreateOpioidMaster.Rwrote -
6.
ReplicationCodeImputed/R/[S] DiDPlotSunAbraham.Rrun by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 34reads what[R] StateLawDiDSunAbrahm.dowrote -
7.
ReplicationCodeImputed/R/[A] DiDRothPretrends.Rrun by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 36 reads 2 input files · -
8.
ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.Rrun by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 38 1 merge · 1 estimationreads what[D] CreateOpioidMaster.Rwrote -
9.
ReplicationCodeImputed/R/[P] DiDMapYearLawPassed.Rrun by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 40 reads 1 input file · 2 merges · -
10.
ReplicationCodeImputed/R/[S] RDTables.Rrun by ReplicationCodeImputed/R/[M] OpioidMasterFileR.R line 43reads what[R] StateLawRD.dowrote -
11.
ReplicationCodeImputed/Stata/[M] MasterOpioid.domaster script -
12.
ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.dorun by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 22 4 estimationsreads what[D] CreateOpioidMaster.Rwrote -
13.
ReplicationCodeImputed/Stata/[S] SummaryStatisticsGeneral.dorun by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 25 4 estimations -
14.
ReplicationCodeImputed/Stata/[R] CorrelationsOpioidAbuseHomeValues.dorun by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 28 3 estimations -
15.
ReplicationCodeImputed/Stata/[R] IVRegresions.dorun by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 31 12 estimations -
16.
ReplicationCodeImputed/Stata/[D] DataPreparationsDiD.dorun by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 37 3 estimationsreads what[D] CreateOpioidMaster.Rwrote -
17.
ReplicationCodeImputed/Stata/[S] SummaryStatisticsDiD.dorun by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 40 3 estimations -
18.
ReplicationCodeImputed/Stata/[R] StateLawDiDSunAbrahm.dorun by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 43 1 estimationwritesLawRegDiDSunAbrahamLowAbuse.csv→ read by[S] DiDPlotSunAbraham.RwritesLawRegDiDSunAbrahamMain.csv→ read by[S] DiDPlotSunAbraham.R -
19.
ReplicationCodeImputed/Stata/[R] StateLawDiDInteractions.dorun by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 46 1 estimation -
20.
ReplicationCodeImputed/Stata/[R] StateLawDiDSunAbrahmHomeValueAdditional.dorun by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 49 1 estimation -
21.
ReplicationCodeImputed/Stata/[R] StateLawPredictors.dorun by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 53 4 estimationsreads what[D] DiDStateLawPredictor.Rwrote -
22.
ReplicationCodeImputed/Stata/[D] DataPreparationsStateLawRD.dorun by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 59 1 estimationreads what[D] CreateOpioidMaster.Rwrote -
23.
ReplicationCodeImputed/Stata/[R] StateLawRD.dorun by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 62 2 estimationswritesRDCoefficientsMainSpecs.csv→ read by[S] RDTables.RwritesRDCoefficientsPillMills.csv→ read by[S] RDTables.R -
24.
ReplicationCodeImputed/Stata/[R] StateLawRDPriorDensity.dorun by ReplicationCodeImputed/Stata/[M] MasterOpioid.do line 65 6 estimations
3 · Merges — 45 joins, 0 followed by a check of the merge result
| Joins | How | On keys | Check that follows | Where |
|---|---|---|---|---|
USCensus ← BureauLS |
join (outer) | CountyFIPS YEAR |
none | [D] CreateOpioidMaster.R:35ReplicationCodeImputed/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:39ReplicationCodeImputed/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:42ReplicationCodeImputed/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:45ReplicationCodeImputed/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:48ReplicationCodeImputed/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:53ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 53
OpioidMaster = left_join(OpioidMaster, HMDA, by = c("CountyFIPS", "YEAR")) |
OpioidMaster ← PillMills |
join (left) | CountyFIPS |
none | [D] CreateOpioidMaster.R:56ReplicationCodeImputed/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:59ReplicationCodeImputed/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:67ReplicationCodeImputed/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:70ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 70
OpioidMaster = left_join(OpioidMaster, ACSHousing, by = c("CountyFIPS", "YEAR")) |
OpioidMaster ← PurdueIV |
join (left) | CountyFIPS |
none | [D] CreateOpioidMaster.R:73ReplicationCodeImputed/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:75ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 75
OpioidMaster = left_join(OpioidMaster, SupplyChainIV, by = c("CountyFIPS", "YEAR")) |
OpioidMaster ← MedicareSurgeries |
join (left) | CountyFIPS YEAR |
none | [D] CreateOpioidMaster.R:80ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 80
OpioidMaster = left_join(OpioidMaster, MedicareSurgeries, by = c("CountyFIPS", "YEAR")) |
OpioidMaster ← Neoplasms |
join (left) | CountyFIPS YEAR |
none | [D] CreateOpioidMaster.R:83ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 83
OpioidMaster = left_join(OpioidMaster, Neoplasms, by = c("CountyFIPS", "YEAR")) |
OpioidMaster ← CountyDrugCrime |
join (left) | CountyFIPS |
none | [D] CreateOpioidMaster.R:87ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 87
OpioidMaster = left_join(OpioidMaster, CountyDrugCrime, by = c("CountyFIPS")) |
OpioidMaster ← politics |
join (left) | State=StateName YEAR=Year |
none | [D] CreateOpioidMaster.R:91ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 91
OpioidMaster = left_join(OpioidMaster, politics, by = c("State" = "StateName", "YEAR" = "Year")) |
OpioidMaster ← pseudo_coverage |
join (left) | CountyFIPS YEAR |
none | [D] CreateOpioidMaster.R:97ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 97
OpioidMaster = left_join(OpioidMaster, pseudo_coverage, by = c("CountyFIPS", "YEAR")) |
OpioidMaster ← Avg0913 |
join (left) | CountyFIPS |
none | [D] CreateOpioidMaster.R:131ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 131
OpioidMaster = left_join(OpioidMaster, Avg0913, by = "CountyFIPS") |
OpioidMaster ← Avg1315 |
join (left) | CountyFIPS |
none | [D] CreateOpioidMaster.R:134ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 134
OpioidMaster = left_join(OpioidMaster, Avg1315, by = "CountyFIPS") |
CountyDrugCrime ← Split20092013 |
join (left) | CountyFIPS |
none | [D] CreateOpioidMaster.R:152ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 152
df0913 = left_join(CountyDrugCrime[, c("CountyFIPS", "COCPOSS_PC0913")], Split20092013, by = "CountyFIPS") |
df0913 ← df_urbanity |
join (left) | CountyFIPS=countyfips |
none | [D] CreateOpioidMaster.R:154ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 154
df0913 = left_join(df0913, df_urbanity[, c("countyfips", "land_area_sqm")], by = c("CountyFIPS" = "countyfips")) |
OpioidMaster ← df0913 |
join (left) | CountyFIPS |
none | [D] CreateOpioidMaster.R:164ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 164
OpioidMaster = left_join(OpioidMaster, df0913[, c("CountyFIPS", "COCPOSS_PC0913_r")], by = c("CountyFIPS")) |
Laws ← StateFIPS |
join (left) | — | none | [D] CreateOpioidMaster.R:183ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 183
Laws = left_join(Laws, StateFIPS, c("StateName" = "State")) |
OpioidMaster ← temp |
join (left) | StateFIPS |
none | [D] CreateOpioidMaster.R:190ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 190
OpioidMaster = left_join(OpioidMaster, temp, by = c("StateFIPS")) |
OpioidMaster ← Laws |
join (left) | StateFIPS YEAR=TreatYear |
none | [D] CreateOpioidMaster.R:194ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 194
OpioidMaster = left_join(OpioidMaster, Laws, by = c("StateFIPS", "YEAR" = "TreatYear")) |
OpioidMaster ← Laws |
join (left) | StateFIPS YEAR=TreatYear |
none | [D] CreateOpioidMaster.R:201ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 201
OpioidMaster = left_join(OpioidMaster, Laws, by = c("StateFIPS", "YEAR" = "TreatYear")) |
OpioidMaster ← temp |
join (left) | StateFIPS |
none | [D] CreateOpioidMaster.R:212ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 212
OpioidMaster = left_join(OpioidMaster, temp, by = c("StateFIPS")) |
(data in memory) ← ? |
join (left) | GEOID |
none | [D] CreateOpioidMaster.R:241ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 241
DisFinal = left_join(as.data.frame(CtyPoints), as.data.frame(TreatedCtyPoints)[, colnames(TreatedCtyPoints) %in% c("GEOID", "BorderDis")], by = "GEOID") |
DisFinal ← ? |
join (left) | GEOID |
none | [D] CreateOpioidMaster.R:242ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 242
DisFinal = left_join(DisFinal, as.data.frame(ControlCtyPoints)[, colnames(ControlCtyPoints) %in% c("GEOID", "BorderDisControl")], by = "GEOID") |
OpioidMaster ← DisFinal |
join (left) | CountyFIPS |
none | [D] CreateOpioidMaster.R:249ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 249
OpioidMaster = left_join(OpioidMaster, DisFinal, by = c("CountyFIPS")) |
LawPassage ← StateOpioid |
join (left) | STNAME=State |
none | [D] DiDStateLawPredictor.R:30ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 30
LawPassage = left_join(LawPassage, StateOpioid, by = c("STNAME" = "State")) |
LawPassage ← Overdose2015 |
join (left) | StateFIPS=state_fips |
none | [D] DiDStateLawPredictor.R:33ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 33
LawPassage = left_join(LawPassage, Overdose2015, by = c("StateFIPS" = "state_fips")) |
LawPassage ← Unemploy |
join (left) | STNAME=State |
none | [D] DiDStateLawPredictor.R:36ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 36
LawPassage = left_join(LawPassage, Unemploy[, colnames(Unemploy) %in% c("State", "UnemploymentRate")], by = c("STNAME" = "State")) |
LawPassage ← MHI |
join (left) | STNAME=State |
none | [D] DiDStateLawPredictor.R:40ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 40
LawPassage = left_join(LawPassage, MHI[, colnames(MHI) %in% c("State", "LogMHI")], by = c("STNAME" = "State")) |
LawPassage ← Pov |
join (left) | STNAME=STATE |
none | [D] DiDStateLawPredictor.R:44ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 44
LawPassage = left_join(LawPassage, Pov[, colnames(Pov) %in% c("STATE", "PovertyRatio")], by = c("STNAME" = "STATE")) |
LawPassage ← GDP |
join (left) | STNAME=GeoName |
none | [D] DiDStateLawPredictor.R:50ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 50
LawPassage = left_join(LawPassage, GDP, by = c("STNAME" = "GeoName")) |
LawPassage ← Pop |
join (left) | STNAME=NAME |
none | [D] DiDStateLawPredictor.R:54ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 54
LawPassage = left_join(LawPassage, Pop[, colnames(Pop) %in% c("NAME", "population")], by = c("STNAME" = "NAME")) |
LawPassage ← StateCRIME |
join (left) | StateFIPS |
none | [D] DiDStateLawPredictor.R:58ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 58
LawPassage = left_join(LawPassage, StateCRIME[, colnames(StateCRIME) %in% c("year", "StateFIPS", "violent_crime_rate", "property_crime_rate")], by = c("StateFIPS")) |
LawPassage ← GovFin_df |
join (left) | StateFIPS |
none | [D] DiDStateLawPredictor.R:62ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 62
LawPassage = left_join(LawPassage, GovFin_df[, !colnames(GovFin_df) %in% c("YEAR")], by = c("StateFIPS")) |
LawPassage ← child_df |
join (left) | StateFIPS |
none | [D] DiDStateLawPredictor.R:65ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 65
LawPassage = left_join(LawPassage, child_df[, !colnames(child_df) %in% c("Year")], by = c("StateFIPS")) |
LawPassage ← politics |
join (left) | StateAbbr=StateAbb |
none | [D] DiDStateLawPredictor.R:77ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 77
LawPassage = left_join(LawPassage, politics[, colnames(politics) %in% c("StateAbb", "Democratic", "Republican")], by = c("StateAbbr" = "StateAbb")) |
LawPassage ← Laws |
join (left) | STNAME=StateName |
none | [D] DiDStateLawPredictor.R:96ReplicationCodeImputed/R/[D] DiDStateLawPredictor.R, line 96
LawPassage = left_join(LawPassage, Laws[, colnames(Laws) %in% c("StateName", "LawPassed")], by = c("STNAME" = "StateName")) |
df ← subset_resid |
join (left) | CountyFIPS YEAR |
none | [A] DiDGoodmanBaconDecomp.R:38ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 38
df = left_join(df, subset_resid, by = c("CountyFIPS", "YEAR")) |
Laws ← abb.name |
join (left) | StateName=state.name |
none | [P] DiDMapYearLawPassed.R:39ReplicationCodeImputed/R/[P] DiDMapYearLawPassed.R, line 39
Laws = Laws = left_join(Laws, abb.name, by = c("StateName" = "state.name")) |
MPStates ← Laws |
join (left) | abbr=state.abb |
none | [P] DiDMapYearLawPassed.R:45ReplicationCodeImputed/R/[P] DiDMapYearLawPassed.R, line 45
MPStates = left_join(MPStates, Laws, by = c("abbr" = "state.abb")) |
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
| Variable | Used in models as | Built by |
|---|---|---|
LogPC_HomeValue5YR |
outcome in 6 | LogPC_HomeValue5YR = log(F4.avghomevalue / L.avghomevalue) * 100 (gen) [D] DataPreparationsCorrelationsIV.do:88ReplicationCodeImputed/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:8ReplicationCodeImputed/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:6ReplicationCodeImputed/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:65ReplicationCodeImputed/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:66ReplicationCodeImputed/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:122ReplicationCodeImputed/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:49ReplicationCodeImputed/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:75ReplicationCodeImputed/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:29ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 29
gen prescriptionrate_pm8_r = prescriptionrate - yhat prescriptionrate_pm8_r = prescriptionrate - yhat_rate (gen) [D] DataPreparationsDiD.do:95ReplicationCodeImputed/Stata/[D] DataPreparationsDiD.do, line 95
gen prescriptionrate_pm8_r = prescriptionrate - yhat_rate prescriptionrate_pm8_r = prescriptionrate - yhat_rate (gen) [D] DataPreparationsStateLawRD.do:18ReplicationCodeImputed/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:56ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 56
rename L1supplychainivmmepercapita L1sup |
pivchg9704 |
instrument in 2, regressor in 2 | pivchg9704 = (pivyr2004 - pivyr1997) / pivyr1997 (gen) [D] DataPreparationsCorrelationsIV.do:51ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 51
gen pivchg9704 = (pivyr2004 - pivyr1997) / pivyr1997 |
L1age20t64ratio_w |
regressor in 15 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
L1age65pratio_w |
regressor in 15 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
L1blackratio_w |
regressor in 15 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
L1hispanicratio_w |
regressor in 15 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
L1iaratio_w |
regressor in 15 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
L1laborpartrate_w |
regressor in 15 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
L1maleratio_w |
regressor in 15 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
L1miginflowratio_w |
regressor in 15 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
L1neoplasmsrate_w |
regressor in 15 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
L1physicians_w |
regressor in 15 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
L1povertyratio_w |
regressor in 15 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
L1unemploymnentrate |
regressor in 15 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
L1whiteratio_w |
regressor in 15 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
borderdis |
regressor in 8 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
cancerrate |
regressor in 7 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
medicareambulatorysurgerypct |
regressor in 7 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
medicarehospicepct |
regressor in 7 | no statement builds it — a column of an input file, or made by a reshape/merge we do not trace |
cancercount |
regressor in 5 | cancercount = ifelse(!is.na(OpioidMaster$cancerrate_coverage), rnorm(nrow(OpioidMaster), 0, 1), NA_integer_) (assign) [D] CreateOpioidMaster.R:100ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 100
OpioidMaster$cancercount = ifelse(!is.na(OpioidMaster$cancerrate_coverage), rnorm(nrow(OpioidMaster), 0, 1), NA_integer_) |
l_age20t64ratio |
regressor in 5 | l_age20t64ratio = dplyr::lag(Age20t64ratio, 1, NA) (mutate) [A] DiDGoodmanBaconDecomp.R:43ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 43
l_hispanicratio = dplyr::lag(HispanicRatio, 1, NA), l_age20t64ratio = dplyr::lag(Age20t64ratio, 1, NA), |
l_age65pratio |
regressor in 5 | l_age65pratio = dplyr::lag(Age65pratio, 1, NA) (mutate) [A] DiDGoodmanBaconDecomp.R:44ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 44
l_age65pratio = dplyr::lag(Age65pratio, 1, NA), l_miginflowratio = dplyr::lag(MigInflowRatio, 1, NA), |
l_blackratio |
regressor in 5 | l_blackratio = dplyr::lag(BlackRatio, 1, NA) (mutate) [A] DiDGoodmanBaconDecomp.R:42ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 42
l_blackratio = dplyr::lag(BlackRatio, 1, NA), l_iaratio = dplyr::lag(IARatio, 1, NA), |
l_hispanicratio |
regressor in 5 | l_hispanicratio = dplyr::lag(HispanicRatio, 1, NA) (mutate) [A] DiDGoodmanBaconDecomp.R:43ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 43
l_hispanicratio = dplyr::lag(HispanicRatio, 1, NA), l_age20t64ratio = dplyr::lag(Age20t64ratio, 1, NA), |
l_iaratio |
regressor in 5 | l_iaratio = dplyr::lag(IARatio, 1, NA) (mutate) [A] DiDGoodmanBaconDecomp.R:42ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 42
l_blackratio = dplyr::lag(BlackRatio, 1, NA), l_iaratio = dplyr::lag(IARatio, 1, NA), |
l_laborpartrate |
regressor in 5 | l_laborpartrate = dplyr::lag(LaborPartRate, 1, NA) (mutate) [A] DiDGoodmanBaconDecomp.R:46ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 46
l_laborpartrate = dplyr::lag(LaborPartRate, 1, NA), l_neoplasmsrate = dplyr::lag(NeoplasmsRate, 1, NA), |
l_maleratio |
regressor in 5 | l_maleratio = dplyr::lag(MaleRatio, 1, NA) (mutate) [A] DiDGoodmanBaconDecomp.R:41ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 41
df = df %>% group_by(CountyFIPS) %>% mutate(l_maleratio = dplyr::lag(MaleRatio, 1, NA), l_whiteratio = dplyr::lag(WhiteRatio, 1,NA),
l_blackratio = dplyr::lag(BlackRatio, 1, NA), l_iaratio = dplyr … |
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
| Command | Outcome | Regressors | Fixed effects | Standard errors | Where |
|---|---|---|---|---|---|
lmols |
COCPOSS_PC0913 |
Avg0913MaleRatio Avg0913WhiteRatio Avg0913BlackRatio Avg0913IARatio Avg0913HispanicRatio Avg0913Age20t64ratio Avg0913Age65pratio Avg0913UnemploymentRate Avg0913LogHHIncome PopDensity DemocraticGovernorShare0913
|
— | default | [D] CreateOpioidMaster.R:160ReplicationCodeImputed/R/[D] CreateOpioidMaster.R, line 160
model <- lm(COCPOSS_PC0913 ~ Avg0913MaleRatio + Avg0913WhiteRatio + Avg0913BlackRatio + Avg0913IARatio + Avg0913HispanicRatio + Avg0913Age20t64ratio +
Avg0913Age65pratio + Avg0913UnemploymentRate + Avg0913LogHHIncome + PopDens … |
lmols |
AbsPrescriptions |
cancercount medicarehospicecount medicareambulatorysurgerycount LogTotPop YEARFactor
|
— | default | [A] DiDGoodmanBaconDecomp.R:32ReplicationCodeImputed/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), ]) |
reghdfepanel fe |
prescriptionrate |
cancerrate medicarehospicepct medicareambulatorysurgerypct
|
year | default | [D] DataPreparationsCorrelationsIV.do:23ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 23
reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct, absorb(year) residuals(prescriptionrate_r) |
reghdfepanel fe |
prescriptionrate |
cancerrate medicarehospicepct medicareambulatorysurgerypct
|
year | default | [D] DataPreparationsCorrelationsIV.do:27ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 27
reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct if n_pillmills < 8, absorb(year) |
reghdfepanel fe |
absprescriptions |
cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop
|
year | cluster: countyfips | [D] DataPreparationsCorrelationsIV.do:37ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 37
reghdfe absprescriptions cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop, absorb(year) cluster(countyfips) |
reghdfepanel fe |
absprescriptions |
cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop
|
year | cluster: countyfips | [D] DataPreparationsCorrelationsIV.do:43ReplicationCodeImputed/Stata/[D] DataPreparationsCorrelationsIV.do, line 43
reghdfe absprescriptions cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop if n_pillmills < 8, absorb(year) cluster(countyfips) |
reghdfepanel fe |
prescriptionrate |
cancerrate medicarehospicepct medicareambulatorysurgerypct
|
year | default | [S] SummaryStatisticsGeneral.do:25ReplicationCodeImputed/Stata/[S] SummaryStatisticsGeneral.do, line 25
reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct, absorb(year) |
reghdfepanel fe |
prescriptionrate |
cancerrate medicarehospicepct medicareambulatorysurgerypct
|
year | default | [S] SummaryStatisticsGeneral.do:31ReplicationCodeImputed/Stata/[S] SummaryStatisticsGeneral.do, line 31
reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct if n_pillmills < 8, absorb(year) |
reghdfepanel fe |
absprescriptions |
cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop
|
year | cluster: countyfips | [S] SummaryStatisticsGeneral.do:37ReplicationCodeImputed/Stata/[S] SummaryStatisticsGeneral.do, line 37
reghdfe absprescriptions cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop, absorb(year) cluster(countyfips) |
reghdfepanel fe |
absprescriptions |
cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop
|
year | cluster: countyfips | [S] SummaryStatisticsGeneral.do:43ReplicationCodeImputed/Stata/[S] SummaryStatisticsGeneral.do, line 43
reghdfe absprescriptions cancercount medicarehospicecount medicareambulatorysurgerycount logtotpop if n_pillmills < 8, absorb(year) cluster(countyfips) |
reghdfepanel 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:37ReplicationCodeImputed/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 … |
reghdfepanel 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:39ReplicationCodeImputed/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 … |
reghdfepanel 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:42ReplicationCodeImputed/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 … |
ivreghdfeiv |
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:16ReplicationCodeImputed/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 … |
reghdfepanel 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:27ReplicationCodeImputed/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 … |
ivreghdfeiv |
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:31ReplicationCodeImputed/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 … |
reghdfepanel 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:42ReplicationCodeImputed/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 … |
ivreghdfeiv |
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:64ReplicationCodeImputed/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 … |
reghdfepanel 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:79ReplicationCodeImputed/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 … |
ivreghdfeiv |
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:83ReplicationCodeImputed/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 … |
reghdfepanel 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:98ReplicationCodeImputed/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 … |
ivreghdfeiv |
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:103ReplicationCodeImputed/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 … |
reghdfepanel 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:118ReplicationCodeImputed/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 … |
ivreghdfeiv |
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:122ReplicationCodeImputed/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 … |
reghdfepanel 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:137ReplicationCodeImputed/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 … |
reghdfepanel fe |
prescriptionrate |
cancerrate medicarehospicepct medicareambulatorysurgerypct
|
year | default | [D] DataPreparationsDiD.do:93ReplicationCodeImputed/Stata/[D] DataPreparationsDiD.do, line 93
reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct if n_pillmills < 8, absorb(year) |
reghdfepanel fe |
absprescriptions |
cancerrate medicarehospicepct medicareambulatorysurgerypct
|
year | default | [D] DataPreparationsDiD.do:99ReplicationCodeImputed/Stata/[D] DataPreparationsDiD.do, line 99
reghdfe absprescriptions cancerrate medicarehospicepct medicareambulatorysurgerypct if n_pillmills < 8, absorb(year) |
reghdfepanel 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:119ReplicationCodeImputed/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 … |
reghdfepanel 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:7ReplicationCodeImputed/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 … |
reghdfepanel 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:9ReplicationCodeImputed/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 … |
reghdfepanel 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:11ReplicationCodeImputed/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 … |
reghdfepanel fe |
`y`Y'' |
`x`X''
|
countyfips, year | cluster: statefips | [R] StateLawDiDSunAbrahm.do:76ReplicationCodeImputed/Stata/[R] StateLawDiDSunAbrahm.do, line 76
reghdfe `y`Y'' `x`X'', absorb(countyfips year) vce(cluster statefips) |
reghdfepanel 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:40ReplicationCodeImputed/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 … |
eventstudyinteractdid |
PC_avghomevalue |
L*event F*event
|
countyfips, year | cluster: statefips | [R] StateLawDiDSunAbrahmHomeValueAdditional.do:5ReplicationCodeImputed/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 … |
reghdfepanel fe |
lawpassed |
avgprescriptionrate ageadjustedoverdosedeathrate
|
— | robust | [R] StateLawPredictors.do:24ReplicationCodeImputed/Stata/[R] StateLawPredictors.do, line 24
reghdfe lawpassed avgprescriptionrate ageadjustedoverdosedeathrate, noabsorb vce(robust) |
reghdfepanel fe |
lawpassed |
avgprescriptionrate ageadjustedoverdosedeathrate unemploymentrate logmhi povertyratio loggdppercapita violent_crime_rate property_crime_rate lnpolicerelperc lnchildwelfaresperc
|
— | robust | [R] StateLawPredictors.do:26ReplicationCodeImputed/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) |
reghdfepanel fe |
lawpassed |
avgprescriptionrate ageadjustedoverdosedeathrate democratic republican
|
— | robust | [R] StateLawPredictors.do:28ReplicationCodeImputed/Stata/[R] StateLawPredictors.do, line 28
reghdfe lawpassed avgprescriptionrate ageadjustedoverdosedeathrate democratic republican, noabsorb vce(robust) |
reghdfepanel fe |
lawpassed |
avgprescriptionrate ageadjustedoverdosedeathrate unemploymentrate logmhi povertyratio loggdppercapita violent_crime_rate property_crime_rate lnpolicerelperc lnchildwelfaresperc democratic republican
|
— | robust | [R] StateLawPredictors.do:30ReplicationCodeImputed/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) |
reghdfepanel fe |
prescriptionrate |
cancerrate medicarehospicepct medicareambulatorysurgerypct
|
year | default | [D] DataPreparationsStateLawRD.do:16ReplicationCodeImputed/Stata/[D] DataPreparationsStateLawRD.do, line 16
reghdfe prescriptionrate cancerrate medicarehospicepct medicareambulatorysurgerypct if n_pillmills < 8, absorb(year) |
rdrobustrd |
`y`Y'' |
borderdis
|
— | robust | [R] StateLawRD.do:78ReplicationCodeImputed/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
| command | layers | variables | options | saved as | where |
|---|---|---|---|---|---|
ggplotscatter
|
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:74ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 74
plot = ggplot(df_bacon_conexist) + |
ggplotscatter
|
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:92ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 92
plot = ggplot(df_bacon_conexist) + |
ggplotscatter
|
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:110ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 110
plot = ggplot(df_bacon_conexist) + |
ggplotscatter
|
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:128ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 128
plot = ggplot(df_bacon_conexist) + |
ggplotscatter
|
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:146ReplicationCodeImputed/R/[A] DiDGoodmanBaconDecomp.R, line 146
plot = ggplot(df_bacon_conexist) + |
plot_usmapmap
|
map |
not saved | [P] CorrelationMap.R:65ReplicationCodeImputed/R/[P] CorrelationMap.R, line 65
map_plot = plot_usmap(data = OpioidMaster, values = "PC_HV_Quantile", linewidth = 0.2) + |
||
plot_usmapmap
|
map |
not saved | [P] DiDMapYearLawPassed.R:52ReplicationCodeImputed/R/[P] DiDMapYearLawPassed.R, line 52
mapplot = plot_usmap(data = MPStates, values = "TreatYear", labels = TRUE) + |
||
ggplotevent-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:88ReplicationCodeImputed/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) + |
rdplotRD 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:90ReplicationCodeImputed/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 … |
rdplotRD 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:18ReplicationCodeImputed/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)) … |
rdplotRD 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:28ReplicationCodeImputed/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 … |
rdplotRD 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:35ReplicationCodeImputed/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 … |