Skip to content

Spatial structure in hurdle glmmTMB

3 messages · KIRKLAND, MAIRE E., Mollie Brooks

#
Hi all,

I am trying to use the glmmTMB package (version 1.1.0) to run a hurdle model that includes a spatial covariance structure. However, when I try to include spatial information in the zero-inflated part of the model I get an error. 

Here is a reproducible example with the error message that I receive: 

library(glmmTMB)

d <- data.frame(count = as.vector(Salamanders$count),
                mined = as.vector(Salamanders$mined),
                x = as.vector(row(Salamanders)),
                y = as.vector(col(Salamanders)))

d$pos <- numFactor(scale(d$x), scale(d$y))
d$ID <- factor(rep(1, nrow(d)))

m <- glmmTMB(count ~ mined + mat(pos + 0 | ID), 
                zi = ~., 
                family = truncated_poisson, data = d
 )

"Error in Reduce(addForm0, list(...)) : object 'mined' not found? 

Is there a way of including a spatial structure in both parts of the hurdle model?

Any help would be much appreciated!

M?ire
#
Hi M?ire, 

It sounds like you found a bug. Thank you for the easily repeatable example. 

Would you like to file an issue on GutHub, or should I?
https://github.com/glmmTMB/glmmTMB/issues

cheers,
Mollie
#
Hi Mollie,

Thanks so much for your reply. I have filed it as an issue on GitHub.

Best wishes, 

M?ire