Question: Problem with inverse Negative Binomial Distribution

 

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. 


 

restart; with*Statistics; with(plots)

r := 1.965; p := .5

1.965

 

.5

(1)

with(Statistics)

R := RandomVariable(NegativeBinomial(r, p))

ProbabilityFunction(R, u)

Set the value of the CDF probability, α.

Evaluate the inverse CDF to return the quantity of interest, Q.

 

alpha := .98

.98

(2)

X := NegativeBinomialVariable(r, p); X := RandomVariable(NegativeBinomial(r, p))

CumulativeDistributionFunction(X, alpha)``

Q := Quantile(X, alpha)

7.

(3)

DensityPlot(X, title = "PDF")

 

plot(CDF(X, s), title = "CDF")

 

``

``NULL

``

``


 

 

Please Wait...