Does lower-bound truncation currently work with hurdle models (e.g. hurdle_gamma)? I can’t seem to find documentation either way; only that truncation should work for all brms families except categorical, ordinal and mixture.
I’m having a problem with the zeroes in the data causing a “Error: some responses are outside of the truncation bounds” – which makes perfect sense if the truncation limits are somehow applying themselves to the hurdle step of the model.
And I’m afraid I’m not competent to tell from the generated Stan code where the issue might be.
- Operating System: Windows 10
- brms Version: 2.7.0
Example:
library(brms)
library(data.table)
Generate data
set.seed(123)
hurdle_gamma <- rbind(data.table(“X” = rgamma(1000,scale = 100, shape = 1)),data.table(“X” = rep(0,100)))
Truncate non-zero values to lower bound at 100
truncated_hurdle_gamma <- hurdle_gamma[X == 0 | X > 100,]
hist(truncated_hurdle_gamma$X)
truncated_hurdle_formula <- bf(X | trunc(lb = 100) ~ 1) + hurdle_gamma()
get_prior(truncated_hurdle_formula, data = truncated_hurdle_gamma)
truncated_hurdle_model <- brm(truncated_hurdle_formula,
data = truncated_hurdle_gamma,
prior = prior(normal(0,10), class = “Intercept”),
cores = 4,
chains = 4,
iter = 2000,
warmup = 1000)
Error: Some responses are outside of the truncation bounds.
Appreciate any assistance, either setting me straight on some mistake I’ve made, or seeing whether it’d be possible to modify the package to allow this. Thanks.