• incanter

# combination-distribution

## incanter.distributions

• (combination-distribution n k)

Create a distribution of all the k-sized combinations of n integers.
Can be considered a multivariate distribution over k-dimensions, where
each dimension is a discrete random variable on the (0, n] range (though
these variables are decidedly non-independent).

A draw from this distribution can also be considered a sample without
replacement from any finite set, where the values in the returned
vector represent the indices of the items in the set.

Arguments:
n The number of possible items from which to select.
k The size of a sample (without replacement) to draw.

test-statistic-distribution, integer-distribution, pdf, cdf, draw, support

References:
http://en.wikipedia.org/wiki/Combination

Examples:

### Source incanter/distributions.clj:249 top

```(defn combination-distribution
"
Create a distribution of all the k-sized combinations of n integers.
Can be considered a multivariate distribution over k-dimensions, where
each dimension is a discrete random variable on the (0, n] range (though
these variables are decidedly non-independent).

A draw from this distribution can also be considered a sample without
replacement from any finite set, where the values in the returned
vector represent the indices of the items in the set.

Arguments:
n		The number of possible items from which to select.
k		The size of a sample (without replacement) to draw.

test-statistic-distribution, integer-distribution, pdf, cdf, draw, support

References:
http://en.wikipedia.org/wiki/Combination

Examples:

"
[n k]
(assert (>= n k)) (assert (and (<= 0 n) (<= 0 k)))
(Combination. n k (integer-distribution 0 (nCk n k))))```
Vars in incanter.distributions/combination-distribution: <= >= and assert defn
Used in 0 other vars