mcf_main.ModifiedCausalForest.predict_different_allocations#
- ModifiedCausalForest.predict_different_allocations(data_df, allocations_df)#
Predict average potential outcomes for different allocations.
meth:~ModifiedCausalForest.train method must be run beforehand. The details of this methods are described in the working paper by Busshoff (2026).
- Parameters:
data_df (DataFrame) – Data used to compute the predictions. It must contain information about features (and treatment if effects for treatment specific subpopulations are desired as well).
allocations_df (DataFrame or None) – Required argument. Pass None to skip evaluating supplied allocations; ‘alloc_df’ in the returned dictionary is then None. Otherwise, each column specifies an allocation, with one treatment code per observation. Match the number and row order of observations in data_df. Rows are matched by position; index labels are ignored. Use the trained model’s treatment codes, after any recoding performed during training.
- Returns:
results – Dictionary with the following entries: ‘ate’: Array of average treatment effects comparing allocations in which
everyone receives the same treatment.
’ate_se’: Array of standard errors corresponding to ‘ate’. ‘ate_effect_list’: Treatment comparisons in the order used by ‘ate’. ‘alloc_df’: DataFrame containing estimates and their variances for the
supplied allocations and all pairwise differences between them. Rows are ‘est’ and ‘var’; columns are named ‘<outcome>_<allocation>’ or ‘<outcome>_<allocation1>_m_<allocation2>’, where each difference is allocation1 minus allocation2. None if allocations_df is None.
The output directory is stored in self.gen_cfg.outpath.
- Return type:
Dictionary
- Raises:
NotImplementedError – If allocations_df is not None and any of the following applies: treatments are continuous, ‘p_choice_based_sampling’ is True, or ‘gen_weighted’ is True.