ehs-risk-sem
Back to ehs-risk-sem

special

bisect

bisect(func: 'Callable[[float], float]', lo: 'float', hi: 'float', tol: 'float' = 1e-12, max_iter: 'int' = 200) -> 'float'

Bisection root finder for a monotone function on a bracketing interval.

Used for quantile functions. Assumes ``func(lo)`` and ``func(hi)`` straddle zero; the caller is responsible for supplying a valid bracket.

chi2_cdf

chi2_cdf(x: 'float', df: 'float') -> 'float'

CDF of the central chi-square distribution with ``df`` degrees of freedom.

chi2_ppf

chi2_ppf(p: 'float', df: 'float') -> 'float'

Quantile function of the central chi-square distribution.

Solved by bisection on :func:`chi2_cdf`, which is monotone in ``x``.

chi2_sf

chi2_sf(x: 'float', df: 'float') -> 'float'

Survival function (upper tail p-value) of the central chi-square.

gammainc_lower_reg

gammainc_lower_reg(a: 'float', x: 'float') -> 'float'

Regularized lower incomplete gamma function ``P(a, x)``.

Parameters ---------- a Shape parameter, must be strictly positive. x Upper limit of integration, must be non-negative.

Returns ------- float ``P(a, x) = gamma(a, x) / Gamma(a)`` in [0, 1].

gammainc_upper_reg

gammainc_upper_reg(a: 'float', x: 'float') -> 'float'

Regularized upper incomplete gamma function ``Q(a, x) = 1 - P(a, x)``.

gammaln

gammaln(x: 'float') -> 'float'

Natural log of the gamma function. Thin wrapper over ``math.lgamma``.

ncx2_cdf

ncx2_cdf(x: 'float', df: 'float', nc: 'float', tol: 'float' = 1e-12) -> 'float'

CDF of the noncentral chi-square distribution.

Evaluated as the Poisson mixture

``F(x; df, nc) = sum_j Pois(j; nc/2) * F_central(x; df + 2j)``

summing outward from the Poisson mode so that the dominant terms are added first. This is the representation used for RMSEA confidence intervals and for the MacCallum, Browne & Sugawara (1996) power calculation.

Parameters ---------- x Quantile, non-negative. df Degrees of freedom, positive. nc Noncentrality parameter, non-negative. ``nc = 0`` reduces to the central chi-square. tol Terms whose Poisson weight is below ``tol`` and which lie beyond the mode are dropped.

norm_cdf

norm_cdf(x: 'float') -> 'float'

Standard normal CDF, via ``math.erf``.

norm_ppf

norm_ppf(p: 'float') -> 'float'

Standard normal quantile function, by bisection on :func:`norm_cdf`.

Used by: study_01_sample_size.py

vectorized_norm_cdf

vectorized_norm_cdf(x: 'np.ndarray') -> 'np.ndarray'

Elementwise standard normal CDF over a numpy array.