discrete_rv

class quantecon.discrete_rv.DiscreteRV(q)[source]

Bases: object

Generates an array of draws from a discrete random variable with vector of probabilities given by q.

Parameters:
qarray_like(float)

Nonnegative numbers that sum to 1.

Attributes:
qsee Parameters.

Getter method for q.

Qarray_like(float)

The cumulative sum of q.

Methods

draw([k, random_state])

Returns k draws from q.

draw(k=1, random_state=None)[source]

Returns k draws from q.

For each such draw, the value i is returned with probability q[i].

Parameters:
kscalar(int), optional

Number of draws to be returned

random_stateint or np.random.RandomState/Generator, optional

Random seed (integer) or np.random.RandomState or Generator instance to set the initial state of the random number generator for reproducibility. If None, a randomly initialized RandomState is used.

Returns:
array_like(int)

An array of k independent draws from q

property q

Getter method for q.