das_gupta
Decompose the gap between two groups' aggregate metrics into contributing factors with Das Gupta's certified multi-factor method, revealing which drivers explain the difference.
Instructions
Das Gupta (1993) multi-factor decomposition. Validation: certified parity evidence.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| by | No | Column(s) identifying the stratum of each row, used to pair the rows of ``data_a`` and ``data_b``. Both frames must contain the same strata. Without ``by`` the rows are paired by position, which requires equal lengths. | |
| data_a | Yes | One row per stratum (e.g. age group). The aggregate for each population is ``R = sum_i prod_f factor_{f,i}``; with a single row it is simply ``prod_f factor_f``. | |
| data_b | Yes | One row per stratum (e.g. age group). The aggregate for each population is ``R = sum_i prod_f factor_{f,i}``; with a single row it is simply ``prod_f factor_f``. | |
| detail | No | Payload depth: 'minimal' (~150 tokens) for sub-step calls where only the point estimate is needed; 'standard' (~1K tokens) for diagnostics + coefficient table; 'agent' (~2K tokens, default) adds violations / next_steps / suggested_functions so the LLM can plan its next call without another round-trip. | agent |
| as_handle | No | If true, cache the fitted result on the server and return result_id + result_uri alongside the JSON payload so a subsequent tools/call can chain without re-running. | |
| data_path | No | Absolute path or URL to a data file. Supported: .csv / .tsv / .txt (delimited), .parquet / .pq, .feather / .arrow, .xlsx / .xls, .dta (Stata), .json / .jsonl. Schemes: file://, s3://, gs://, https://. | |
| result_id | No | Optional handle to a previously-fitted result (returned by an earlier call when as_handle=true). Tools that operate on a fitted object accept this in place of re-supplying data_path + columns. | |
| data_columns | No | Optional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads. | |
| factor_names | Yes | factor_names parameter (Sequence[str]). | |
| data_sample_n | No | Optional uniform random subsample size (seed=0, deterministic) — useful on huge panels. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||