Negative binomial regression and right censored data not working at higher values

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?

Best,

  • Operating System: Windows 10
  • brms Version: 2.16.1

You may have to specify some initial values for key parameters.

1 Like

Agreed, you probably need a higher mean for your NB or Poisson distribution for initialisation so the very-close-to-zero probability of an extremely high, censored value doesn’t underflow to negative infinity on the log-probability scale.

1 Like

@Solomon wrote up a very nice post about how to set initial values for brms.

1 Like