cleverly.inference.simultaneous_bands#

cleverly.inference.simultaneous_bands(estimates: Mapping[str, ParameterEstimate] | Sequence[ParameterEstimate], *, alpha: float = 0.05, n_replicates: int = 1000, kind: Literal['rademacher', 'mammen', 'normal'] = 'rademacher', random_state: int | None = None, cluster: ndarray[tuple[Any, ...], dtype[int64]] | None = None) → SimultaneousBands[source]#

Joint confidence bands over a set of estimates.

Bands are reported on each estimand’s own scale, so a ratio’s band is exponentiated from the log scale exactly as its pointwise interval is.

Parameters:
estimatesmapping or sequence of ParameterEstimate

The estimates to band jointly.

alphafloat

Joint significance level.

n_replicatesint

Multiplier draws.

kind{“rademacher”, “mammen”, “normal”}, default=”rademacher”

Distribution of the multiplier weights.

random_stateint or None

Seed for those draws.

clusterndarray or None

(n,) cluster codes. Weights are drawn per cluster when given.

Returns:
SimultaneousBands

One interval per estimand, holding jointly at 1 - alpha.

Raises:
ValueError

If estimates is empty, or if the influence curves have different lengths.

ValueError

If cluster has a different length from the influence curves, or if kind is not a supported multiplier, when two or more estimates are banded.

CapabilityError

If any estimate’s supplies_inference is False. A simultaneous band is a confidence statement, and the package supplies no inference for such an estimate. Also if any estimate carries a Student t reference (reference_df), because no source gives a t-calibrated band. Also, with code inference_gap, if any estimate declares covariance_rule="second_moment". The multiplier draws center each influence curve, which matches the raw second moment only on a mean-zero curve, and this function does not check the mean.