distributions.Beta

Beta distribution implementation.

Usage

Source

distributions.Beta()

A flexible continuous probability distribution defined on the interval [0,1], which can be rescaled to any arbitrary interval [min, max].

As defined in Simulation Modeling and Analysis (Law, 2007).

Common Uses:

  1. Useful as a rough model in the absence of data
  2. Distribution of a random proportion
  3. Time to complete a task

Methods

Name Description
__init__() Initialize a Beta distribution.
sample() Generate random samples from the Beta distribution.

__init__()

Initialize a Beta distribution.

Usage

Source

__init__(alpha1, alpha2, lower_bound=0.0, upper_bound=1.0, random_seed=None)
Parameters
alpha1: float

First shape parameter. Must be positive.

alpha2: float

Second shape parameter. Must be positive.

lower_bound: float = 0.0

Lower bound for rescaling the distribution from [0,1] to [lower_bound, upper_bound].

upper_bound: float = 1.0

Upper bound for rescaling the distribution from [0,1] to [lower_bound, upper_bound].

random_seed: Optional[Union[int, SeedSequence]] = None
A random seed or SeedSequence to reproduce samples. If None, a unique sample sequence is generated.

sample()

Generate random samples from the Beta distribution.

Usage

Source

sample(size=None)
Parameters
size: Optional[Union[int, Tuple[int, …]]] = None
The number/shape of samples to generate:
  • If None: returns a single sample as a float
  • If int: returns a 1-D array with that many samples
  • If tuple of ints: returns an array with that shape
Returns
Union[float, NDArray[np.float64]]
Random samples from the Beta distribution, rescaled to [min, max]:
  • A single float when size is None
  • A numpy array of floats with shape determined by size parameter