## Re: An easy Example of Hypergeometric Distribution

Frequent Contributor
Posts: 108

# Re: An easy Example of Hypergeometric Distribution

Thanks Reinhard, i corrected it .
Frequent Contributor
Posts: 108

## An easy Example of Hypergeometric Distribution

[ Edited ]
```/*Question:50 students 40 male ,10 Female you select 5 person what is the probability 4 will be male *//*x = success.N = Population . R = Number of total x in N (Out of total population 50 ,Male is 40 and Female is 10. n = select  */

data prob;
/* PDF ('HYPER', x, N, R, n <, o>) */
Proba = PDF('HYPER',4,50,40,5);
proc Print;
run;

/* 5 selected 4 will be female */
data prob;
/* PDF ('HYPER', x, N, R, n */
Proba = PDF('HYPER',4,50,10,5);
proc Print;
run;
```
Posts: 1,256

## Re: An easy Example of Hypergeometric Distribution

The question in line 1 is: "... what is the probability 4 will be male".

The answer (0.431337...) could be obtained with this one-liner:

``%put %sysfunc(pdf(HYPE,4,50,40,5));``

But in fact I, too, would be more interested in the question you switched to: what the chances are that "4 will be female. (The result is less pleasing, though: only 0.003964...)

Did you perhaps intend to calculate PDF('HYPER',4,50,40,5) in the first of the two data steps?

SAS Super FREQ
Posts: 4,245