I would like to fit a negative binomial distribution to a dataset, which sometimes shows right censored data, only showing values like > 70000. Numbers a generally very high in the dataset as it bacteria counts.
I tried to do so, by running:
brm(bf(y | cens (censored) ~1), data = data)
I received the following error:
Chain 1: Rejecting initial value: Chain 1: Log probability evaluates to log(0), i.e. negative infinity. Chain 1: Stan can't start sampling from this initial value.
To debug I created some testdata, using a Poisson, and included a single right censored indicator, like this:
df <- data.frame(y = rpois(100, lambda)) df$cens <- ifelse(df$y == max(df$y), 1, 0) model <- brm(bf(y|cens(cens) ~ 1), family = "negbinomial", data = d)
For lambda = 50 it still works, however, for lambda = 5000 it shows the same error. (I did not try to find out at which point exactly the problem starts to occur).
Does anyone know about this behaviour and how to solve it?
- Operating System: Windows 10
- brms Version: 2.16.1