dualbounds.utilities.compute_est_bounds¶
-
dualbounds.utilities.compute_est_bounds(summands: array, clusters: callable | None =
None, func: callable | None =None, B: int =1000, alpha: float =0.05)[source]¶ Helper to computes confidence intervals.
Specifically, computes intervals for
func(summands[k].mean(axis=-1))Provides lower CI for k=0 and upper CI for k=1.
- Parameters:¶
- summands : np.array¶
(2, n)-shaped array or (2, n, d)-shaped array
- func : callable¶
A callable that maps a 1D np.array to a scalar. Defaults to
func=lambda x: x.mean().- clusters : np.array¶
n-shaped array where clusters[i] = j means that observation i is in the jth cluster.
- B : int¶
Number of bootstrap draws to use. Ignored unless func or clusters are provided.
- alpha : float¶
Nominal level.
- Returns:¶
ests (np.array) – 2-shaped array of lower and upper estimators (sample mean).
ses (np.array) – 2-shaped array of standard errors.
bounds (np.array) – 2-shaped array of lower/upper confidence bounds.
Notes
This is meant primarily for internal use in the DualBounds class.