flag_rate_ci¶
flag_rate_ci
¶
flag_rate_ci(verdict: DataFrame, *, seed: int = 42, n_boot: int = 10000, alpha: float = 0.05) -> DataFrame
System-level flag rate per class with a cluster-bootstrap confidence interval.
Collapses the per-station verdict of audit_static to per-system
(flagged iff any station of the system is flagged), then resamples systems
with replacement to bound the rate, accounting for within-system correlation.
Seeded, so the interval is reproducible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
verdict
|
DataFrame
|
Output of |
required |
seed
|
int
|
Seed for the bootstrap resampling. |
42
|
n_boot
|
int
|
Number of bootstrap resamples. |
10000
|
alpha
|
float
|
Two-sided level; the interval is the central |
0.05
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Columns |
See Also
audit_static : Produces the per-station verdict this summarises.
audit_sensitivity : The complementary threshold-robustness analysis.
Examples:
>>> import pandas as pd
>>> verdict = pd.DataFrame({
... "system_id": ["a", "b", "c", "d"],
... "A1": 0, "A2": 0, "A3": 0, "A4": 0, "A5": 0, "A6": 0,
... "A7": [1, 1, 0, 0],
... })
>>> float(flag_rate_ci(verdict, n_boot=500).set_index("class").loc["A7", "rate"])
0.5