Some sampling methods for various discrete and continuous random variables.
| distribution | params | notes |
|---|---|---|
| uniform | - | |
| binomial | n,p | |
| neg. binomial | r,p | |
| cauchy | center,scale | |
| exponential | k | |
| laplace | center,scale | |
| poisson | mean | |
| normal | mean, std. dev | |
| gamma | shape, rate | |
| beta | shape | |
| dirichlet | alphas | |
| chi-squared | center,spread |
cocurrent 'sampling'NB. 10 i.i.d. uniform samples taken from U(0,1) distribution.
uniformSample 10NB. 10 random variables independently sampled from a N(2.5,6.4)
NB. normal distribution.
normalSample 2.5 6.4 10NB. 1000 random variables independently sampled from an
NB. exp(10) distribution.
exponentialSample 10 1000NB. 1000 random variables independently sampled from a
NB. Po(2.222) poisson distribution.
exponentialSample 2.222 1000NB. 200 random variabled independently sampled from a Cauchy(0,1)
NB. distribution.
cauchySample 0 1 200NB. 4000 random variables independently sampled from a NB. Gamma(4.6,1) gamma distribution.
gammaSample 4.6 1 4000 NB. 1000 random variables independently sampled from a
NB. Beta(2,4) beta distribution.
betaSample 2 4 4000 NB. 100 random variables independently sampled from a
NB. Bin(10,0.4) binomial distribution.
binomialSample 10 0.4 100 NB. 100 random variables independently sampled from a
NB. NegBin(10,0.4) binomial distribution.
binomialNegSample 10 0.4 100 NB. 100 random variables independently sampled from a
NB. Dir(0.2, 0.1, 0.99, 0.5, 1.4) dirichlet distribution,
NB. where the parameters are the parameter 'a' of a
NB. Gamma(a,1) distribution.
dirichletSample 10 0.4 100 NB. 1000 random variables independently sampled from a
NB. Laplace(0,2) laplace distribution.
laplaceSample 0 2 1000 NB. 1000 random variables independently sampled from a
NB. ChiSq(0,1,3) chi-squared distribution.
chiSqSample 0 1 3 1000