How to solve glmmTMB object not found error?

Viewed 88

It seems a bit silly to post this as a question, but I haven't been able to find an answer for this. I want to use the glmmTMB package for modelling data with zero-inflation, but when I try to fit the model I want, the function glmmTMB() returns the following error:

Error in glmmTMB(y ~ x + (1 | z), data = df, ziformula = x) : object 'x' not found

This only happens after I introduce the term for ziformula. The model without that term works just fine. For some reason, it seems that the ziformula overrides the data command in the function.

My glmmTMB package version is 1.1.3 and my R version is 4.1.1.

Here's a little sample data to reproduce the problem:

df <- data.frame(y=c(2,2,5,7,3,8,3,2,4,6),
                    x = c(23,21.7,22.5,18,20,19.9,21,20.3,20,20.5),
                    z = c(rep("a",5),rep("b",5)))
glmmTMB(y ~ x + (1|z), data = df, ziformula = x)

If anyone has had any similar issue, I would be grateful for any tips on how to solve it!

0 Answers
Related