Re: sample()
- Posted by Jerome Apr 01, 2011
- 1490 views
To throw in some math, here are the basic categories of sampling to find the total number of possibilities:
Type | Order important | Order not important |
---|---|---|
Sample w/ replacement | n^r | ( (n+r-1) / r) -> binomial coefficient |
Sample w/o replacement | n! / (n-r)! | n! / ((n-r)! r!) |
n is the number of objects you are choosing from
r is the number of selections
For example:
Tossing a die two times is sampling w/ replacement and order matters (rolling 4,6 is different than rolling 6,4): 6^2 = 36 combinations
The number of ways to select 2 people from a list of 5 is sampling w/o replacement and order does not matter: 5! / (3!2!) = 10 ways
Hope this helps,
Ira