Exception: neg_binomial_2_log_glm_lpmf: Precision parameter is 0, but must be positive finite!

Short summary of the problem

Hi there,

I was trying to fit a negative binomial model with rbms and kept receiving such warning messages,
“Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
Chain 4 Exception: neg_binomial_2_log_glm_lpmf: Precision parameter is 0, but must be positive finite! (in ‘/scratch/tmp/RtmplN2FN4/model-1a00d017791c7d.stan’, line 37, column 4 to column 65)
Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.” Even after adjusting control=list(adapt_delta=0.999), the issue remains, can anyone help me fixing this?

Another question is what’s the difference between using “offset(log(time))” and “counts|rate(time)”?

Thank you very much in advance for your reply!

code_to_run_your_model(if_applicable)

model1 <- bf(counts ~ 1 + period  + arm:period + baseline + offset(log(time)), family = negbinomial("log"))
prior1 <- get_prior(model1, dd)

brmfit1 <- brm(model1,
               data=dd,
               family = negbinomial("log"),
               prior = prior1,
               control=list(adapt_delta=0.999),
               refresh = 0, silent = 0, seed = 0312)

Do you get these warnings sporadically or all the time until sampling ends?

Googling with the terms “brms offset rate” finds the brms doc page Set up a model formula for use in brms — brmsformula • brms

For log-linear models such as poisson models, rate may be used in the aterms part to specify the denominator of a response that is expressed as a rate. The numerator is given by the actual response variable and has a distribution according to the family as usual. Using rate(denom) is equivalent to adding offset(log(denom)) to the linear predictor of the main parameter but the former is arguably more convenient and explicit.