rndKMbeta

Purpose

Computes beta pseudo-random numbers.

Format

{ x, newstate } = rndKMbeta(r, c, a, b, state)
Parameters:
  • r (scalar) – number of rows of resulting matrix.

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

  • a (matrix or vector or scalar) – First shape argument for beta distribution. ExE conformable with the row and column dimensions of the return matrix, r and c.

  • b (matrix or vector or scalar) – Second shape argument for beta distribution. ExE conformable with the row and column dimensions of the return matrix, r and c.

  • state (scalar or 500x1 vector) –

    scalar case

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

    500x1 vector case

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

Returns:
  • x (RxC matrix) – Beta distributed random numbers.

  • newstate (500x1 vector) – the updated state.

Remarks

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

\[ \begin{align}\begin{aligned}\begin{split}E(x) = \frac{a}{a+b}\\\end{split}\\\begin{split}Var(x) = \frac{a*b}{(a+b+1)*(a+b^2)}\\\end{split}\\\begin{split}0 < x < 1\\\end{split}\\\begin{split}a > 0\\\end{split}\\b > 0\end{aligned}\end{align} \]

r and c will be truncated to integers if necessary.

Technical Notes

rndKMbeta() uses the recur-with-carry KISS+Monster algorithm described in the rndKMi() Technical Notes.

Source

randkm.src