in src/mozanalysis/frequentist_stats/linear_models/functions.py [0:0]
def summarize_one_branch(branch_data: pd.Series, alphas: list[float]) -> Estimates:
"""Inferences (point estimate and confidence intervals) for
the mean of a single branch's data. Constructs confidence
intervals from central limit theory (uses the t-distribution)
Parameters:
- branch_data (pd.Series): the vector of observations from a
single branch.
- alphas (list[float]): the desired confidence levels
Returns:
- result (pd.Series): the resulting inferences on the mean. Has
the following elements in its index (assuming `alphas=[0.01,0.05]`):
- 'mean': the point estimate of the mean
- '0.5': also the point estimate, included for backwards compatibility
with prior bootstrap implementations
- '0.005': the lower bound of the 99% confidence interval
- '0.025': the lower bound of the 95% confidence interval
- '0.975': the upper bound of the 95% confidence interval
- '0.995': the upper bound of the 99% confidence interval
"""
res = _make_univariate_output(alphas)
dsw = DescrStatsW(branch_data)
mean = dsw.mean
res["0.5"] = mean # backwards compatibility
res["mean"] = mean
for alpha in alphas:
low, high = dsw.tconfint_mean(alpha)
low_str, high_str = _stringify_alpha(alpha)
res[low_str] = low
res[high_str] = high
return res