chaospy.DiscreteUniform¶
- class chaospy.DiscreteUniform(lower, upper)[source]¶
Discrete uniform probability distribution.
- Examples:
>>> distribution = chaospy.DiscreteUniform(2, 4) >>> distribution DiscreteUniform(2, 4) >>> qloc = numpy.linspace(0, 1, 9) >>> qloc.round(2) array([0. , 0.12, 0.25, 0.38, 0.5 , 0.62, 0.75, 0.88, 1. ]) >>> distribution.inv(qloc).round(2) array([1.5 , 1.88, 2.25, 2.62, 3. , 3.38, 3.75, 4.12, 4.5 ]) >>> distribution.fwd(distribution.inv(qloc)).round(2) array([0. , 0.12, 0.25, 0.38, 0.5 , 0.62, 0.75, 0.88, 1. ]) >>> distribution.pdf(distribution.inv(qloc)).round(4) array([0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5]) >>> distribution.sample(4) array([3, 2, 4, 3]) >>> distribution.mom(1).round(4) 3.0
- __init__(lower, upper)[source]¶
- Args:
- lower (float, chaospy.Distribution):
Lower threshold of distribution. Must be smaller than
upper
. Value will be rounded up to closes integer.- upper (float, chaospy.Distribution):
Upper threshold of distribution. Value will be rounded down to closes integer.
Methods
pdf
(x_data[, decompose, allow_approx, step_size])Probability density function.
cdf
(x_data)Cumulative distribution function.
fwd
(x_data)Forward Rosenblatt transformation.
inv
(q_data[, max_iterations, tollerance])Inverse Rosenblatt transformation.
sample
([size, rule, antithetic, ...])Create pseudo-random generated samples.
mom
(K[, allow_approx])Raw statistical moments.
ttr
(kloc)Three terms relation's coefficient generator.
Attributes
Flag indicating that return value from the methods sample, and inv should be interpreted as integers instead of floating point.
Lower bound for the distribution.
True if distribution contains stochastically dependent components.
Upper bound for the distribution.