I am getting a seemingly erroneous error message on a hurdle lognormal model run on a multiply imputed dataset, converted to a mids object via the mice package.
These are the data
d.RData (31.4 KB)
Panel data from a trial estimating the average difference in a right-skewed outcome with about five percent 0 scores between placebo and group x (predictor group) at each of six measurement occasions, weeks 0, 3, 6, 9, 12, and 24 (predictor weekFac). Random effects are participant ID (pid) nested within study site (site).
Data look like this
and
library(mice)
library(brms)
# convert imputed dataset to mids object
mids_week <- mids(d)
# data range is from 0 to 14
range(mids_week$data$outcome,
na.rm = T)
# output
[1] 0 14
# run model
fit <- brm_multiple(formula = bf(outcome ~ group*weekFac + (1|site/pid),
hu ~ group*weekFac),
data = mids_week,
family = hurdle_lognormal(),
seed = 1234,
refresh = 0)
# error message
Error in `data_response.brmsframe()`:
! Family 'hurdle_lognormal' requires response greater than or equal to 0.
Run `rlang::last_trace()` to see where the error occurred.
The error message says that for a hurdle lognormal the outcome needs to be greater than 0 or equal to zero, which the outcome variable is (range between 0 and 14).
A truncated normal model on the same dataset
fit_trunc <- brm_multiple(formula = outcome | trunc(lb = 0, ub = 14) ~ group*weekFac + (1|site/pid),
data = mids_week,
family = gaussian(), # truncated family
save_pars = save_pars(all=TRUE),
chains = 4,
seed = 1234,
threads = threading(3))
Returns a similar error
Error in `data_response.brmsframe()`:
! Some responses are outside of the truncation bounds.
Run `rlang::last_trace()` to see where the error occurred.
The mids dataset includes the original data as the first dataset, followed by ten imputed datasets with no missing data. Could it be these missing data that are causing the problem? It doesn’t cause issues with regular brm() function but maybe brm_multiple() has issues?
Any help/advice much appreciated.

