Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Zero Inflated Poisson regression with mixed effects

    Hello, I looked at the mixed and xtpoisson commands but I don't think they include the option for incorporating a zero-inflated model, is there a command that lets me use random effect and fixed effects with a ZIP model?
    Last edited by Luis Mijares Castaneda; 13 Sep 2024, 15:42.

  • #2
    I'm not sure about an answer to your specific question but I might suggest that a "large" fraction of zero outcomes in the outcome's marginal sample distribution does not necessarily imply that the outcomes are drawn from a zero-inflated distribution.

    For example a binomial(6,.05) distribution exhibits what some might consider to be a "large" fraction of zeros even though there is no zero-inflation.
    Code:
    . mata (0::6),binomialp(6,0::6,.05)
                     1             2
        +-----------------------------+
      1 |            0   .7350918906  |
      2 |            1   .2321342813  |
      3 |            2   .0305439844  |
      4 |            3   .0021434375  |
      5 |            4   .0000846094  |
      6 |            5   1.78125e-06  |
      7 |            6   1.56250e-08  |
        +-----------------------------+
    I mention all this because while there will be some instances where a zero-inflated distribution is clearly indicated by some maintained data-generating structure, in other instances such structures are not obvious and all the extra modeling efforts one might need to consider for zero-inflated estimation may not even be appropriate.

    I discuss this and related issues in section 2 of this paper https://pubmed.ncbi.nlm.nih.gov/38598916/

    Comment


    • #3
      I have two sets of variables of interest: **vict1-vict5**, which measure victimization, and **dentalw1-dentalw5**, which measure whether someone has attended the dentist. The victimization variables take values from 0 to 3, where 0 means no violent events and 3 means three or more violent events. The dental visit variable is binary, with 1 indicating attendance at the dentist this year and 0 indicating no attendance. I know I can convert the **vict1-5** variables into dummy variables and use logistic regression on the outcome, but are there any alternative models that can be used for the count variable and the logistic model?"

      Let me know if you need further adjustments!


      dataex vict1 vict2 vict3 vict4 vict5 dentalw1 dentalw2 dentalw3 dentalw4 dentalw5

      ----------------------- copy starting from the next line -----------------------
      Code:
      * Example generated by -dataex-. For more info, type help dataex
      clear
      input float(vict1 vict2 vict3 vict4 vict5 dentalw1 dentalw2 dentalw3 dentalw4 dentalw5)
      0 0 0 0 . 1 1 0 0 .
      2 2 0 . . 0 1 0 . .
      0 0 0 0 0 1 1 1 1 1
      0 0 0 0 . 1 1 0 0 .
      0 0 0 . . 1 1 1 . .
      3 3 . . . 0 0 . . .
      1 2 . . . 1 0 . . .
      2 0 2 . . 0 0 1 . .
      0 0 0 1 1 0 0 0 0 0
      2 . . 0 0 1 . . 1 1
      0 0 0 0 0 1 1 0 0 1
      1 1 1 . . 1 0 0 . .
      0 0 2 1 . 1 1 1 1 .
      2 3 . . . 0 1 . . .
      3 2 . 0 . 0 0 . 1 .
      0 3 1 0 0 1 1 0 0 0
      0 . 0 0 . 1 . 0 0 .
      1 1 0 0 . 1 0 0 1 .
      0 0 0 . 0 0 0 1 0 0
      0 0 0 3 0 0 1 0 0 1
      0 0 0 0 . 0 0 1 0 .
      0 0 0 0 . 0 0 0 0 .
      . 2 . 0 . 1 1 . 1 0
      1 0 . . . 1 1 . . .
      0 0 . . . 1 1 . . .
      0 0 0 0 . 0 0 1 0 .
      0 0 0 0 . 0 1 1 1 .
      0 0 . . . 0 0 . . .
      1 1 . . . 1 0 . 1 .
      0 0 . 0 . 1 1 . 1 .
      0 0 0 0 0 0 0 1 1 0
      0 0 0 0 0 1 1 0 1 1
      2 3 . 0 . 0 1 . 0 .
      0 0 0 0 0 0 0 0 1 1
      2 2 . . . 1 1 . . .
      2 1 0 0 . 0 0 0 0 1
      0 1 0 0 . 1 0 1 1 .
      0 0 0 0 0 1 1 1 0 0
      0 0 0 1 . 1 1 0 0 .
      0 0 . . . 0 0 . . .
      0 0 0 0 0 0 0 1 0 1
      1 0 1 0 0 0 0 1 0 0
      0 0 . . . 0 0 . . .
      0 0 1 1 1 0 0 1 0 0
      0 . . . . 0 . . . .
      0 0 0 . 0 1 1 1 1 1
      0 0 2 1 . 1 1 1 1 .
      0 0 0 0 0 1 0 1 0 1
      0 0 . 0 0 0 1 . 1 0
      1 0 1 0 . 1 0 1 0 .
      2 3 2 0 . 0 1 0 1 .
      0 0 0 0 . 1 1 1 0 .
      0 0 . . . 1 1 . . .
      1 0 . . . 0 0 . . .
      0 0 0 0 . 1 1 1 1 .
      0 0 0 1 . 1 1 1 1 .
      0 0 0 0 . 0 0 0 1 .
      0 0 . 0 0 1 1 . 0 1
      0 0 . . . 0 0 . . .
      3 0 1 0 . 1 1 0 0 .
      0 . 0 . 0 1 . 1 . 0
      0 0 . 0 . 1 0 . 1 .
      1 0 1 2 2 0 0 0 0 0
      2 0 0 0 0 0 0 1 0 1
      0 0 0 0 0 0 0 0 0 1
      0 . . . . 1 . . . .
      0 0 0 . . 1 1 1 . .
      1 3 1 0 0 0 0 1 1 1
      0 0 . 0 0 1 1 0 0 1
      1 0 0 0 . 1 1 1 1 .
      0 0 0 0 . 0 1 0 1 .
      1 2 2 0 . 0 1 1 0 .
      1 0 . 1 . 1 0 . 0 .
      0 0 0 . . 1 1 0 . .
      0 0 0 0 . 1 1 1 0 .
      0 0 0 0 0 0 1 1 1 1
      0 0 0 . . 1 1 1 1 0
      0 0 0 0 0 0 0 0 0 1
      0 0 . 0 0 0 1 . 1 1
      0 0 0 0 0 1 1 1 1 0
      0 1 0 0 0 1 1 1 0 0
      0 . . 0 . 1 . . 0 .
      0 0 0 0 1 1 1 0 0 0
      0 0 0 . . 0 0 1 . .
      0 0 0 0 . 0 0 1 0 .
      0 1 0 0 0 0 0 1 0 0
      2 2 0 0 . 1 1 0 1 1
      0 0 0 . 0 1 0 1 1 1
      0 0 0 0 . 0 0 0 0 .
      0 0 0 0 0 0 1 1 1 0
      1 0 0 . . 1 1 0 1 .
      0 0 0 0 . 1 0 0 0 .
      0 3 0 . . 0 0 0 0 .
      0 0 0 . . 1 1 0 1 .
      0 0 1 0 0 1 1 1 0 0
      0 0 . . . 0 0 . . .
      0 0 0 0 0 1 1 1 1 0
      0 0 . 0 . 0 1 . 1 .
      0 0 . 0 . 1 1 . 0 .
      0 0 0 0 0 0 1 0 1 1
      end
      label values dentalw1 dental_exam_label
      label values dentalw2 dental_exam_label
      label values dentalw3 dental_exam_label
      label values dentalw4 dental_exam_label
      label values dentalw5 dental_exam_label
      label def dental_exam_label 0 "More than 1 year", modify
      label def dental_exam_label 1 "Within 1 Year", modify
      ------------------ copy up to and including the previous line ------------------

      Comment

      Working...
      X