- Data Overview
summary(data)
## state stateid year t cpi
## Length:663 Min. : 1 Min. :2006 Min. : 6 Min. :198.3
## Class :character 1st Qu.:13 1st Qu.:2009 1st Qu.: 9 1st Qu.:211.1
## Mode :character Median :26 Median :2012 Median :12 Median :226.7
## Mean :26 Mean :2012 Mean :12 Mean :224.0
## 3rd Qu.:39 3rd Qu.:2015 3rd Qu.:15 3rd Qu.:233.9
## Max. :51 Max. :2018 Max. :18 Max. :247.9
## mcare_millions medicaid_spend_actual overdoses population
## Min. : 418 Min. :4.090e+08 Min. : 10.0 Min. : 522667
## 1st Qu.: 2490 1st Qu.:2.075e+09 1st Qu.: 122.5 1st Qu.: 1666720
## Median : 6808 Median :5.120e+09 Median : 370.0 Median : 4357847
## Mean :10587 Mean :8.584e+09 Mean : 552.9 Mean : 6145898
## 3rd Qu.:12426 3rd Qu.:9.636e+09 3rd Qu.: 699.5 3rd Qu.: 6889846
## Max. :77603 Max. :8.553e+10 Max. :4293.0 Max. :39461588
## hhincome state_gdp unemployment_pct labor_participation_pct
## Min. :37714 Min. : 26802 Min. : 2.400 Min. :49.30
## 1st Qu.:53071 1st Qu.: 78045 1st Qu.: 4.300 1st Qu.:59.10
## Median :58793 Median : 186849 Median : 5.400 Median :62.40
## Mean :59593 Mean : 321957 Mean : 5.939 Mean :62.35
## 3rd Qu.:65624 3rd Qu.: 417780 3rd Qu.: 7.300 3rd Qu.:65.70
## Max. :86345 Max. :2721651 Max. :13.700 Max. :73.20
## insured_pct grad_hs_pct is_manufacturing_state post_recession
## Min. :75.26 Min. :78.70 Min. :0.0000 Min. :0.0000
## 1st Qu.:84.75 1st Qu.:84.90 1st Qu.:0.0000 1st Qu.:1.0000
## Median :88.10 Median :88.10 Median :0.0000 Median :1.0000
## Mean :87.91 Mean :87.42 Mean :0.2157 Mean :0.8462
## 3rd Qu.:91.20 3rd Qu.:90.20 3rd Qu.:0.0000 3rd Qu.:1.0000
## Max. :96.80 Max. :93.00 Max. :1.0000 Max. :1.0000
## per_capita_state_tax_revenue pct_change_str medicaidml
## Min. : 905.9 Min. :-0.77900 Min. : 408.9
## 1st Qu.: 3546.5 1st Qu.: 0.00750 1st Qu.: 2075.2
## Median : 4067.2 Median : 0.02700 Median : 5120.2
## Mean : 4531.7 Mean : 0.02559 Mean : 8584.1
## 3rd Qu.: 4976.3 3rd Qu.: 0.04700 3rd Qu.: 9636.1
## Max. :14609.0 Max. : 1.01000 Max. :85531.0
## tmcaremcaidml tmcaremcaidmlreal Prescription.Rate ovd_cost
## Min. : 941.4 Min. : 1177 Min. : 25.00 Min. : 6353
## 1st Qu.: 4743.9 1st Qu.: 5112 1st Qu.: 60.15 1st Qu.: 89125
## Median : 12436.2 Median : 14190 Median : 75.20 Median : 324819
## Mean : 19375.8 Mean : 21247 Mean : 77.48 Mean : 421166
## 3rd Qu.: 22596.7 3rd Qu.: 24453 3rd Qu.: 90.25 3rd Qu.: 596855
## Max. :167578.6 Max. :167579 Max. :146.90 Max. :2921932
Data frame with variables of interest, calling it df2
df2 = data.frame(state, year, cpi, overdoses,
population, hhincome, unemployment_pct, labor_participation_pct,
insured_pct, grad_hs_pct, per_capita_state_tax_revenue, pct_change_str,
Prescription.Rate)
detach(data)
attach(df2)
Normalizing overdoses by population
df2$ovd_rate = overdoses / population * 100000
Converting the data set to a panel object
df.p <- pdata.frame(df2, index = c('state', 'year'))
Model 1 – Fixed effects model
fixeff = plm(ovd_rate~ Prescription.Rate + hhincome +
unemployment_pct + labor_participation_pct + insured_pct +
grad_hs_pct + per_capita_state_tax_revenue + pct_change_str, data = df.p, model = "within")
stargazer(fixeff, type='text')
##
## ========================================================
## Dependent variable:
## ---------------------------
## ovd_rate
## --------------------------------------------------------
## Prescription.Rate -0.133***
## (0.018)
##
## hhincome 0.00001
## (0.00005)
##
## unemployment_pct -0.019
## (0.123)
##
## labor_participation_pct -0.258**
## (0.118)
##
## insured_pct -0.176***
## (0.055)
##
## grad_hs_pct 1.579***
## (0.196)
##
## per_capita_state_tax_revenue 0.001***
## (0.0002)
##
## pct_change_str -6.931***
## (2.291)
##
## --------------------------------------------------------
## Observations 663
## R2 0.480
## Adjusted R2 0.430
## F Statistic 69.598*** (df = 8; 604)
## ========================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
Model 2 – Fixed effects with a lag variable for overdoses
fixeff.lag = plm(lag(ovd_rate) ~ Prescription.Rate + hhincome +
unemployment_pct + labor_participation_pct + insured_pct +
grad_hs_pct + per_capita_state_tax_revenue + pct_change_str, data = df.p, model = "within")
stargazer(fixeff.lag, type='text')
##
## ========================================================
## Dependent variable:
## ---------------------------
## lag(ovd_rate)
## --------------------------------------------------------
## Prescription.Rate -0.141***
## (0.016)
##
## hhincome 0.0001*
## (0.00005)
##
## unemployment_pct 0.109
## (0.117)
##
## labor_participation_pct -0.019
## (0.117)
##
## insured_pct -0.176***
## (0.052)
##
## grad_hs_pct 1.468***
## (0.197)
##
## per_capita_state_tax_revenue 0.001***
## (0.0002)
##
## pct_change_str -8.855***
## (2.238)
##
## --------------------------------------------------------
## Observations 612
## R2 0.483
## Adjusted R2 0.429
## F Statistic 64.640*** (df = 8; 553)
## ========================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
Model 3 – Fixed effects with log of overdose
fixeff.log = plm(log(ovd_rate) ~ Prescription.Rate + hhincome +
unemployment_pct + labor_participation_pct + insured_pct +
grad_hs_pct + per_capita_state_tax_revenue + pct_change_str, data = df.p, model = "within")
stargazer(fixeff.log, type='text')
##
## ========================================================
## Dependent variable:
## ---------------------------
## log(ovd_rate)
## --------------------------------------------------------
## Prescription.Rate -0.005***
## (0.001)
##
## hhincome -0.00000
## (0.00000)
##
## unemployment_pct -0.031***
## (0.010)
##
## labor_participation_pct -0.053***
## (0.010)
##
## insured_pct -0.014***
## (0.005)
##
## grad_hs_pct 0.122***
## (0.016)
##
## per_capita_state_tax_revenue 0.0001***
## (0.00002)
##
## pct_change_str -0.843***
## (0.188)
##
## --------------------------------------------------------
## Observations 663
## R2 0.478
## Adjusted R2 0.428
## F Statistic 69.067*** (df = 8; 604)
## ========================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
Comparing fixed effects model
stargazer(fixeff, fixeff.lag,fixeff.log, type = 'text', title = 'Fixed effects with/without lag', align= TRUE, column.labels = c('No Lag','lag'))
##
## Fixed effects with/without lag
## ====================================================================================================
## Dependent variable:
## -----------------------------------------------------------------------
## ovd_rate lag(ovd_rate) log(ovd_rate)
## No Lag lag
## (1) (2) (3)
## ----------------------------------------------------------------------------------------------------
## Prescription.Rate -0.133*** -0.141*** -0.005***
## (0.018) (0.016) (0.001)
##
## hhincome 0.00001 0.0001* -0.00000
## (0.00005) (0.00005) (0.00000)
##
## unemployment_pct -0.019 0.109 -0.031***
## (0.123) (0.117) (0.010)
##
## labor_participation_pct -0.258** -0.019 -0.053***
## (0.118) (0.117) (0.010)
##
## insured_pct -0.176*** -0.176*** -0.014***
## (0.055) (0.052) (0.005)
##
## grad_hs_pct 1.579*** 1.468*** 0.122***
## (0.196) (0.197) (0.016)
##
## per_capita_state_tax_revenue 0.001*** 0.001*** 0.0001***
## (0.0002) (0.0002) (0.00002)
##
## pct_change_str -6.931*** -8.855*** -0.843***
## (2.291) (2.238) (0.188)
##
## ----------------------------------------------------------------------------------------------------
## Observations 663 612 663
## R2 0.480 0.483 0.478
## Adjusted R2 0.430 0.429 0.428
## F Statistic 69.598*** (df = 8; 604) 64.640*** (df = 8; 553) 69.067*** (df = 8; 604)
## ====================================================================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
Model 4: Random Effects Model with lag
raneff.lag = plm(lag(ovd_rate) ~ Prescription.Rate + hhincome +
unemployment_pct + labor_participation_pct + insured_pct +
grad_hs_pct + per_capita_state_tax_revenue + pct_change_str, data = df.p, model = "random")
stargazer(raneff.lag, type='text')
##
## ========================================================
## Dependent variable:
## ---------------------------
## lag(ovd_rate)
## --------------------------------------------------------
## Prescription.Rate -0.117***
## (0.016)
##
## hhincome 0.00002
## (0.00004)
##
## unemployment_pct -0.402***
## (0.102)
##
## labor_participation_pct -0.573***
## (0.087)
##
## insured_pct -0.181***
## (0.053)
##
## grad_hs_pct 0.703***
## (0.148)
##
## per_capita_state_tax_revenue 0.001***
## (0.0002)
##
## pct_change_str -7.988***
## (2.329)
##
## Constant 6.604
## (15.171)
##
## --------------------------------------------------------
## Observations 612
## R2 0.394
## Adjusted R2 0.386
## F Statistic 392.522***
## ========================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
Model 5: Random Effects Model
raneff = plm(ovd_rate ~ Prescription.Rate + hhincome +
unemployment_pct + labor_participation_pct + insured_pct +
grad_hs_pct + per_capita_state_tax_revenue + pct_change_str, data = df.p, model = "random")
stargazer(raneff, type='text')
##
## ========================================================
## Dependent variable:
## ---------------------------
## ovd_rate
## --------------------------------------------------------
## Prescription.Rate -0.105***
## (0.017)
##
## hhincome -0.00004
## (0.00004)
##
## unemployment_pct -0.485***
## (0.107)
##
## labor_participation_pct -0.739***
## (0.088)
##
## insured_pct -0.174***
## (0.056)
##
## grad_hs_pct 0.903***
## (0.148)
##
## per_capita_state_tax_revenue 0.001***
## (0.0002)
##
## pct_change_str -6.115**
## (2.380)
##
## Constant 0.094
## (15.191)
##
## --------------------------------------------------------
## Observations 663
## R2 0.404
## Adjusted R2 0.397
## F Statistic 443.053***
## ========================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
Comparing Random effects model
stargazer(raneff, raneff.lag, type = 'text', title = 'Random Effects Models',
align= TRUE, column.labels = c('No Lag','lag'))
##
## Random Effects Models
## =========================================================
## Dependent variable:
## ----------------------------
## ovd_rate lag(ovd_rate)
## No Lag lag
## (1) (2)
## ---------------------------------------------------------
## Prescription.Rate -0.105*** -0.117***
## (0.017) (0.016)
##
## hhincome -0.00004 0.00002
## (0.00004) (0.00004)
##
## unemployment_pct -0.485*** -0.402***
## (0.107) (0.102)
##
## labor_participation_pct -0.739*** -0.573***
## (0.088) (0.087)
##
## insured_pct -0.174*** -0.181***
## (0.056) (0.053)
##
## grad_hs_pct 0.903*** 0.703***
## (0.148) (0.148)
##
## per_capita_state_tax_revenue 0.001*** 0.001***
## (0.0002) (0.0002)
##
## pct_change_str -6.115** -7.988***
## (2.380) (2.329)
##
## Constant 0.094 6.604
## (15.191) (15.171)
##
## ---------------------------------------------------------
## Observations 663 612
## R2 0.404 0.394
## Adjusted R2 0.397 0.386
## F Statistic 443.053*** 392.522***
## =========================================================
## Note: *p<0.1; **p<0.05; ***p<0.01
Hausman Test
phtest(fixeff, raneff)
##
## Hausman Test
##
## data: ovd_rate ~ Prescription.Rate + hhincome + unemployment_pct + ...
## chisq = 41.934, df = 8, p-value = 1.394e-06
## alternative hypothesis: one model is inconsistent
Since the p-value is > 0.05, We should use random effects.