# naginterfaces.library.rand.dist_​expmix¶

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

dist_expmix generates a vector of pseudorandom numbers from an exponential mix distribution composed of exponential distributions each having a mean and weight .

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

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

Parameters
nint

, the number of pseudorandom numbers to be generated.

afloat, array-like, shape

The parameters for the exponential distributions in the mix.

wgtfloat, array-like, shape

The weights for the exponential distributions in the mix.

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 exponential mix distribution.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, sum of .

Constraint: sum of .

(errno )

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

Notes

The distribution has PDF (probability density function)

where and , .

dist_expmix returns the values by selecting, with probability , random variates from an exponential distribution with parameter .

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_expmix.

References

Kendall, M G and Stuart, A, 1969, The Advanced Theory of Statistics (Volume 1), (3rd Edition), Griffin

Knuth, D E, 1981, The Art of Computer Programming (Volume 2), (2nd Edition), Addison–Wesley