I've asked about this before but I don't think I ever received any replies. Can OpenMx handle Poisson counts as observed variables? I have counts that are too small to treat as continuous Normally distributed outcomes and I need a way to model them. Any insights would be greatly appreciated.

hi

I want to add poisson likelihood function in growth mixture model for dependent variable.I need to model count variable.

Any insights would be greatly appreciated.

Yes, OpenMx can utilize the Poisson likelihood function, but it is not built-in. You will have to set up your model using an algebra objective or an R objective. See my examples below. Note that if your count variable takes relatively few unique values in your sample, you could consider ordinalizing it and doing the analysis as an ordinal thresholds model instead.

Let's first simulate some data for some simple examples:

If we want to do a simple Poisson regression, setting up the model to use a row-algebra objective would look something like this:

If we want to do the same analysis, but with an R objective, the code would look something like this:

Note that the two models' likelihood functions are not equal, but merely proportional. So, the parameter estimates should be the same (or very very close), but the value of the -2loglikelihood won't be. It sounds as though you have a longitudinal mixture analysis in mind, so naturally, your objective function will be way more complicated than the ones I demonstrated here, but I hope I've given enough to get you started. I might be able to help you more if you say more about the analysis you want to do.

Finally, I feel I certainly should warn you about the problem of overdispersion, in case you don't know. If your count variable's variance appreciably exceeds its mean, even after conditioning on covariates, you should not trust the standard errors, confidence intervals, and likelihood-ratio tests from models using the classic Poisson likelihood. You would need to adjust those inferential results appropriately, or use a different objective function. The point estimates of your regression coefficients won't be biased by the overdispersion, though.

I have poisson count data that is zero-inflated. I was wondering if OpenMx can handle that as well?

Thanks!

No reason why not. The zero-inflated Poisson distribution simply has a slightly different PMF. Zero-inflated Poisson is a mixture distribution, but since it's a discrete mixture, it's pretty easy to work with.

Let's first simulate some data for some simple examples:

In the upcoming OpenMx 2.0, it will be practical to do this analysis with a row algebra fitfunction. I'll assume you're still using 1.3.2/1.4, so setting up the model with an R objective would look like this:

Note that the distribution has two parameters: the parameter of the Poisson mixture component (lambda) and the zero-inflation proportion (w). Both can be conditioned upon covariates, as I've done here, using a logit link for the zero-inflation proportion. In general, you can use different sets of covariates for the two parameters.

Edit: I might be able to be more helpful if you mentioned a few more details about your dataset and the analysis you're trying to do.

Currently, we plan to implement built-in support for count distributions in a future version of OpenMx, made available via the UI for IFA models.

There is a demo in the OpenMx test suite that shows how to do a generalized estimating equations (GEE) analysis of repeated measures on an overdispersed count variable. It includes a loop to calculate robust standard errors from the "sandwich estimator" of the regression coefficients' repeated-sampling covariance matrix. However, the specification in OpenMx is rather cumbersome, and it will usually be easier to do GEE in software designed specifically for it (e.g., the R package 'gee').

Also, I have a recent paper on the use of multivariate discrete distributions to estimate biometric variance components from overdispersed count data collected in a twin study.

Has built-in support for count distributions been implemented yet? I'd like to do some IFA analyses of count variables (i.e., https://doi.org/10.3102/1076998610375838), and I'm hoping I might be able to avoid writing my own fit function.

OpenMx's IFA module does not yet have support for count distributions. However, the density and cumulative-probability functions for the Poisson and negative binomial are usable in MxAlgebras. I have attached a script I wrote back in March that fits an ACE twin model to two normally distributed phenotypes and one count phenotype. The count phenotype follows a negative-binomial distribution, but is presumed to reflect a latent, standard-normal "liability" trait. The count variable is actually treated as an ordinal-threshold variable, with one threshold for each possible count within the range of counts observed in the sample. But, the thresholds are not themselves free parameters, but instead are functions of the two parameters of the negative-binomial distribution. The negative-binomial cumulative-probability function and the standard-normal quantile function are used to map each distinct count to a corresponding standard-normal quantile.