functionGenerateVariate
Generates Variates
Information
GenerateVariate
Syntax
GenerateVariate(distribution,g,p1,p2,p3,p4)
Description
This function generates a random variate from the distribution indicated with the integer pararameter "distribution", using the following value correspondence:
- 1 = Constant
- 2 = Bernoulli
- 3 = Discrete Uniform
- 4 = Binomial
- 5 = Geometric
- 6 = Negative Binomial
- 7 = Poisson
- 8 = Uniform
- 9 = Exponential
- 10 = Erlang
- 11 = Gamma
- 12 = Weibull
- 13 = Normal
- 14 = LogNormal
- 15 = Beta
- 16 = Johnson (bounded and unbounded)
- 17 = Triangular
- other value = initalization of the generator (call to initGenerator() function).
Examples
(u,g) := GenerateVariate(2,g,0.4); // Generates a discrete variate (u) with Bernoulli(0.4) probability distribution. (u,g) := GenerateVariate(11,g,0.4,0.6); // Generates a continuous variate (u) with Gamma(0.4,0.6) probability distribution. The example VariatesSimple2 uses of this function.
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | distribution | ||
| Generator | g | ||
| Real | p1 | 0 | |
| Real | p2 | 0 | |
| Real | p3 | 0 | |
| Real | p4 | 0 |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real | u | ||
| Generator | gout |