Package: shapleydecomp 1.0.0
shapleydecomp: Shapley Value Decomposition for Discrete-Time Simulation Models
Attributes changes in the outcomes of a discrete-time simulation model to its input factors using Shapley values (Shapley 1953) <doi:10.1515/9781400881970-018>, which for binary factors coincide with the symmetric standardization of Das Gupta (1993) <https://www2.census.gov/library/publications/1993/demographics/p23-186.pdf>. Any calibrated model can be decomposed by implementing four S3 methods that run the model, summarize its output, and construct counterfactual inputs. Counterfactuals either remove a factor entirely or hold it at its value in a baseline year, and a sequential decomposition attributes each year's policy conditional on the past.
Authors:
shapleydecomp_1.0.0.tar.gz
shapleydecomp_1.0.0.zip(r-4.7-any)shapleydecomp_1.0.0.zip(r-4.6-any)shapleydecomp_1.0.0.zip(r-4.5-any)
shapleydecomp_1.0.0.tgz(r-4.6-any)shapleydecomp_1.0.0.tgz(r-4.5-any)
shapleydecomp_1.0.0.tar.gz(r-4.7-any)shapleydecomp_1.0.0.tar.gz(r-4.6-any)
shapleydecomp_1.0.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
shapleydecomp/json (API)
| # Install 'shapleydecomp' in R: |
| install.packages('shapleydecomp', repos = c('https://aucarter.r-universe.dev', 'https://cloud.r-project.org')) |
Bug tracker:https://github.com/aucarter/shapleydecomp/issues
Pkgdown/docs site:https://aucarter.github.io
Last updated from:90a4659e5e. Checks:9 OK. Indexed: yes.
| Target | Result | Time | Files | Syslog |
|---|---|---|---|---|
| linux-devel | OK | 110 | ||
| source / vignettes | OK | 168 | ||
| linux-release | OK | 102 | ||
| macos-release | OK | 195 | ||
| macos-oldrel | OK | 204 | ||
| windows-devel | OK | 69 | ||
| windows-release | OK | 70 | ||
| windows-oldrel | OK | 66 | ||
| wasm-release | OK | 84 |
Exports:build_counterfactualCF_CHANGE_SINCECF_TOTAL_IMPACTdecomp_algebradecomp_pairget_baseline_valueget_warm_start_statemake_run_tableprepare_decomprun_decomprun_from_warm_startrun_simulationsequential_totalsshapley_decomposesummarize_resultssupports_warm_startvalidate_model_interface
Dependencies:data.table
Last update: 2026-10-21
Started: 2026-10-13
Last update: 2026-10-14
Started: 2026-10-13
Readme and manuals
Help Manual
| Help page | Topics |
|---|---|
| Construct counterfactual parameters for a factor | build_counterfactual |
| Counterfactual type constants | CF_CHANGE_SINCE CF_TOTAL_IMPACT cf_types |
| Decompose all summary variables for a single group | decomp_algebra |
| Decompose a single summary variable using Shapley value weights | decomp_pair |
| Get the baseline value for a factor | get_baseline_value |
| Generate the factorial run table for decomposition | make_run_table |
| Prepare the model for decomposition | prepare_decomp |
| Run decomposition across groups and decomp years | run_decomp |
| Run a simulation with the given parameters | run_simulation |
| Total impact per factor at every year from a sequential decomposition | sequential_totals |
| Run a full decomposition analysis | shapley_decompose |
| Summarize simulation output into a data.table | summarize_results |
| Validate that a model implements the shapleydecomp interface | validate_model_interface |
| Warm starts | get_warm_start_state run_from_warm_start supports_warm_start warm_start |
