gensbi.diagnostics.utils#

Shared statistical utilities for diagnostic functions.

Functions#

alpha_from_z(z)

Convert z-score to significance level alpha.

jefferys_interval(k, n[, z])

Compute Jeffrey's interval for a binomial proportion.

probit(x)

Inverse CDF of the standard normal distribution.

z_from_alpha(alpha)

Convert significance level alpha to z-score.

Module Contents#

gensbi.diagnostics.utils.alpha_from_z(z)[source]#

Convert z-score to significance level alpha.

Parameters:

z (array_like) – Z-scores.

Returns:

alpha – Corresponding significance levels.

Return type:

array_like

gensbi.diagnostics.utils.jefferys_interval(k, n, z=1)[source]#

Compute Jeffrey’s interval for a binomial proportion.

Uses the Beta distribution with Jeffrey’s prior (Beta(0.5, 0.5)).

Parameters:
  • k (array_like) – Number of successes.

  • n (int or array_like) – Total number of trials.

  • z (float, optional) – Z-score controlling the interval width (default is 1, i.e. ~68% CI).

Returns:

  • lower (np.ndarray) – Lower bounds of the interval.

  • upper (np.ndarray) – Upper bounds of the interval.

gensbi.diagnostics.utils.probit(x)[source]#

Inverse CDF of the standard normal distribution.

Parameters:

x (array_like) – Input values in (0, 1).

Returns:

y – The probit values.

Return type:

array_like

gensbi.diagnostics.utils.z_from_alpha(alpha)[source]#

Convert significance level alpha to z-score.

Parameters:

alpha (array_like) – Significance levels.

Returns:

z – Corresponding z-scores.

Return type:

array_like