3

I have information about a negative binomial distribution at the 10%, 50%, and 90% quantiles. I want to be able to interpolate to know what the probability of a certain count is within this distribution.

For example, I know that the value for the distribution at the 10% quantile is 36.8, at the 50th quantile 50.9, and at the 90th quantile 63.0. How can I determine the probability of a value of 40 within this distribution? I can see that it is likely close to 10% but how can I calculate that number?

mdrishan
  • 207
  • 1
    The negative binomial distribution is discrete, so its quantiles are usually reported as integer values. How did you get fractional quantiles? – Stephan Kolassa Apr 07 '21 at 12:54
  • I'm using AWS Forecast, which returns values at specified quantiles. For the default 10%, 50%, and 90% quantiles, the values returned are fractional. – mdrishan Apr 07 '21 at 12:55
  • Strange. You are certain it uses a negative binomial distribution? – Stephan Kolassa Apr 07 '21 at 12:56
  • You are right, it was not! Instead, it was assuming a student T distribution. I have rerun with a negative binomial likelihood and now have integer values. – mdrishan Apr 07 '21 at 13:14

1 Answers1

3

The simplest approach would be to optimize the parameters of the negbin distribution so that, e.g., the sum of the squared distances between its quantiles and the numbers you have is minimized. For instance, the optim() function in R does this. Note that the negbin quantiles it uses via qnbinom() will be integer, and that fractional quantiles for a discrete distribution are a bit dubious, anyway.

> foo <- optim(par=c(10,50),fn=function(params){
+ (36.8-qnbinom(0.1,size=params[1],mu=params[2]))^2+
+ (50.9-qnbinom(0.5,size=params[1],mu=params[2]))^2+
+ (63.0-qnbinom(0.9,size=params[1],mu=params[2]))^2})
> foo$par
[1] 33.4375 50.6250
> 
> # Test:
> qnbinom(0.1,size=foo$par[1],mu=foo$par[2])
[1] 37
> qnbinom(0.5,size=foo$par[1],mu=foo$par[2])
[1] 50
> qnbinom(0.9,size=foo$par[1],mu=foo$par[2])
[1] 65
> 
> pnbinom(40,size=foo$par[1],mu=foo$par[2])
[1] 0.1867327

The cumulative probability of 40 is about 19%. Given the non-integrality of quantiles, I would not report anything more precise.

Stephan Kolassa
  • 123,354