cleverly.Inference#
- class cleverly.Inference(alpha: float = 0.05, n_bootstrap: int = 0, bootstrap_resampling: Literal['auto', 'iid', 'cluster'] = 'auto', simultaneous: bool = True, n_multiplier: int | Literal['auto'] = 'auto', multiplier_kind: Literal['rademacher', 'mammen', 'normal'] = 'rademacher')[source]#
Configure confidence intervals and resampling.
- Parameters:
- alpha
float, default=0.05 Significance level for reported intervals.
- n_bootstrap
int, default=0 Bootstrap fits. Zero disables full-refit bootstrap inference.
- bootstrap_resampling{“auto”, “iid”, “cluster”}, default=”auto”
Unit or cluster resampling policy.
- simultaneousbool, default=True
Whether multi-parameter results include simultaneous bands.
- n_multiplier
intor{“auto”}, default=”auto” Multiplier draws for simultaneous bands.
- multiplier_kind{“rademacher”, “mammen”, “normal”}, default=”rademacher”
Distribution of multiplier weights.
- alpha
See also
TMLEMethodMethod configuration this object is the inference half of.
TargetingOwns
submodel_alpha, which is not a significance level.cleverly.inference.run_bootstrapThe full-refit bootstrap
n_bootstraprequests.
Examples
Report 99 percent intervals and add a cluster bootstrap:
>>> from cleverly import Inference >>> inference = Inference(alpha=0.01, n_bootstrap=200, bootstrap_resampling="cluster") >>> inference.alpha, inference.n_bootstrap, inference.bootstrap_resampling (0.01, 200, 'cluster')
alphais the significance level. The confidence level is1 - alpha. The logistic-submodel bound lives onTargetingand is spelled differently for that reason:>>> from cleverly import Targeting >>> Targeting().submodel_alpha 0.9995
Methods#
Attributes#
- Inference.alpha: float = 0.05#
Significance level of the reported intervals, and what the
alpha=shortcut sets. Not to be confused withTargeting.submodel_alpha, which bounds the logistic submodel and is reached assubmodel_alpha=.
- Inference.n_multiplier: int | Literal['auto'] = 'auto'#
Multiplier-bootstrap draws behind the simultaneous bands.
"auto"is each engine’s own default, which is not one number: the point path draws 1000 and the sequential path draws 2000. A single literal here would silently pick one of them for the other engine – and it did, halving every study-driven longitudinal fit’s draws with nothing to read that said so. Resolved inTMLEMethod.estimator_kwargs(), exactly asg_boundsis; the stored configuration keeps"auto"so it still says “the engine’s default”.