statsmodels.distributions.mixture_rvs.MixtureDistribution.rvs#

MixtureDistribution.rvs(prob, size, dist, kwargs=None, rng=None)[source]#

Sample from a mixture of distributions.

Parameters:
probarray_like

Probability of sampling from each distribution in dist

sizeint

The length of the returned sample.

distarray_like

An iterable of distributions objects from scipy.stats.

kwargstuple of dicts, optional

A tuple of dicts. Each dict in kwargs can have keys loc, scale, and args to be passed to the respective distribution in dist. If not provided, the distribution defaults are used.

rng{None, numpy.random.Generator, numpy.random.RandomState}, optional

If rng is None, the global (legacy) NumPy random state is used. If rng is already a Generator or RandomState instance, that instance is used.

random_state{None, int, array_like[int], numpy.random.Generator, numpy.random.RandomState}, optional

Deprecated since version 0.15: random_state has been deprecated. In-line with SPEC-007, use rng for passing a random number generator or seed.

Returns:
ndarray

Sample from the mixture distribution.