mcf_main.ModifiedCausalForest.sensitivity#
- ModifiedCausalForest.sensitivity(train_df, predict_df: None = None, results: None = None, sens_cbgate: None = None, sens_bgate: None = None, sens_gate: None = None, sens_iate: None = None, sens_iate_se: None = None, sens_scenarios: None = None, sens_cv_k: None = None, sens_replications: int = 2, sens_reference_population: None = None)#
Compute simulation-based sensitivity indicators.
- Parameters
train_df (DataFrame) – Data with real outcomes, treatments, and covariates. Data will be transformed to compute sensitivity indicators.
predict_df (DataFrame, optional) – Prediction data to compute all effects for. This data will not be changed in the computation process. Only covariate information is used from this dataset. If None,
train_df
will be used.results (dict, optional) – Output dictionary from
predict()
. If it contains estimated IATEs, they are used for the no-effect (basic) scenario and compared to those in the dictionary. Otherwise, passing it has no effect.sens_cbgate (bool, optional) – If True, compute CBGATEs for sensitivity analysis. Default is False.
sens_bgate (bool, optional) – If True, compute BGATEs for sensitivity analysis. Default is False.
sens_gate (bool, optional) – If True, compute GATEs for sensitivity analysis. Default is False.
sens_iate (bool, optional) – If True, compute IATEs for sensitivity analysis. If
results
contains IATEs, default is True, otherwise False.sens_iate_se (bool, optional) – If True, compute standard errors of IATEs for sensitivity analysis. Default is False.
sens_scenarios (list or tuple of str, optional) –
Different scenarios considered. Default is (‘basic’,). - ‘basic’: Use estimated treatment probabilities for simulations
(no confounding).
sens_cv_k (int, optional) – Number of folds in cross-validation. Default is 5.
sens_replications (int, optional) – Number of replications for simulating placebo treatments. Default is 2.
sens_reference_population (int or float, optional) – Treatment status of the reference population used by the sensitivity analysis. Default is the treatment with the most observed observations.
- Returns
results_avg – Same structure as
predict()
, but averaged over replications (if applicable).- Return type
dict