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
rndKMrandom 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:
r and c will be truncated to integers if necessary.
Examples#
// Generate a 3x2 matrix of beta random numbers
// with shape parameters a = 2, b = 5
// using a fixed seed for repeatable output
{ x, newstate } = rndKMbeta(3, 2, 2, 5, 12345);
print x;
The output is a 3x2 matrix of beta-distributed values between 0 and 1. The sample mean is approximately 0.29, consistent with the theoretical mean of a/(a+b) = 2/7:
0.19288089 0.38057594
0.51686669 0.57522795
0.31832075 0.14046662
Technical Notes#
rndKMbeta() uses the recur-with-carry KISS+Monster algorithm described in the rndKMi() Technical Notes.
Source#
randkm.src