bartz.testing.DiscreteUniform¶
- class bartz.testing.DiscreteUniform(m)[source]¶
Uniform distribution on
mequispaced levels, standardized.m=2gives random signs (levels -1 and 1), whose squares are constant (kurtosis 1).- property kurtosis: Float[Array, ''] | float[source]¶
Fourth moment
E[z ** 4] = 3/5 (3m^2 - 7)/(m^2 - 1).1 at
m=2, increasing towards 9/5 (the continuousUniform) asmgrows.
- sample(key, shape)[source]¶
Sample i.i.d. standardized values on the
mlevels.- Return type:
Float[Array, '*shape']
- quantize(x, max_bins)[source]¶
Recover the levels, merged evenly if there are more than
max_bins.- Parameters:
x (
Float[Array, '*shape']) – Values drawn from the distribution, of any shape.max_bins (
int) – Maximum number of levels.
- Returns:
quantized_x (UInt[Array, ‘*shape’]) – The bin indices, in
[0, m).m (Integer[Array, ‘’]) – The number of levels,
min(self.m, max_bins).
- ppf(u)[source]¶
Quantile function: map probabilities in [0, 1] to the
mstandardized levels.- Return type:
Float[Array, '*shape']
- from_standard_normal(z)[source]¶
Map standard-Normal draws to this family, preserving their Gaussian copula.
Elementwise
ppf(Phi(z)): each output is marginally a draw from this family (mean 0, variance 1) while the joint dependence ofzcarries over as a Gaussian copula.Normaloverrides this with the identity.- Return type:
Float[Array, '*shape']