cleverly.variable_importance#
- cleverly.variable_importance(data: Any, *, outcome: str, candidates: Sequence[str], covariates: Sequence[str], estimand: str = 'ate', estimator: TMLE | None = None, adjust_for_other_candidates: bool = True, delta: str | None = None, weights: str | None = None, weights_type: str = 'probability', weights_estimated: bool = False, id: str | None = None) VariableImportanceResult[source]#
Estimate one causal importance parameter per candidate exposure.
Each candidate is fitted as the treatment. With
adjust_for_other_candidates=True(the default), the other candidates join the supplied baseline covariates, matching the interpretation “intervene on this exposure while adjusting for the others.” Set it false when the other candidates are descendants, colliders, or otherwise should not be conditioned on.Tests are two-sided on each parameter’s native null (zero for differences/levels, one for ratios), then adjusted jointly by Benjamini–Hochberg. This corrects the one-tail normal probability used by the historical
tmle3_vimhelper.Refuses, before the first fit, when the estimator’s inference status on any candidate’s prepared data supplies no inference. A
CTMLEwhosestrategyis"greedy","ordered","discrete","lasso"or"learners"is one such case, and the inference reference lists each status. The adjustment above needs one p-value per candidate, and such a fit supplies none, so this procedure has no diagnostic form to fall back to. A"derivative"fit (C-TMLE0) supplies inference and is admitted, unless it declares propensity arrays, which describe one treatment only. Before that check, an estimator with a rule, a regime density or an MSM function that is not declared known meets the refusal that its own fit gives.- Parameters:
- data
dataframe Observed study data.
- outcome
str Outcome column.
- candidatessequence
ofstr Columns to fit as the treatment, one at a time.
- covariatessequence
ofstr Baseline adjustment columns, shared by every candidate.
- estimand
str Alias targeted for each candidate.
- estimator
TMLEorNone Configured estimator to reuse.
Nonebuilds one with the defaults. An estimator whose status supplies no inference is refused here, because it reports no p-value.- adjust_for_other_candidatesbool
Whether the other candidates join the baseline covariates. Set it false when they are descendants, colliders, or otherwise should not be conditioned on.
- delta
strorNone Outcome-observation indicator column.
- weights
strorNone Probability-weight column.
- weights_type{“probability”}
Interpretation of
weights.- weights_estimatedbool
Whether the supplied weights were estimated from these data.
- id
strorNone Independent-cluster identifier used for variance estimation.
- data
- Returns:
VariableImportanceResultOne entry per candidate, with its estimate and adjusted p-value.