Model that includes zero-inflated explanatory (not response) variable

To answer my own question in a way that doesn’t include a measurement error model, one can include a dummy variable the encodes the presence/absence of zeros in the explanatory data.

For example:

library(brms)

set.seed(123)
my_data <- data.frame(
  response = rnorm(100),
  explanatory = c(rep(0, 50), rnorm(50, mean = 5))) |>
  mutate(zeros = ifelse(explanatory == 0, 0, 1)

my_model <- brm(
  bf(response ~ zeros +  explanatory:zeros),
  data = my_data
)

One now has a “global” intercept that applies to the explanatory component of the model and an intercept that applies just to the circumsance where the explanatory is equal to 0.

1 Like