Visualize exit variable
## [1] "Visualize distribution of outcome variables"

Testing TWFE
# note that this is an early pass; no diagnostics, etc. (like, for example, it seems that there is serial correlation in this model -- meaning that a lag term may need to be included?)
# make outcome variable
dfModel$exitRate = dfModel$exited/dfModel$child
# run model
twfe_exitRt <- plm(exitRate ~ unempRt + singPar + foodIns + chpovRt + LessHS + gspPc + policy_updated + crimeRt + pctBlk + tanfBen_3fam + snapPpl + mediPpl + tanfPpl + welfarePc + tanfPpl*welfarePc + incarRt + deathRt + policePc + factor(year), data=dfModel, effect="twoway", model="within", index="state")
summary(twfe_exitRt)
## Twoways effects Within Model
##
## Call:
## plm(formula = exitRate ~ unempRt + singPar + foodIns + chpovRt +
## LessHS + gspPc + policy_updated + crimeRt + pctBlk + tanfBen_3fam +
## snapPpl + mediPpl + tanfPpl + welfarePc + tanfPpl * welfarePc +
## incarRt + deathRt + policePc + factor(year), data = dfModel,
## effect = "twoway", model = "within", index = "state")
##
## Unbalanced Panel: n = 50, T = 18-19, N = 946
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -3.7307e-03 -4.1697e-04 1.1019e-05 3.5086e-04 4.3683e-03
##
## Coefficients:
## Estimate Std. Error t-value Pr(>|t|)
## unempRt 1.5462e-03 3.8291e-03 0.4038 0.686471
## singPar -1.8364e-03 2.0317e-03 -0.9038 0.366335
## foodIns 2.6057e-03 1.3372e-03 1.9487 0.051657 .
## chpovRt 1.6817e-03 2.2342e-03 0.7527 0.451827
## LessHS -9.3926e-03 3.7804e-03 -2.4845 0.013161 *
## gspPc -2.2580e-08 9.2026e-09 -2.4536 0.014339 *
## policy_updated 5.4424e-04 1.2460e-04 4.3677 1.408e-05 ***
## crimeRt 2.1375e-05 9.2912e-06 2.3006 0.021653 *
## pctBlk -1.0170e-02 6.1416e-03 -1.6559 0.098104 .
## tanfBen_3fam -2.1939e-06 6.8765e-07 -3.1904 0.001472 **
## snapPpl -1.5504e-03 3.3936e-04 -4.5685 5.631e-06 ***
## mediPpl 7.2385e-04 1.6026e-04 4.5169 7.152e-06 ***
## tanfPpl -1.4158e-03 7.1193e-04 -1.9886 0.047060 *
## welfarePc -2.2784e-05 2.0289e-04 -0.1123 0.910614
## incarRt 1.6067e-04 5.5702e-05 2.8844 0.004020 **
## deathRt 2.1384e-04 1.5350e-04 1.3931 0.163939
## policePc 2.4923e-04 1.6286e-04 1.5304 0.126288
## tanfPpl:welfarePc 8.5832e-04 3.6117e-04 2.3765 0.017696 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 0.00059939
## Residual Sum of Squares: 0.00048281
## R-Squared: 0.1945
## Adj. R-Squared: 0.11489
## F-statistic: 11.5365 on 18 and 860 DF, p-value: < 2.22e-16
Glmer Model: Rate of exit
exitModel <- glmer(exited ~ scale(unempRt) + scale(singPar) + scale(foodIns) + scale(chpovRt) + scale(LessHS) + scale(gspPc) + scale(policy_updated) + scale(crimeRt) + scale(pctBlk) + scale(tanfBen_3fam) + scale(snapPpl) + scale(mediPpl) + scale(tanfPpl) + scale(welfarePc) + scale(tanfPpl)*scale(welfarePc) + scale(incarRt) + scale(deathRt) + scale(policePc) + (1 | state) + (1 | year) + (1 | obsN), offset=log(child),data=dfModel,family=poisson)
summary(exitModel)
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: poisson ( log )
## Formula:
## exited ~ scale(unempRt) + scale(singPar) + scale(foodIns) + scale(chpovRt) +
## scale(LessHS) + scale(gspPc) + scale(policy_updated) + scale(crimeRt) +
## scale(pctBlk) + scale(tanfBen_3fam) + scale(snapPpl) + scale(mediPpl) +
## scale(tanfPpl) + scale(welfarePc) + scale(tanfPpl) * scale(welfarePc) +
## scale(incarRt) + scale(deathRt) + scale(policePc) + (1 |
## state) + (1 | year) + (1 | obsN)
## Data: dfModel
## Offset: log(child)
##
## AIC BIC logLik deviance df.resid
## 14869.0 14975.7 -7412.5 14825.0 924
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -0.73703 -0.06391 0.00341 0.06037 0.77690
##
## Random effects:
## Groups Name Variance Std.Dev.
## obsN (Intercept) 0.024198 0.15556
## state (Intercept) 0.112824 0.33589
## year (Intercept) 0.001755 0.04189
## Number of obs: 946, groups: obsN, 946; state, 50; year, 19
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -5.570617 0.048817 -114.113 < 2e-16 ***
## scale(unempRt) -0.003852 0.014083 -0.274 0.78447
## scale(singPar) -0.006352 0.031100 -0.204 0.83817
## scale(foodIns) 0.011805 0.009466 1.247 0.21235
## scale(chpovRt) 0.005679 0.021498 0.264 0.79166
## scale(LessHS) -0.067051 0.021923 -3.058 0.00223 **
## scale(gspPc) -0.027183 0.018837 -1.443 0.14900
## scale(policy_updated) 0.198845 0.030306 6.561 5.34e-11 ***
## scale(crimeRt) 0.018862 0.016323 1.156 0.24787
## scale(pctBlk) -0.242922 0.049626 -4.895 9.83e-07 ***
## scale(tanfBen_3fam) -0.040660 0.022584 -1.800 0.07180 .
## scale(snapPpl) -0.085148 0.013998 -6.083 1.18e-09 ***
## scale(mediPpl) 0.057520 0.014348 4.009 6.10e-05 ***
## scale(tanfPpl) 0.008092 0.010808 0.749 0.45403
## scale(welfarePc) 0.066627 0.017045 3.909 9.27e-05 ***
## scale(incarRt) 0.060365 0.021333 2.830 0.00466 **
## scale(deathRt) 0.009264 0.007356 1.259 0.20793
## scale(policePc) 0.050091 0.015572 3.217 0.00130 **
## scale(tanfPpl):scale(welfarePc) 0.015641 0.008289 1.887 0.05917 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 19 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
Glmer R2
## [1] "Conditional R2 (fixed + random effects) is fairly small:"
## Warning: mu of 0.0 is too close to zero, estimate of random effect variances may
## be unreliable.
## # R2 for Mixed Models
##
## Conditional R2: 0.034
## Marginal R2: 0.014
Glmer ICC
## [1] "~2% of variance is due to differences between groups:"
## Warning: mu of 0.0 is too close to zero, estimate of random effect variances may
## be unreliable.
## # Intraclass Correlation Coefficient
##
## Adjusted ICC: 0.020
## Unadjusted ICC: 0.020
Glmer Diagnostics
Multicollinearity

Singularity & overdispersion
## [1] "no singularity detected:"
## [1] 0.04189393
## # Overdispersion test
##
## dispersion ratio = 0.019
## Pearson's Chi-Squared = 17.736
## p-value = 1
## No overdispersion detected.
Plot random effects
## $obsN

##
## $state

##
## $year

Residuals (less reliable for glmer?)
