6.9 Zero Inflated Count Models

The with zeros model: didactically useful

  • Zeroes occur through two processes
    • Group A: People who always have 0 counts
    • Group S: People who sometimes have 0s, but sometimes not
  • Probabilities of being in each group

\[\begin{aligned} \Pr(\text{Group A}) &= \psi \\ \Pr(\text{Group S}) &= 1 - \psi \end{aligned}\]

  • An observed 0 could come from either group; we don’t observe directly in the data whether someone is in Group A or S
    • This is discrete, unobserved heterogeneity
  • Probabilities of counts by group

\[\text{Group A:} \quad \Pr(y = 0\,|\,\mathbf{x}) = 1\]

\[\text{Group S:} \quad \Pr(y\,|\,\mathbf{x}) = \frac{e^{-\mu}\mu^{y}}{y!} \quad \text{where } \mu = \exp(\mathbf{x}\boldsymbol{\beta})\]

i.e., Group S’s counts are produced by a Poisson process

\[\text{Group S:} \quad \Pr(y = 0\,|\,\mathbf{x}) = \exp(-\mu)\]

Zero inflated models

Step 1: Model group membership as a binary model

  • First, we model the probability of group membership: whether a person is in A(lways) zero or S(ometimes) zero:

\[\Pr(\text{Group A}\,|\,\mathbf{x}_{i}) = \Pr(\text{Always zero}\,|\,\mathbf{x}_{i}) = \psi_{i}\]

  • Where the probability \(\psi\) (psi) can be modeled with binary logit or probit
  • Remember we don’t directly observe if someone is in group A or S
    • Therefore, we use what is in the data for our best guess
      • Specifically, we observe whether someone is observed as a zero or not on the DV along with their values of theoretically important IVs
      • That is, which variables in the data do we think would predict group A vs S membership?
        • Include them in the binary model
  • For the next step, we actually use the probability of not always being a zero (\(1 - \psi\))

\[\Pr(\text{Always zero}\,|\,\mathbf{x}_{i}) = \psi_{i}\]

\[\Pr(\text{Not always zero}\,|\,\mathbf{x}_{i}) = 1 - \psi_{i} = \Pr(\text{Sometimes zero})\]

Step 2: Model counts by weighting by Pr(Group S)

  • Next, we predict the counts but only for people with observed counts
    • That is, we do not include observed zeroes in this step
  • However, some people who were observed with >0 counts are sometimes zero so would not always have counts (e.g., we asked them about # of drinks last month right after the holidays)
    • Therefore, take the Pr(sometimes zero) into account when predicting counts
  • The predictions in zero-inflated models are effectively weighted by the probability of not being an always zero
    • For those we generally think are always zeros (Pr(Always) = 1; Pr(Sometimes) = 0), we give them almost no weight in the calculations of the counts
    • For those who are very unlikely to be an always a zero (i.e., usually have a non-zero count), we give the most weight
      • E.g., Whose Pr(Always) approaches 0; Pr(Sometimes) approaches 1
  • For Zero Inflated Poisson:

\[\Pr(y\,|\,\mathbf{x}) = (1 - \psi)\frac{e^{-\mu}\mu^{y}}{y!} \quad \text{for } y > 0\]

  • For Zero Inflated Negative Binomial:

\[\Pr(y\,|\,\mathbf{x}) = (1 - \psi)\frac{\Gamma(y + \alpha^{-1})}{y!\,\Gamma(\alpha^{-1})}\left(\frac{\alpha^{-1}}{\alpha^{-1} + \mu}\right)^{\alpha^{-1}}\left(\frac{\mu}{\alpha^{-1} + \mu}\right)^{y} \quad \text{for } y > 0\]

Example: Days in last month of “not good” mental health

  • GSS (2002, 2006, 2010, 2014)
  • DV: “Now thinking about your mental health, which includes stress, depression, and problems with emotions, for how many days during the past 30 days was your mental health not good?”
    • Happily (get it?) this measure has an excess of zeroes
      • ≈ 60% of the sample reports zero days of ‘not good’ mental health
  • IVs: Gender, income, age, marital status
  • Controls: Race, education, religiosity, survey year
use "https://tdmize.github.io/data/data/cda_gss", clear
(cda_gss.dta |  GSS 1972-2021 CDA - Categorical Data Analysis | date created 202
> 3)
keep if year >= 2002 & year <= 2014
(50,180 observations deleted)
*Data management
gen notrelig = relig
(106 missing values generated)
lab var notrelig "R Not Religious"
recode notrelig 1 2 11 = 0 4 = 1 3 5/10 12/13 = .
(18,560 changes made to notrelig)
lab def notrlab 0"Christian" 1"Not Religious"
lab val notrelig notrlab
drop if missing(mntlhlth, physhlth, woman, race3, year, college, ///
    parent, faminc, metro, notrelig, married)
(13,623 observations deleted)
*6.9.a
hist mntlhlth, percent fcolor(none) ///
    title("[6.9.a] Distribution of 'Not Good' Mental Health Days in Last Month
")
(bin=37, start=0, width=.81081081)

[6.9.a] Histogram of the number of days of poor mental health in the past 30 days: about 60% report 0 days, small percentages report 1 to 10 days, and a small spike of about 4% report all 30 days.

library(haven)           # import Stata data and labels
library(dplyr)           # data manipulation
library(ggplot2)         # graphs
library(cleanplots)      # graph scheme
cleanplots_defaults()

gss <- read_dta("https://tdmize.github.io/data/data/cda_gss.dta")
gss <- gss |> filter(year >= 2002 & year <= 2014)

# Data management: Christian (Protestant, Catholic, Christian) vs not religious
gss <- gss |>
  mutate(notrelig = case_when(relig %in% c(1, 2, 11) ~ 0, relig == 4 ~ 1))

gss <- gss[complete.cases(gss[c("mntlhlth", "physhlth", "woman", "race3", "year",
  "college", "parent", "faminc", "metro", "notrelig", "married")]), ]

# 6.9.a
ggplot(gss, aes(x = mntlhlth)) +
  geom_histogram(aes(y = after_stat(100 * count / sum(count))), binwidth = 1,
    fill = NA, color = "black") +
  labs(title = "[6.9.a] Distribution of 'Not Good' Mental Health Days in Last Month",
    x = "days of poor mental health past 30 days", y = "Percent")

[6.9.a] Histogram of the number of days of poor mental health in the past 30 days: about 60% report 0 days, small percentages report 1 to 10 days, and a small spike of about 4% report all 30 days.

Back to top