ffl_decompose
Decompose group differences in continuous outcome distributions into composition and structure effects via RIF regression, isolating covariate contributions to quantile gaps.
Instructions
Firpo-Fortin-Lemieux two-step detailed distributional decomposition. Validation: certified parity evidence. Assumptions: Firpo-Fortin-Lemieux RIF regression: small perturbations to the covariate distribution induce small changes in the distributional statistic; Linear approximation of the recentered influence function is locally valid. Pre-conditions: Outcome is continuous (e.g. log earnings) with adequate distributional support; Covariates explain a non-trivial share of outcome variation across groups. Failure modes: RIF instability at extreme quantiles -> Avoid quantiles below ~0.05 or above ~0.95; widen the kernel bandwidth. Alternatives: sp.dfl_decompose, sp.oaxaca, sp.rif_decomposition. Typical minimum N: 500.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | Primary running variable, regressor, or feature input for this estimator. | |
| y | Yes | Outcome variable column name or outcome array. | |
| tau | No | Quantile level or target treatment-effect index. | |
| seed | No | Random seed for reproducible stochastic steps. | |
| stat | No | 'log_var', 'theil_t', 'theil_l', 'atkinson'} | quantile |
| trim | No | trim parameter (float). | |
| alpha | No | Significance level for confidence intervals and tests. | |
| group | Yes | Group or cohort identifier. | |
| 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 |
| n_boot | No | Number of bootstrap replications. | |
| weights | No | Observation weights. | |
| 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 | Yes | 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://. | |
| inference | No | inference parameter (str). | analytical |
| reference | No | 0: B reweighted to look like A's X (composition = effect of A's X on B's outcomes relative to observed B) | |
| 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. | |
| data_sample_n | No | Optional uniform random subsample size (seed=0, deterministic) — useful on huge panels. | |
| quantile_convention | No | Quantile RIF convention (``stat='quantile'`` / ``'iqr'``). ``'rifreg'`` reproduces ``ddecompose`` / ``rifreg``. | statspai |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||