Given any threshold value, I am interested in obtaining a quantity of interest using the inverse negative binomial distribution. This requires extracting the value from the discrete CDF and I am using the Quantile(X, threshold value) function.
The parameters of the NBD are given as r and p and the routine I have written (attached) works in some cases, but I have noticed that, for small values of p, the Maple program runs for excessive times to attempt to output the Quantile solution. For instance, if p = 0.3, the solution is fast but when p = 0.003, Maple continues to evaluate the solution with no result (I have interrupted computations after 2 hours).
In the attached example, p is set to 1.965 and r is 0.5. The threshold value is 0.98 and the associated solution, Q, for this value is determined to be Q=7.
Does anybody know how to help with this? I would be grateful for any help along the way.