naginterfaces.library.rand.dist_​dirichlet

naginterfaces.library.rand.dist_dirichlet(n, a, statecomm)[source]

dist_dirichlet generates a vector of pseudorandom numbers taken from a Dirichlet distribution.

For full information please refer to the NAG Library document for g05se

https://www.nag.com/numeric/nl/nagdoc_27.1/flhtml/g05/g05sef.html

Parameters
nint

, the number of pseudorandom numbers to be generated.

afloat, array-like, shape

The parameter vector for the distribution.

statecommdict, RNG communication object, modified in place

RNG communication structure.

This argument must have been initialized by a prior call to init_repeat() or init_nonrepeat().

Returns
xfloat, ndarray, shape

The pseudorandom numbers from the specified Dirichlet distribution, with holding the th dimension for the th variate.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, at least one .

(errno )

On entry, [‘state’] vector has been corrupted or not initialized.

Notes

The distribution has PDF (probability density function)

where is a vector of dimension , such that for all and .

dist_dirichlet generates a draw from a Dirichlet distribution by first drawing independent samples, , i.e., independent draws from a gamma distribution with parameters and one, and then setting .

One of the initialization functions init_repeat() (for a repeatable sequence if computed sequentially) or init_nonrepeat() (for a non-repeatable sequence) must be called prior to the first call to dist_dirichlet.

References

Dagpunar, J, 1988, Principles of Random Variate Generation, Oxford University Press

Hastings, N A J and Peacock, J B, 1975, Statistical Distributions, Butterworth