Hi,
I am trying to write custom functions for the _cdf/_lcdf for the gompertz distribtion Wikipedia
I have been successful with other standard parametric survival functions which are either implemented already or by custom functions. The gompertz is however challenging for me and I am unable to avoid under-/overflow issues. I have tried algebraic manipulation and using log1m/log1p and logsumexp without any success. I have done this in JAGS previously with the zeroes trick and modeling survival and hazard separately. Translating the JAGS-code may be an option, however it would be neat if this has already been done or if there are obvious ways to solve this.
I have written the gompertz _lpdf and _lccdf which does not seem to under-/overflow. I assume it is due to the double exp in the cdf.
I have not been successful in translating the discussions on BRMS in this thread and have tried several alternative ways, including splitting up the equation into multiple steps. Copy-pasting the simplest version of my _cdf function below. Any help is highly appreciated!
functions {
real gompertz_cdf (real y, real b, real eta) { // Not implemented in STAN, custom cdf-function
return 1 - exp(-eta*(exp(b*y) - 1));
}
}