Skip to contents

Run a decomposition

The entry point and its companions.

shapley_decompose()
Run a full decomposition analysis
sequential_totals()
Total impact per factor at every year from a sequential decomposition
validate_model_interface()
Validate that a model implements the shapleydecomp interface
CF_CHANGE_SINCE CF_TOTAL_IMPACT
Counterfactual type constants

The model interface

S3 generics your model implements. The first four are required; the rest are optional and speed things up.

run_simulation()
Run a simulation with the given parameters
summarize_results()
Summarize simulation output into a data.table
get_baseline_value()
Get the baseline value for a factor
build_counterfactual()
Construct counterfactual parameters for a factor
prepare_decomp()
Prepare the model for decomposition
supports_warm_start() get_warm_start_state() run_from_warm_start()
Warm starts

Decomposition algebra

Model-free building blocks. Use them directly if you already have outcomes for every on/off combination.

make_run_table()
Generate the factorial run table for decomposition
run_decomp()
Run decomposition across groups and decomp years
decomp_algebra()
Decompose all summary variables for a single group
decomp_pair()
Decompose a single summary variable using Shapley value weights