rndPoisson#

Purpose#

Computes Poisson pseudo-random numbers with a choice of underlying random number generator.

Format#

x = rndPoisson(r, c, lambda)#
{ x, newstate } = rndPoisson(r, c, lambda, state)
Parameters:
  • r (scalar) – number of rows of resulting matrix.

  • c (scalar) – number of columns of resulting matrix.

  • lambda (matrix, vector or scalar) – mean parameter for Poisson distribution, ExE conformable matrix with r and c.

  • state (scalar or opaque vector) –

    Optional argument.

    scalar case

    state = starting seed value only. If -1, GAUSS computes the starting seed based on the system clock.

    opaque vector case

    state = the state vector returned from a previous call to one of the rnd random number functions.

Returns:
  • x (r x c matrix) – Poisson distributed random numbers.

  • newstate (Opaque vector) – the updated state.

Examples#

The example below simulates 100 observations of a Poisson process with a mean of 17.

lambda = 17;

x = rndPoisson(100, 1, lambda);

Remarks#

The properties of the pseudo-random numbers in x are:

\[ \begin{align}\begin{aligned}\begin{split}E(x) = \lambda\\\end{split}\\Var(x) = \lambda\end{aligned}\end{align} \]

r and c will be truncated to integers if necessary.

Technical Notes#

The default generator for rndPoisson() is the SFMT Mersenne-Twister 19937. You can specify a different underlying random number generator with the function rndCreateState().

See also

Functions rndCreateState(), rndStateSkip()