I'm working with a latent variable model and I'd like to predict a negative binomial count response variable. I found the clever cludge that @AdminRobK previously shared to use thresholds fixed to parametric quantiles for negative binomial distribution (#7856; 180313.R ). I think this approach will work well for me. The issue I've got is that my dependent variable is clearly zero-inflated. I've also got some minor observation-number differences that I'd like to incorporate as an offset.

I'm not exactly sure how to marry a zero-inflation model with the threshold parameterization of the negative binomial Rob used there? Can anyone offer a suggestion?

For the offset, with this parameterization, would it be correct to just add the log(number of observations) as a predictor in my model with a fixed coefficient of 1.0?

Thanks!

Hi, Brenton! As of OpenMx v2.18, that kludge of mine has built-in support, and it includes zero-inflation. The relevant function is

`mxMarginalNegativeBinomial()`

, which has an argument for the zero-inflation proportion,`zeroInf`

. This test script demonstrates its use (in the OpenMx source repository, it's tests/testthat/test-discrete.R .Could you say a bit more about the offset to which you refer?

Awesome! That's great!

For the offset: I've got substance use days for participants, but the time periods for each participant vary somewhat--some participants have 25 days of data, some 30, etc. If I were fitting an observed variable Poisson model, I would use a linear predictor like this:

log(count_dv) = log(days_observed) + β0 + β1x1 + β2x2 + …

So log(days_observed) is an offset/variable with coefficient fixed to 1.0.

OK, I think I get it. Sounds reasonable.

Just to be sure I'm interpreting these results correctly. Below, use_days_1_30_Use and use_days_1_30_Incar are specified with:

The Estimate for the Delta → use_days paths are regression coefficients on the normal latent "liability" variable underlying the negative binomial indicators, correct?

Do the Discrete parameters 1, 2, 3 correspond to the zero-inflation, size/dispersion, and mu parameters, respectively? (Could those be given informative labels in the output?) Are size and prob/mu parameterized as in ?pnbinom (that is NB2)? And the zero-inflation parameter is the marginal probability of 0 parameter from the binomial model?

Thanks!

> Do the Discrete parameters 1, 2, 3 correspond to the zero-inflation, size/dispersion, and mu parameters, respectively? (Could those be given informative labels in the output?)

You can easily figure it out using code like this,

Where the values show up in

`mxMatrix`

`Discrete`

tells you the meaning of the parameter. You can add labels to the`Discrete$labels`

matrix to get labelled output in the summary table.> Are size and prob/mu parameterized as in ?pnbinom (that is NB2)?

You can use

`mxGetExpected(model, "thresholds")`

to check whether the proportions match what you expect.> And the zero-inflation parameter is the marginal probability of 0 parameter from the binomial model?

Actually I think it is the extra probability of zero beyond what the binomial model would predict.

Also, is it possible to disable the zero-inflation parameter?

Yes, just set it fixed to 0 or whatever value you prefer.

Ah, of course.