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

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Re: An easy Example of Hypergeometric Distribution

- 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
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-08-2015 02:44 AM

Thanks Reinhard, i corrected it .

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-07-2015 03:35 AM - edited 11-08-2015 02:43 AM

/*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;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-07-2015 10:51 AM

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?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-10-2015 02:42 PM

I'm not sure wqhat your question is. If you want to learn about how to simulate data from the hypergeometric distribution in SAS, see the article "Balls and urns: Discrete probability functions in SAS"

If you want to ask about how to compute probabilities for various scenarios, see "Four essential functions for statistical programmers."