Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Quantile of Negative Binomial and Hypergeometric distributions

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 10, 2018 2:39 AM
(6319 views)

Hi All,

Is there way to get quantile of Negative Binomial and Hypergeometric distributions?

Thanks.

2 ACCEPTED SOLUTIONS

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Created:
Jan 16, 2018 11:02 AM
| Last Modified: Jan 16, 2018 12:42 PM
(6761 views)
| Posted in reply to message from ptolomey 01-16-2018

@ptolomey wrote:Hi cwillden,

Thank you for reply.

I bag your pardon for not emphasizing in previous post, that I am interested in finding

Negative BinomialQuantileandHypergeometric Quantilefunctions in JMP.Please notify if you know how to calculate

Quantilefor these descrete distributions.

Thanks.

So, you want the inverse of the CDF then, correct? You want a function where you input a quantile and the distributional parameters and the function returns a value of the random variable that corresponds to the specified quantile? The functions I suggested are the CDF and take a value for the random variable and return the quantile. Just want to make sure we're on the same page.

If so, I don't believe there are built-in functions in JMP, and that may be because they would be a step function if the distribution is discrete. You could write your own quantile functions using loops to find the smallest value of your random variable that is greater than the desired quantile.

For example:

```
Hypergeometric Quantile = function({quantile, N_pop, K, n_samp},
x=0;
condition = 0;
while(!condition,
If(
Hypergeometric Distribution(N_pop, K, N_samp, x) >= quantile,
condition = 1,
x++
);
);
x
);
Hypergeometric Quantile(0.5, 100, 20, 10); //returns the value 2
```

-- Cameron Willden

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Created:
Jan 17, 2018 5:18 AM
| Last Modified: Jan 17, 2018 5:22 AM
(6735 views)
| Posted in reply to message from cwillden 01-16-2018

Hi cwillden,

Thank you for elegant solution.

There is just one comment to it.

The loop provided by you will return **integer random variable + 1 **instead **integer random variable**.

The corrected loop is:

```
while(1,
if(
Hypergeometric Distribution(N_pop, K, N_samp, x) >= quantile,
Break(),
x++
);
);
```

6 REPLIES 6

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Quantile of Negative Binomial and Hypergeometric distributions

Created:
Jan 10, 2018 7:40 AM
| Last Modified: Jan 10, 2018 7:56 AM
(6300 views)
| Posted in reply to message from ptolomey 01-10-2018

Yes! There are functions for both of those distributions. Check out Hypergeometric Distribution() and Neg Binomial Distribution(). For the PMF, check out Hypergeometric Probability and Neg Binomial Probability()

Example of Hypergeometric Distribution:

```
N_pop=100;
K=20;
n_samp = 10;
x=4;
Hypergeometric Distribution(N_pop,K,n_samp,x);
```

Example of Neg Binomial Distribution:

```
p = 0.5; //prob. of success
n = 10; //number of succeses
x = 5;
Neg Binomial Distribution(p, n, x);
```

-- Cameron Willden

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Quantile of Negative Binomial and Hypergeometric distributions

Just to add to @cwillden comment, all such functions are easily found in the Scripting Index

Help>Scripting Index

One needs to learn to go to this documentation as the first stop for such questions.

Jim

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Quantile of Negative Binomial and Hypergeometric distributions

Hi cwillden,

Thank you for reply.

I bag your pardon for not emphasizing in previous post, that I am interested in finding **Negative Binomial** **Quantile **and **Hypergeometric Quantile **functions in JMP.

Please notify if you know how to calculate **Quantile **for these descrete distributions.

Thanks.

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Created:
Jan 16, 2018 11:02 AM
| Last Modified: Jan 16, 2018 12:42 PM
(6762 views)
| Posted in reply to message from ptolomey 01-16-2018

@ptolomey wrote:Hi cwillden,

Thank you for reply.

I bag your pardon for not emphasizing in previous post, that I am interested in finding

Negative BinomialQuantileandHypergeometric Quantilefunctions in JMP.Please notify if you know how to calculate

Quantilefor these descrete distributions.

Thanks.

So, you want the inverse of the CDF then, correct? You want a function where you input a quantile and the distributional parameters and the function returns a value of the random variable that corresponds to the specified quantile? The functions I suggested are the CDF and take a value for the random variable and return the quantile. Just want to make sure we're on the same page.

If so, I don't believe there are built-in functions in JMP, and that may be because they would be a step function if the distribution is discrete. You could write your own quantile functions using loops to find the smallest value of your random variable that is greater than the desired quantile.

For example:

```
Hypergeometric Quantile = function({quantile, N_pop, K, n_samp},
x=0;
condition = 0;
while(!condition,
If(
Hypergeometric Distribution(N_pop, K, N_samp, x) >= quantile,
condition = 1,
x++
);
);
x
);
Hypergeometric Quantile(0.5, 100, 20, 10); //returns the value 2
```

-- Cameron Willden

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Created:
Jan 17, 2018 5:18 AM
| Last Modified: Jan 17, 2018 5:22 AM
(6736 views)
| Posted in reply to message from cwillden 01-16-2018

Hi cwillden,

Thank you for elegant solution.

There is just one comment to it.

The loop provided by you will return **integer random variable + 1 **instead **integer random variable**.

The corrected loop is:

```
while(1,
if(
Hypergeometric Distribution(N_pop, K, N_samp, x) >= quantile,
Break(),
x++
);
);
```

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Quantile of Negative Binomial and Hypergeometric distributions

Hi @ptolomey,

I think the loops are actually equivalent. If the condition is met, x++ is never evaluated again and the loop will break when it returns to check the While condition again. I tested both versions and they return the same values. Although, I think using break() in the while loop is probably preferable to what I did.

-- Cameron Willden

Article Labels

There are no labels assigned to this post.