Gamma model rejecting initial value

I am trying to fit models using the Gamma family in brms for the first time. My dv is greater than zero and very skewed. I am using the following code:

b1 ← brm(total_sec ~ mat + mcat, data = data2, chains=2,
family = Gamma(link=“log”))

However, I keep getting the following error message:


Chain 1: Rejecting initial value:
Chain 1: Error evaluating the log probability at the initial value.
Chain 1: Exception: gamma_lpdf: Inverse scale parameter[4] is 2331, but must be > 0!


I have tried constraining init=0, but that doesn’t seem to help. When it comes to the gamma function, I am not sure the constraint on the inverse scale parameter. Any help would be greatly appreciated.

Can you share some example data and a model specification that reproduces this for you?

3 Likes

The information provided is not enough to help here.
Would you mind giving us an example of the data? I guess you want your scale to be positive-greater than 0 otherwise is undefined. Typically initial values are -2,2. Not sure about brms in particularly.

I found a similar question here that seems to be related
Fitting Gamma model with brms