functionGenerateVariateWrap

Generates Variates

Information

GenerateVariate

Syntax

GenerateVariate(Cg1,Cg2,Cg3,Cg4,Cg5,Cg6,Bg1,Bg2,Bg3,Bg4,Bg5,Bg6,Ig1,Ig2,Ig3,Ig4,Ig5,Ig6,Anti,IncPrec,distribution,p1,p2,p3,p4)

Description

This function generates a random variate from the distribution indicated in 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).
Using this function, the generation of random variates in models can be easily parametrized.

This function receives as parameters the individual components of a CMRG generator, instead of the record like in the GenerateVariate function.
It returns the updated state of the generator also with its individual components.

Examples

 (u,g.Cg1,g.Cg2,g.Cg3,g.Cg4,g.Cg5,g.Cg6,g.Bg1,g.Bg2,g.Bg3,g.Bg4,g.Bg5,g.Bg6,g.Ig1,g.Ig2,g.Ig3,g.Ig4,g.Ig5,g.Ig6,g.Anti,g.IncPrec) := 
GenerateVariate(g.Cg1,g.Cg2,g.Cg3,g.Cg4,g.Cg5,g.Cg6,g.Bg1,g.Bg2,g.Bg3,g.Bg4,g.Bg5,g.Bg6,g.Ig1,g.Ig2,g.Ig3,g.Ig4,g.Ig5,g.Ig6,g.Anti,g.IncPrec,2,0.4); // Generates a discrete variate (u) with Bernoulli(0.4) probability distribution. (u,g.Cg1,g.Cg2,g.Cg3,g.Cg4,g.Cg5,g.Cg6,g.Bg1,g.Bg2,g.Bg3,g.Bg4,g.Bg5,g.Bg6,g.Ig1,g.Ig2,g.Ig3,g.Ig4,g.Ig5,g.Ig6,g.Anti,g.IncPrec,) :=
GenerateVariate(g.Cg1,g.Cg2,g.Cg3,g.Cg4,g.Cg5,g.Cg6,g.Bg1,g.Bg2,g.Bg3,g.Bg4,g.Bg5,g.Bg6,g.Ig1,g.Ig2,g.Ig3,g.Ig4,g.Ig5,g.Ig6,g.Anti,g.IncPrec,11,0.4,0.6); // Generates a discrete variate (u) with Gamma(0.4,0.6) probability distribution. The example VariatesSimple2 uses of this function.

Inputs

TypeNameDefaultDescription
RealinCg1
RealinCg2
RealinCg3
RealinCg4
RealinCg5
RealinCg6
RealinBg1
RealinBg2
RealinBg3
RealinBg4
RealinBg5
RealinBg6
RealinIg1
RealinIg2
RealinIg3
RealinIg4
RealinIg5
RealinIg6
IntegerinAnti
IntegerinIncPrec
Integerdistribution
Realp10
Realp20
Realp30
Realp40

Outputs

TypeNameDefaultDescription
Realu
RealCg1
RealCg2
RealCg3
RealCg4
RealCg5
RealCg6
RealBg1
RealBg2
RealBg3
RealBg4
RealBg5
RealBg6
RealIg1
RealIg2
RealIg3
RealIg4
RealIg5
RealIg6
IntegerAnti
IntegerIncPrec