I'm working with a dataset with a large number of zero-counts on the response variable. This dataset consists of qualitatively coded interviews in a number of important categories, but many of the interviews don't contain information about the categories (hence, the zero-inflation). Here is a general description of some of the variables:
time: number of days since the start of data collection (numerical) party: political party of the interviewee (factor) network: news network the interview aired on (factor) code: count data of the number of times the code is mentioned in a given interview (numerical) - this is the zero-inflated response variable name: the individual politician who gave the interview (factor, used in the random effect nested within party)
Here is a histogram of one of the codes I'm interested in modeling.
I've been trying to model this data using a Tweedie distribution (which I've been told is more robust than Poisson or negative binomial distributions) or a zero-inflated Poisson distribution, but both are resulting in error messages in my code.
Here is some of my code:
real.mod.p <- gamm4(code ~ party + s(time, by=party, k=20), random =~ (1 | name/party), data=dat, family=tw)
I have no problems running this model with the gaussian family or the Poisson family, but when I switch the family to tw I get the following error message:
Error in as(value, fieldClass, strict = FALSE) : internal problem in as(): “extended.family” is(object, "family") is TRUE, but the metadata asserts that the 'is' relation is FALSE
Similarly, when I switch the family to be a zero-inflated Poisson model using the following code:
real.mod.p <- gamm4(code ~ party + s(time, by=party, k=20), random =~ (1 | name/party), data=dat, family=ziplss)
I get this error message:
Error in eval(family$initialize, rho) : object 'E' not found
Is there a way to remedy these error messages so I can use one of these families to analyze my data? Is there a better family I should be using for this zero-inflated data? Thank you for your help.