Hello,

I have a CDF function and I would like to find its quantile function so that it can be used to generate Random Numbers in Stan to perform posterior predictive check. Since it is non-linear so could not find its inverse ie quantile function. Hence I convert CDF to another form so that it can be solved to get the quantile function using an algebra solver. I have read the stan users guide to learn algebra solver many times but my problem is a little bit different from the example given in the user guide. Is it possible to get a quantile function from the algebra solver so that it can be used in generated quantities block to generate RNG?

My CDF is like this

F(x){\text{ }} = {\text{ }}1 - \frac{1} {{(1 - e^{ - \lambda } )}}\left[ {1 - \exp \left\{ { - \lambda \left( {1 - e^{ - \beta /x} } \right)\exp ( - \alpha e^{ - \beta /x} )} \right\}} \right]{\text{ }}

and I converted it to this form

{\text{log(}}1 - e^{ - \beta /x} ) - \alpha e^{ - \beta /x} - \log (1 - z) = 0

here \alpha, \beta and \lambda are parameters and I wanted to solve it for x using algebra solver and its root is quantile function that can be used in generated quantities block to generate RNG

where,{\text{ }}z = 1 + \frac{1} {\lambda }\log \left\{ {1 - (1 - e^{ - \lambda } )(1 - p)} \right\};{\text{ }}0 < p < 1

Thank You