Causal Decision Agent
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| absorb_olsB | OLS with absorbed high-dimensional fixed effects (reghdfe-style). |
| adjust_pvaluesB | Adjust p-values for multiple comparisons. Validation: certified parity evidence. |
| aftB | Fit an Accelerated Failure Time model by MLE. Validation: certified parity evidence. |
| aggteA | Aggregate Callaway-Sant'Anna group-time ATTs into interpretable summaries -- overall ATT, event-study by relative time, group-specific ATT(g), or calendar-time ATT(t). Inference uses the multiplier bootstrap on the pre-stored influence functions, so SEs are correct under clustering at the unit level. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Same identifying assumptions as the source estimator (parallel trends, no anticipation, SUTVA); For dynamic aggregation: balanced panel within the requested event-time window (use balance_e). Pre-conditions: result was produced by sp.callaway_santanna or sp.did with staggered=True; result.detail contains the per-(g, t) ATT estimates and their influence functions. Failure modes: result.detail is empty or missing influence functions -> Re-run sp.callaway_santanna; aggte requires the per-(g,t) influence functions; Empty event-time aggregation (no overlapping cohorts) -> Widen the (min_e, max_e) window or drop balance_e. Alternatives: sp.callaway_santanna, sp.sun_abraham, sp.did_imputation. Typical minimum N: 50. |
| aggte_from_influenceA | Aggregate Callaway-Sant'Anna group-time ATTs directly from an influence-function export (DataFrame or file path from sp.influence_functions) -- event-study, group, calendar, or overall summaries with multiplier-bootstrap inference, no refit and no original data required. The post-hoc half of the Stata csdid saverif() workflow. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Pre-conditions: source was produced by sp.influence_functions. Failure modes: influence frame is missing required columns -> Re-export with sp.influence_functions(result, path). Alternatives: sp.aggte, sp.influence_functions. Typical minimum N: 50. |
| aipwA | Augmented inverse-probability weighting (AIPW) -- the canonical doubly-robust ATE estimator. Cross-fits an outcome regression and a propensity model and combines them via the efficient-influence-function formula, so the estimate is consistent if either nuisance is correctly specified (Robins, Rotnitzky & Zhao 1994). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness conditional on covariates (Y(0), Y(1) perp D | X); Overlap / common support: 0 < e(X) < 1 for all X with positive density; SUTVA. Pre-conditions: binary treatment column with both arms present; covariates must contain all confounders for unconfoundedness; no perfect overlap violations (0 < propensity < 1 in support). Failure modes: Propensity scores cluster near 0 or 1 -> Trim to overlap region with sp.trimming() or switch to overlap-weighted ATE; Cross-fit estimate has very wide CI -> Increase n_folds or reduce covariate dimension; check for near-empty propensity strata. Alternatives: sp.ipw, sp.dml, sp.tmle, sp.matching. Typical minimum N: 200. |
| anderson_rubin_ciB | Anderson-Rubin confidence set -- re-export of Validation: certified parity evidence. |
| anderson_rubin_testB | Anderson-Rubin (1949) test -- size-correct under weak instruments. Validation: certified parity evidence. |
| arimaB | Fit ARIMA(p,d,q) or SARIMAX. Validation: certified parity evidence. |
| assumption_auditC | Comprehensive assumption audit for any estimated model. |
| auditA | Reviewer-grade audit on a result. Returns the literature checklist (parallel-trends test, honest-DID, Bacon decomposition, placebo, balance, ...) with status per item and the concrete suggest_function to call to fill any missing high-importance check. |
| audit_resultA | Reviewer-grade audit on a previously-fitted result. Pass the result_id returned by an earlier tool call (with as_handle=true). Returns the same checklist sp.audit() produces -- every robustness check the literature expects for the design, with status='present|missing|run' and concrete suggested_function names for the missing ones. |
| augsynthA | Augmented Synthetic Control with ridge bias correction (Ben-Michael et al. 2021). Validation: certified parity evidence. Do NOT use when: pre-treatment fit from plain sp.synth is already good -- the ridge augmentation mainly buys bias correction for poor fit and adds a tuning parameter to justify; many treated units -- use sp.gsynth or sp.sdid. Assumptions: A convex (or regularized) combination of donor units reproduces the treated unit's pre-treatment outcome path; No interference: the treatment does not affect the donor units (SUTVA); No anticipation before the treatment date. Pre-conditions: Panel of one or more treated units plus an untreated donor pool, observed over time; Pre-treatment window long enough to fit donor weights (rule of thumb: more pre-periods than donors used); Outcome observed for every unit in every period. Failure modes: Large pre-treatment RMSPE -- the synthetic unit fails to track the treated unit before treatment -> Add donors / predictors, lengthen the pre-period, or use a bias-corrected estimator (sdid, augsynth); Placebo / permutation inference shows the estimate is not extreme relative to donors -> Report the placebo distribution honestly; the effect... |
| auto_cateA | Race several meta-learners and return a scored leaderboard + winner. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness given the covariates; Overlap / positivity across the covariate space; Nuisance functions are estimated consistently; cross-fitting controls overfitting bias. Pre-conditions: Covariates, a treatment indicator, and an outcome for each unit; Enough data to fit flexible nuisance models with sample-splitting / cross-fitting. Failure modes: CATE estimates are unstable or extrapolate beyond the covariate support -> Restrict to the overlap region, increase data, or use a doubly-robust learner (DR-/R-learner). Alternatives: sp.dml, sp.causal_forest, sp.tmle. Typical minimum N: 500. |
| auto_cate_tunedA | Optuna-tuned CATE learner race -- nuisance, per-learner, or both. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness given the covariates; Overlap / positivity across the covariate space; Nuisance functions are estimated consistently; cross-fitting controls overfitting bias. Pre-conditions: Covariates, a treatment indicator, and an outcome for each unit; Enough data to fit flexible nuisance models with sample-splitting / cross-fitting. Failure modes: CATE estimates are unstable or extrapolate beyond the covariate support -> Restrict to the overlap region, increase data, or use a doubly-robust learner (DR-/R-learner). Alternatives: sp.dml, sp.causal_forest, sp.tmle. Typical minimum N: 500. |
| auto_didB | Run several staggered-DiD estimators side by side. |
| auto_ivA | Race 2SLS, LIML, and JIVE on a single-endogenous IV spec. |
| available_methodsA | Return list of all registered decomposition method names. |
| average_treatment_effectA | Aggregate CATE predictions into ATE/ATT/ATC/ATO targets. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness given the covariates; Overlap / positivity; Honesty: separate subsamples are used to choose splits and to estimate effects. Pre-conditions: Covariates, treatment, and outcome with enough data to grow an honest forest. Failure modes: Calibration test rejects -- the forest's heterogeneity is not well calibrated -> Increase the sample / number of trees, or fall back to a doubly-robust learner. Alternatives: sp.dml, sp.auto_cate, sp.tmle. Typical minimum N: 1000. |
| bacon_decompositionA | Goodman-Bacon (2021) decomposition: breaks the two-way fixed-effects DID estimator into its 2x2 comparison weights. Reveals whether treated-vs-treated comparisons (which can have negative weights) dominate the estimate. Run this before trusting a TWFE-DID point estimate. Validation: certified parity evidence. |
| bacon_plotC | Scatter plot of Goodman-Bacon decomposition. |
| balance_diagnosticsB | Unified balance diagnostics for matching and weighting estimators. |
| balance_panelB | Balance a panel by keeping only units observed in every time period. Validation: certified parity evidence. |
| balanceplotB | Love plot: covariate balance visualization (SMD dot plot). |
| bartikA | Bartik / shift-share IV estimator (Adao-Kolesar-Morales 2019; Borusyak-Hull-Jaravel 2022). Uses pre-period industry / group shares x exogenous shocks as an instrument for local outcome exposure. Assumptions: Exogeneity of shocks conditional on pre-period exposure structure (Borusyak-Hull-Jaravel); Shock-level IV: shocks are independent of region-level unobserved trends; Asymptotic framework: many shocks (L -> inf) -- check via sp.ssaggregate Herfindahl. Pre-conditions: pre-period shares are pre-determined (measured strictly before the outcome window); shocks are as-good-as-random conditional on unit-level controls; >= 50 regions for AKM shift-share SE to be well-sized. Failure modes: Herfindahl of shares too concentrated (one industry dominates) -> Shift-share SE unreliable -- use Adao-Kolesar-Morales shock-level SE via sp.shift_share_se; First-stage F < 10 -> Shares don't predict exposure enough -- report weak-IV-robust CI (sp.anderson_rubin_ci); Shocks correlate with pre-trends -> Shock exogeneity fails -- drop the violating shock dimension or add trend controls. Alternatives: sp.iv, sp.shift_share_se, sp.shift_share_political, sp.shift_share_political_panel. Typical minimum N:... |
| basque_terrorismC | Basque Country terrorism dataset (simulated). |
| bauer_sinningB | Bauer-Sinning (2008) nonlinear Oaxaca-Blinder decomposition with Validation: certified parity evidence. |
| bcfA | Estimate heterogeneous treatment effects using Bayesian Causal Forest. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness and overlap; The BART/forest priors are appropriate for the outcome scale. Pre-conditions: Covariates, treatment, and outcome; a propensity model is fit internally to limit regularization-induced confounding. Failure modes: MCMC diagnostics fail to converge, or estimates are sensitive to the prior -> Increase draws/tuning, re-scale the outcome, and report posterior diagnostics. Alternatives: sp.dml, sp.auto_cate, sp.causal_forest. Typical minimum N: 250. |
| bcf_factor_exposureA | BCF on PCA-factor scores of a high-dimensional exposure vector (arXiv:2601.16595, 2026). Compresses exposures via SVD or user-supplied loadings, then fits one BCF per factor. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness and overlap; The BART/forest priors are appropriate for the outcome scale. Pre-conditions: Covariates, treatment, and outcome; a propensity model is fit internally to limit regularization-induced confounding. Failure modes: MCMC diagnostics fail to converge, or estimates are sensitive to the prior -> Increase draws/tuning, re-scale the outcome, and report posterior diagnostics. Alternatives: sp.dml, sp.auto_cate, sp.causal_forest. Typical minimum N: 250. |
| bcf_longitudinalA | Hierarchical Bayesian Causal Forest for longitudinal data (BCFLong) -- allows mu_t(X), tau_t(X) to evolve across time with unit-level random intercepts. Assumptions: Unconfoundedness and overlap; The BART/forest priors are appropriate for the outcome scale. Pre-conditions: Covariates, treatment, and outcome; a propensity model is fit internally to limit regularization-induced confounding. Failure modes: MCMC diagnostics fail to converge, or estimates are sensitive to the prior -> Increase draws/tuning, re-scale the outcome, and report posterior diagnostics. Alternatives: sp.dml, sp.auto_cate, sp.causal_forest. Typical minimum N: 250. |
| bcf_ordinalA | Bayesian Causal Forest for ordered / dose-level treatment (Zorzetto et al. 2026). Estimates cumulative dose-response curves via chained BCF between consecutive levels. Assumptions: Unconfoundedness and overlap; The BART/forest priors are appropriate for the outcome scale. Pre-conditions: Covariates, treatment, and outcome; a propensity model is fit internally to limit regularization-induced confounding. Failure modes: MCMC diagnostics fail to converge, or estimates are sensitive to the prior -> Increase draws/tuning, re-scale the outcome, and report posterior diagnostics. Alternatives: sp.dml, sp.auto_cate, sp.causal_forest. Typical minimum N: 250. |
| benjamini_hochbergB | Benjamini-Hochberg (1995) FDR correction. Validation: certified parity evidence. |
| betaregC | Beta regression (Ferrari & Cribari-Neto 2004). Validation: certified parity evidence. |
| beyond_average_lateA | Beyond-average LATE (Xie-Wu 2025). Identifies the entire treatment-effect distribution among compliers under incomplete compliance, not just its mean. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Selection-on-observables (unconfoundedness + overlap) or, for IV variants, instrument validity; For IV-QTE: rank invariance / rank similarity (monotonicity of the structural quantile function). Pre-conditions: Covariates, treatment, and outcome; for IV-quantile methods, a valid instrument; Enough data to estimate the outcome distribution across quantiles. Failure modes: Estimated conditional quantiles cross (non-monotone), or tail quantiles are unstable -> Use rearrangement / monotonization and avoid extreme quantiles where data are sparse. Alternatives: sp.qte, sp.iv, sp.dml. Typical minimum N: 500. |
| bias_factorC | Confounding bias factor |
| bib_forC | Top-level structured citation for a fitted result. |
| bibtexA | Return verified BibTeX entries from paper.bib (StatsPAI's single source of truth for citations). Pass one or more bib keys (e.g. 'callaway2021difference'). NEVER invent citations -- call this tool instead. Unknown keys return an empty entry plus a list of close matches. |
| bidirectional_pciA | Bidirectional proximal causal inference (Min, Zhang & Luo 2025). Solves for both outcome and treatment bridges simultaneously in a single two-way regression system. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: The proxies are valid negative controls (relevant to the confounder, excluded from the causal channel); A bridge function exists (completeness conditions hold). Pre-conditions: Treatment-inducing and outcome-inducing proxy variables (negative controls) for the unobserved confounder. Failure modes: Proxies are weak or invalid -- the bridge function is poorly identified -> Test proxy relevance, select stronger proxies, or fall back to sensitivity analysis. Alternatives: sp.select_pci_proxies, sp.dml. Typical minimum N: 500. |
| biprobitC | Bivariate probit model. Validation: certified parity evidence. |
| bjsA | Borusyak, Jaravel & Spiess (2024) imputation DID estimator. Do NOT use when: no never-treated or not-yet-treated observations remain -- the imputation model cannot be fit; the design is a simple 2x2 -- use sp.did(method='2x2'). Assumptions: Conditional parallel trends between treated and comparison groups absent treatment; No anticipation of treatment before its onset; Treatment effects may be heterogeneous across cohorts and time (no homogeneity required). Pre-conditions: Panel or repeated cross-section with a unit (or group) identifier and a time identifier; At least one never-treated or not-yet-treated comparison group; Pre-treatment periods to assess parallel trends. Failure modes: Pre-treatment event-study coefficients are jointly non-zero (pre-trend violation) -> Use honest DiD bounds to quantify robustness to trend violations, or condition on covariates; Two-way fixed-effects estimate is contaminated by 'forbidden' comparisons / negative weights -> Use a heterogeneity-robust estimator (Callaway-Sant'Anna, Borusyak et al., Gardner two-stage). Alternatives: sp.callaway_santanna, sp.did, sp.honest_did. Typical minimum N: 100. |
| bjs_pretrend_jointC | Cluster-bootstrap joint Wald test for BJS pre-treatment coefficients. |
| blp_testA | Best Linear Predictor (BLP) test for CATE heterogeneity. Assumptions: Unconfoundedness given the covariates; Overlap / positivity across the covariate space; Nuisance functions are estimated consistently; cross-fitting controls overfitting bias. Pre-conditions: Covariates, a treatment indicator, and an outcome for each unit; Enough data to fit flexible nuisance models with sample-splitting / cross-fitting. Failure modes: CATE estimates are unstable or extrapolate beyond the covariate support -> Restrict to the overlap region, increase data, or use a doubly-robust learner (DR-/R-learner). Alternatives: sp.dml, sp.causal_forest, sp.tmle. Typical minimum N: 500. |
| bonferroniB | Bonferroni correction: |
| bootstrapA | General bootstrap inference: nonparametric, cluster, block. Percentile/BCa/normal CIs. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Observations (or clusters/blocks) are exchangeable under the resampling scheme used; cluster= resamples whole clusters, block= preserves within-block ordering for serial dependence; The statistic callable is a smooth, well-defined functional of the data so its sampling distribution is approximable by resampling; BCa intervals further assume an estimable bias/acceleration; percentile/normal CIs assume approximate pivotality of the resampled distribution. Pre-conditions: statistic is a deterministic callable returning a finite scalar on any resampled DataFrame; Enough independent resampling units (rows, clusters, or blocks) to populate n_boot replicates; Specify cluster= or block= when data are clustered/serially dependent rather than iid. Failure modes: Few clusters yields anti-conservative CIs / wildly unstable bootstrap distribution -> Use a wild cluster bootstrap with Rademacher weights when the number of clusters is small (<~40); Statistic raises or returns NaN on a resample (e... |
| borusyak_jaravel_spiessA | Borusyak, Jaravel & Spiess (2024) imputation DID estimator. Do NOT use when: no never-treated or not-yet-treated observations remain -- the imputation model cannot be fit; the design is a simple 2x2 -- use sp.did(method='2x2'). Assumptions: Conditional parallel trends between treated and comparison groups absent treatment; No anticipation of treatment before its onset; Treatment effects may be heterogeneous across cohorts and time (no homogeneity required). Pre-conditions: Panel or repeated cross-section with a unit (or group) identifier and a time identifier; At least one never-treated or not-yet-treated comparison group; Pre-treatment periods to assess parallel trends. Failure modes: Pre-treatment event-study coefficients are jointly non-zero (pre-trend violation) -> Use honest DiD bounds to quantify robustness to trend violations, or condition on covariates; Two-way fixed-effects estimate is contaminated by 'forbidden' comparisons / negative weights -> Use a heterogeneity-robust estimator (Callaway-Sant'Anna, Borusyak et al., Gardner two-stage); Pre-trend joint test p < 0.05 (or underpowered at 0.10) -> Use sp.sensitivity_rr (Rambachan & Roth honest CI) or switch to sp.callaway... |
| boundary_rdA | User-friendly alias for :func: |
| breakdown_frontierA | Masten-Poirier (2021) breakdown frontier for qualitative conclusions. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Only weak (set-identifying) assumptions are imposed; the result is an interval, not a point; Lee bounds add monotonicity of selection; Oster's delta adds proportional selection on observed vs. unobserved. Pre-conditions: The data needed for the point-identifying analysis, plus the weakest credible identifying restriction; For Lee bounds: a binary selection/attrition indicator. Failure modes: Bounds are too wide to be informative -> Add a credible auxiliary restriction (monotone treatment response, instrument) to tighten the bounds. Alternatives: sp.oster_delta, sp.lee_bounds, sp.manski_bounds. Typical minimum N: 100. |
| breakdown_mB | Compute the breakdown value of M. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Conditional parallel trends between treated and comparison groups absent treatment; No anticipation of treatment before its onset; Treatment effects may be heterogeneous across cohorts and time (no homogeneity required). Pre-conditions: Panel or repeated cross-section with a unit (or group) identifier and a time identifier; At least one never-treated or not-yet-treated comparison group; Pre-treatment periods to assess parallel trends. Failure modes: Pre-treatment event-study coefficients are jointly non-zero (pre-trend violation) -> Use honest DiD bounds to quantify robustness to trend violations, or condition on covariates; Two-way fixed-effects estimate is contaminated by 'forbidden' comparisons / negative weights -> Use a heterogeneity-robust estimator (Callaway-Sant'Anna, Borusyak et al., Gardner two-stage). Alternatives: sp.callaway_santanna, sp.did, sp.honest_did. Typical minimum N: 100. |
| bridgeA | Unified dispatcher for six causal-inference bridging theorems (2025-2026): DiD==SC (Shi-Athey), EWM==CATE (Ferman), IPW==DR==CB (Zhao-Percival), Bunching==RDD (Lu-Wang-Xie), DR-via-Calibration (Zhang), Long-term-surrogate==PCI (Imbens-Kallus-Mao-Wang). Reports both path estimates + doubly-robust recommendation. Assumptions: The two estimation paths being bridged target the same causal estimand under the chosen bridging theorem (e.g., DID = synthetic control for kind='did_sc'); Each path's own identification holds (parallel trends / SC convex-hull / proximal completeness, depending on kind), so a non-rejected agreement test is meaningful; The doubly-robust combined estimate is consistent if at least one of the two bridged paths is correctly specified. Pre-conditions: kind is one of the supported bridges and the matching per-bridge kwargs are supplied; Panel/data shape matches the chosen bridge (e.g., did_sc needs unit, time, treated_unit, treatment_time); Both paths are estimable on the same sample so the agreement test is well-defined. Failure modes: Agreement test rejects: the two paths give materially different estimates -> Treat divergence as evidence one bridging assumption fa... |
| briefA | One-line agent-friendly brief for a fitted result. Cheaper than calling brief_result if you already have the result object in scope. |
| brief_resultA | Return the one-line agent-friendly brief for a fitted result. Uses sp.brief(). Useful when an agent wants to summarise a chained workflow without paying for the full JSON payload again. |
| bunchingA | Estimate bunching at a policy threshold. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: The counterfactual density would be smooth through the threshold absent the policy; Excess mass at the threshold reflects the behavioural elasticity of interest; No other discontinuity coincides with the threshold. Pre-conditions: A behavioural choice variable (earnings, hours, ...) with a known kink or notch in the budget/choice set; A visible empirical density of the running variable around the threshold. Failure modes: Round-number heaping or a coincident policy contaminates the bunching mass -> Exclude heaping points, widen the excluded region, and test the counterfactual polynomial order. Alternatives: sp.rdrobust, sp.rkd. Typical minimum N: 500. |
| bvarC | Bayesian VAR with Minnesota (Litterman) prior. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| calibrate_confounding_strengthD | Calibrate the strength of an unobserved confounder required to |
| calibration_testA | BLP-of-CATE calibration test (Chernozhukov-Demirer-Duflo-Fernandez-Val 2020). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness given the covariates; Overlap / positivity; Honesty: separate subsamples are used to choose splits and to estimate effects. Pre-conditions: Covariates, treatment, and outcome with enough data to grow an honest forest. Failure modes: Calibration test rejects -- the forest's heterogeneity is not well calibrated -> Increase the sample / number of trees, or fall back to a doubly-robust learner. Alternatives: sp.dml, sp.auto_cate, sp.tmle. Typical minimum N: 1000. |
| california_prop99C | California Proposition 99 tobacco control dataset. |
| california_tobaccoB | California Proposition 99 tobacco dataset (simulated, extended). |
| callaway_santannaA | Staggered DID (Callaway-Sant'Anna 2021): group-time ATT with doubly-robust, IPW, or regression-adjusted estimators. Robust to heterogeneous treatment effects where TWFE fails. Requires a cohort column g (first-treatment period; 0 = never-treated). Validation: certified evidence with scoped limitations. Known limitations: clustervars is not yet supported with bstrap=False; the analytic standard errors do not account for within-cluster dependence, so the multiplier bootstrap is required. |
| cardinality_matchB | Cardinality matching -- maximise the number of matched pairs subject Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness: treatment is as-good-as-random given the measured covariates; Overlap / common support: every unit has a non-degenerate probability of each treatment; The covariate set blocks all back-door paths. Pre-conditions: Pre-treatment covariates measured for treated and control units; A binary (or low-cardinality) treatment indicator; Sufficient covariate overlap between treatment arms. Failure modes: Poor overlap -- extreme propensity scores or few acceptable matches -> Trim or restrict to the common-support region and report the discarded units; Covariate imbalance remains after matching/weighting -> Re-specify the balancing model (CBPS, entropy balancing) and re-check standardized mean differences. Alternatives: sp.propensity_score, sp.cbps, sp.ebalance, sp.dml. Typical minimum N: 200. |
| cate_by_groupA | Group-level average treatment effects. Assumptions: Unconfoundedness given the covariates; Overlap / positivity across the covariate space; Nuisance functions are estimated consistently; cross-fitting controls overfitting bias. Pre-conditions: Covariates, a treatment indicator, and an outcome for each unit; Enough data to fit flexible nuisance models with sample-splitting / cross-fitting. Failure modes: CATE estimates are unstable or extrapolate beyond the covariate support -> Restrict to the overlap region, increase data, or use a doubly-robust learner (DR-/R-learner). Alternatives: sp.dml, sp.causal_forest, sp.tmle. Typical minimum N: 500. |
| cate_evalA | Evaluate any CATE estimator via RATE / AUTOC / Qini (Yadlowsky 2025). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness given the covariates; Overlap / positivity across the covariate space; Nuisance functions are estimated consistently; cross-fitting controls overfitting bias. Pre-conditions: Covariates, a treatment indicator, and an outcome for each unit; Enough data to fit flexible nuisance models with sample-splitting / cross-fitting. Failure modes: CATE estimates are unstable or extrapolate beyond the covariate support -> Restrict to the overlap region, increase data, or use a doubly-robust learner (DR-/R-learner). Alternatives: sp.dml, sp.causal_forest, sp.tmle. Typical minimum N: 500. |
| cate_group_plotB | Plot group-level CATEs with confidence intervals. |
| cate_plotB | Plot the CATE distribution. |
| cate_summaryC | Descriptive statistics of the CATE distribution. |
| causalA | End-to-end causal workflow: diagnose -> recommend estimator -> fit -> run robustness -> return result. The one-shot entry point that lets an agent analyse a dataset in a single call without orchestrating stages itself. |
| causal_discoveryD | Causal-discovery dispatcher -- article-facing alias. |
| causal_dqnA | Causal deep Q-network (Li, Zhang, Bareinboim 2025, arXiv:2510.21110) for offline policy learning under unobserved confounding. Learns a confounding-robust Q-function via bootstrap data augmentation. Assumptions: Sequential ignorability: no unobserved confounders of actions and outcomes; Positivity: the behaviour policy explores all evaluated actions; The environment satisfies the assumed (Markov) dynamics. Pre-conditions: Logged trajectories (states, actions, rewards) from a known or estimable behaviour policy. Failure modes: Poor behaviour-policy coverage -- the target policy queries unseen state-action regions -> Use offline-safe / pessimistic methods and report effective sample size of the importance weights. Alternatives: sp.offline_safe_policy, sp.policy_value. Typical minimum N: 1000. |
| causal_forestA | Causal Forest for heterogeneous treatment effect estimation (CATE). Validation: certified evidence with scoped limitations. Known limitations: The AIPW ATE/ATT are validated against grf on clean-overlap designs only; under severe propensity-overlap loss the AIPW influence function inflates the standard error (conservative, over-covering inference), so inspect the sp.audit overlap diagnostic before interpreting the ATE on that kind of sample. Assumptions: Unconfoundedness: Y(d) perp D | X; Overlap: 0 < P(D=1 | X) < 1 for the estimand support; Honest splitting: splits and estimates use disjoint samples (enforced by default). Pre-conditions: formula uses pipe separator: 'y ~ treatment | x_1 + x_2 + ...'; treatment is binary 0/1 (use sp.multi_arm_forest for multi-valued); covariates are numeric; encode categoricals beforehand. Failure modes: Calibration test (sp.calibration_test) rejects -> CATE predictions are miscalibrated -- increase n_trees, add variables, or switch to a DR-Learner; Variance of CATE estimates too large to be useful -> Need more observations or narrower conditioning set; consider GATE on discrete subgroups; Extreme propensity scores in part of the covariate space -... |
| causal_impactA | Bayesian structural time series for causal impact analysis. Assumptions: No simultaneous shocks affect treated and control series differently at intervention; Pre-period relationship extrapolates into the post-period absent treatment. Pre-conditions: Observed time series has a clearly defined intervention date; Pre-intervention period is long enough to fit the counterfactual model. Failure modes: Poor pre-period fit or unstable posterior predictive interval -> Add controls, lengthen the pre-period, or use synthetic control as a robustness check. Alternatives: sp.synth, sp.sequential_sdid, sp.local_projections. Typical minimum N: 30. |
| causal_rl_benchmarkA | Generate a synthetic causal-RL benchmark dataset. Assumptions: Sequential ignorability: no unobserved confounders of actions and outcomes; Positivity: the behaviour policy explores all evaluated actions; The environment satisfies the assumed (Markov) dynamics. Pre-conditions: Logged trajectories (states, actions, rewards) from a known or estimable behaviour policy. Failure modes: Poor behaviour-policy coverage -- the target policy queries unseen state-action regions -> Use offline-safe / pessimistic methods and report effective sample size of the importance weights. Alternatives: sp.offline_safe_policy, sp.policy_value. Typical minimum N: 1000. |
| cbpsA | Covariate-Balancing Propensity Score estimator (Imai-Ratkovic 2014). Validation: certified parity evidence. Assumptions: Unconfoundedness: treatment is as-good-as-random given the measured covariates; Overlap / common support: every unit has a non-degenerate probability of each treatment; The covariate set blocks all back-door paths. Pre-conditions: Pre-treatment covariates measured for treated and control units; A binary (or low-cardinality) treatment indicator; Sufficient covariate overlap between treatment arms. Failure modes: Poor overlap -- extreme propensity scores or few acceptable matches -> Trim or restrict to the common-support region and report the discarded units; Covariate imbalance remains after matching/weighting -> Re-specify the balancing model (CBPS, entropy balancing) and re-check standardized mean differences. Alternatives: sp.propensity_score, sp.cbps, sp.ebalance, sp.dml. Typical minimum N: 200. |
| cfm_decomposeC | Chernozhukov-Fernandez-Val-Melly (2013) counterfactual decomposition. |
| cgs_continuous_didA | Callaway, Goodman-Bacon & Sant'Anna (2024) DiD with a CONTINUOUS treatment. A dose has no single ATT: the TWFE coefficient averages the 0.2-dose and 0.8-dose comparisons with weights that can be negative. Reports ATT(d) and its derivative ACRT(d) -- the causal response at dose d, which is what a marginal-dose question asks -- from a B-spline regression of the outcome change on the dose. Validation: certified evidence with scoped limitations. Known limitations: standard errors come from the per-cell influence function; contdid routes its own through the pte aggregation layer, which is not implemented here; staggered designs aggregate cells with StatsPAI's own treated-count weights; only the per-cell estimator is pinned against the reference; the cck (nonparametric) dose estimator is not implemented. Assumptions: Parallel trends in the untreated potential outcome; Strong parallel trends for ATT(d) to be the effect of dose d; No anticipation. Pre-conditions: panel with a continuous dose and some zero-dose units; at least one period before each treated cohort. Failure modes: No zero-dose units in a cell -> ATT(d) is levelled against the zero-dose group. Use control_group='notyettreate... |
| check_absorbingA | Detect non-absorbing (reverting) treatment in a panel. Cohort-based DiD estimators (callaway_santanna, sun_abraham, did_imputation, etwfe, stacked_did) represent treatment by the first-treated period, which is lossless only when treatment never turns off. Under reversal they treat post-reversal periods as still-treated and are biased toward zero -- on a 150-unit panel with a third of units reverting, callaway_santanna returns 0.71 against a true ATT of 1.5, silently, because it never sees the time-varying indicator. Run this on the raw panel before picking an estimator. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Pre-conditions: long panel with unit x time x time-varying treatment; treatment column is numeric (0/1). Alternatives: sp.did_multiplegt, sp.lp_did, sp.did_multiplegt_dyn. |
| check_identificationA | Design-level identification diagnostics: bad controls, overlap, cohort sizes, IV first-stage F, clustering. Run BEFORE fitting any estimator to surface design problems. |
| chilean_householdsC | Chilean-style household income with urban/rural gap. |
| cicA | Changes-in-Changes (Athey & Imbens 2006). Nonparametric quantile DiD that identifies the full counterfactual outcome distribution for treated units, not just the mean. Reports quantile treatment effects (QTE) via empirical-CDF transformation; bootstrap SE. Validation: certified parity evidence. Assumptions: Rank-invariance of untreated potential outcomes across periods; Time-invariant group-level production technology (distributional DiD); SUTVA. Pre-conditions: continuous-ish outcome with sufficient support overlap between treated and control; 2 periods, 2 groups. Failure modes: Discrete outcome with few support points -> CIC quantile transformation degenerates; use sp.qte or sp.drdid for mean effects. Alternatives: sp.qte, sp.drdid, sp.did_2x2. Typical minimum N: 200. |
| clogitB | McFadden's conditional (fixed-effect) logit for choice data. Validation: certified parity evidence. |
| cloglogC | Complementary log-log regression via maximum likelihood. Validation: certified parity evidence. |
| cluster_cateA | Cluster-based CATE estimator. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness given the covariates; Overlap / positivity across the covariate space; Nuisance functions are estimated consistently; cross-fitting controls overfitting bias. Pre-conditions: Covariates, a treatment indicator, and an outcome for each unit; Enough data to fit flexible nuisance models with sample-splitting / cross-fitting. Failure modes: CATE estimates are unstable or extrapolate beyond the covariate support -> Restrict to the overlap region, increase data, or use a doubly-robust learner (DR-/R-learner). Alternatives: sp.dml, sp.causal_forest, sp.tmle. Typical minimum N: 500. |
| cluster_cross_interferenceA | Cluster-randomised trial under cross-cluster interference (Ding et al. 2025). Estimates direct + spillover effects when treatment of one cluster affects outcomes in adjacent clusters. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Partial interference: spillovers operate within clusters but not across cluster boundaries; Exposure mapping correctly captured by neighbour_treat_share (user-precomputed share of treated neighbours); Cluster-level treatment is binary and randomized (cluster RCT). Pre-conditions: Cluster identifier column plus individual-level outcome; Cluster-level binary treatment column; Precomputed neighbour_treat_share column from spatial/network adjacency. Failure modes: neighbour_treat_share missing or not a valid 0-1 share -> Precompute the treated-neighbour share per cluster from your adjacency matrix before calling; Too few clusters for cluster-robust inference -> Increase the number of clusters or use a design with weaker cluster requirements. Alternatives: sp.inward_outward_spillover, sp.network_hte, sp.interference, sp.spillover. Typical minimum N: 30. |
| cluster_robust_seB | Return cluster-robust standard errors (diagonal sqrt of vcov). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| cohort_anchored_event_studyA | Cohort-anchored event study. Instead of averaging across cohorts at each relative-time bin (which can contaminate leads / lags with other cohorts' dynamics), estimates separate event-study paths per cohort and then aggregates with cohort weights. Standard errors are cluster-robust and carry no protection against parallel-trends violations: this is the cohort-anchored estimator Liu (2025) starts from, NOT that paper's block-bias robust-inference procedure, which is not implemented. For parallel-trends sensitivity use sp.honest_did. Assumptions: Parallel trends hold within each treatment cohort relative to never-treated units (cohort-anchored, not pooled TWFE); No anticipation: outcomes in pre-event periods unaffected by future treatment; Treatment is an absorbing first-treatment event (staggered adoption, treat encodes first period, 0 = never-treated). Pre-conditions: Long-format balanced/unbalanced panel with id and time columns; treat column gives first-treatment period per unit (0 = never-treated), with at least one never-treated cohort; Enough pre/post periods to fill the requested leads/lags event-time window. Failure modes: All units treated in same period / no never-treated... |
| cohort_event_study_plotC | Per-cohort event study plot (overlay). |
| compare_estimatorsC | Run multiple estimators on the same data and compare. |
| compare_event_study_conventionsA | Run several DiD estimators on one non-staggered panel and measure how far each event-study path departs from the dynamic TWFE benchmark. Splits the difference into a common vertical shift within each half of the path and a residual, so a symmetric estimator scores zero asymmetry while the kink (Callaway-Sant'Anna varying base period), the jump (BJS pre-trend convention) and the N0/N attenuation (fect / did2s in-sample residuals) each get their own signature. Warns when the recorded convention disagrees with what the data show. Assumptions: The comparison is descriptive: it measures construction differences, not which estimator is correct. Pre-conditions: panel with unit x time x outcome; exactly one treated cohort (non-staggered design); at least one never-treated unit. Failure modes: Staggered adoption (more than one treated cohort) -> Restrict to one cohort plus never-treated units; with staggered timing a gap against TWFE mixes the reference convention with forbidden comparisons; No never-treated units -> The TWFE benchmark path needs untreated units. Alternatives: sp.event_study_convention, sp.bacon_decomposition. Typical minimum N: 50. |
| compare_metalearnersA | Fit multiple meta-learners and compare their ATE estimates. Assumptions: Unconfoundedness given the covariates; Overlap / positivity across the covariate space; Nuisance functions are estimated consistently; cross-fitting controls overfitting bias. Pre-conditions: Covariates, a treatment indicator, and an outcome for each unit; Enough data to fit flexible nuisance models with sample-splitting / cross-fitting. Failure modes: CATE estimates are unstable or extrapolate beyond the covariate support -> Restrict to the overlap region, increase data, or use a doubly-robust learner (DR-/R-learner). Alternatives: sp.dml, sp.causal_forest, sp.tmle. Typical minimum N: 500. |
| conditional_lr_ciD | Moreira (2003) CLR confidence set -- re-export of Validation: certified parity evidence. |
| conformalB | Unified conformal causal inference dispatcher. kind= selects the estimator: 'cate' / 'counterfactual' / 'ite' (Lei-Candes 2021 base) / 'weighted' (TBCR 2019 primitive) / 'density' / 'multidp' / 'debiased' / 'fair' (2025-2026 frontier) / 'continuous' (dose-response) / 'interference' (cluster-exchangeable). Kwargs pass through to the target function; see sp.conformal_family guide. Assumptions: Exchangeability of calibration and test points (base case); For kind='weighted': known or estimable density ratio between calibration and test; For kind='cate' / 'ite': selection-on-observables with correct propensity / outcome model. Pre-conditions: calibration sample disjoint from training sample (auto-split or user-supplied); exchangeability between calibration and test distributions (weighted variants for covariate shift); for CATE / ITE variants: unconfoundedness + overlap on covariates. Failure modes: Calibration and test distributions differ (covariate shift) -> Use kind='weighted' with estimated density ratios; Calibration set too small -- intervals wide -> Increase calibration sample or raise alpha; coverage gets loose below ~100; Miscalibrated nuisance (propensity / outcome) for CATE... |
| conformal_fair_iteA | Counterfactual-fair conformal prediction for ITE (2025). Wraps standard conformal ITE intervals with a demographic-parity adjustment, giving distribution-free coverage under protected-attribute shifts. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Exchangeability for conformal coverage, applied within protected-group strata; Counterfactual fairness: protected attribute excluded from the outcome regression (used only for stratified calibration); ITE ignorability / overlap so the treated and control nuisances are identified. Pre-conditions: DataFrame with y, treat, predictive covariates, and a categorical protected column; Calibration set per protected stratum for group-wise conformal coverage; Optional test_data to emit fair ITE intervals on. Failure modes: A protected stratum has too few calibration rows for valid group-wise quantiles -> Collapse sparse protected categories or pool strata before calibration; protected column accidentally leaks into covariates, breaking counterfactual fairness -> Remove the protected attribute from covariates; pass it only via the protected argument. Alternatives: sp.conformal,... |
| conformal_iteD | Conformal ITE -- article alias for :func: |
| conformal_synthA | Conformal inference for synthetic control. Assumptions: A convex (or regularized) combination of donor units reproduces the treated unit's pre-treatment outcome path; No interference: the treatment does not affect the donor units (SUTVA); No anticipation before the treatment date. Pre-conditions: Panel of one or more treated units plus an untreated donor pool, observed over time; Pre-treatment window long enough to fit donor weights (rule of thumb: more pre-periods than donors used); Outcome observed for every unit in every period. Failure modes: Large pre-treatment RMSPE -- the synthetic unit fails to track the treated unit before treatment -> Add donors / predictors, lengthen the pre-period, or use a bias-corrected estimator (sdid, augsynth); Placebo / permutation inference shows the estimate is not extreme relative to donors -> Report the placebo distribution honestly; the effect may not be distinguishable from noise. Alternatives: sp.sdid, sp.augsynth, sp.gsynth, sp.callaway_santanna. Typical minimum N: 15. |
| conleyA | Compute Conley (1999) spatial -- and optionally spatio-temporal -- HAC Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Cost: Sparse and scale-safe: a scipy cKDTree ball query enumerates only observation pairs within dist_cutoff, so memory is O(n + pairs-within-cutoff) rather than O(n^2). This is the recommended Conley path on large samples -- unlike feols(vce='conley') / hdfe_ols(vce='conley'), which are dense. Cost still grows with dist_cutoff: a cutoff large enough to link most observations recovers the quadratic pair count. |
| continuous_didA | DiD with continuous treatment intensity. Four modes: (i) 'twfe' TWFE with dosexpost interaction; (ii) 'att_gt' dose-quantile group-time ATT versus the untreated (dose=0) arm with bootstrap SE (heuristic); (iii) 'dose_response' local-linear regression of DeltaY=Y_post-Y_pre on baseline dose; (iv) 'cgs' Callaway-Goodman-Bacon-Sant'Anna (2024) ATT(d|g,t) MVP -- 2-period design, OR only, bootstrap SE, [pending verification] markers on paper formulas. Full CGS parity (cohort aggregation, DR/IPW, analytical IF variance) is on the roadmap -- see docs/rfc/continuous_did_cgs.md. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Known limitations: method='cgs' is an MVP -- 2-period design, OR only, bootstrap SE; full CGS parity (cohort aggregation, DR/IPW, analytical IF variance) is on the roadmap (see docs/rfc/continuous_did_cgs.md). Other modes (twfe / att_gt / dose_response) are stable. Assumptions: Parallel trends in potential outcomes across dose levels; No anticipation of treatment; Strong parallel trends (CGS 2024) required for ATT(d|g,t) interpretation in att_gt mode. Pre-conditions: panel data with unit x time x outcome x contin... |
| continuous_iv_lateA | LATE with a continuous instrument (Xie et al. 2025). Estimates the LATE on the maximal complier class via quantile-bin Wald ratios, weighted by the bin-pair with the largest first-stage response. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Instrument relevance (non-zero first stage); Exclusion restriction: the instrument affects the outcome only through the treatment; Independence/exogeneity of the instrument; for LATE, monotonicity (no defiers). Pre-conditions: An instrument plausibly affecting treatment, an endogenous treatment, and an outcome; A strong first stage (assess instrument strength before interpreting estimates); formula includes the (endog ~ instruments) parenthesised block. Failure modes: Weak first stage -- biased point estimates and unreliable conventional SEs -> Report first-stage F / effective F and use weak-IV-robust inference (Anderson-Rubin); First-stage F < 10 (Stock-Yogo 5% bias) -> Use weak-IV-robust inference (Anderson-Rubin) or LIML; Over-identification test rejects (sp.estat 'overid') -> At least one instrument is invalid; drop instruments or switch to just-identified LIML. Alterna... |
| contrastB | Compute contrasts of predictive margins across levels of a variable. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| copula_sensitivityB | Gaussian-copula sensitivity to unobserved confounding. |
| coxC | Cox Proportional Hazards model via partial likelihood. Validation: certified parity evidence. |
| cox_frailtyB | Cox proportional hazards with shared gamma frailty. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| cps_wageC | CPS-style wage data with a gender gap. |
| cr2_seA | CR2 bias-corrected cluster-robust standard errors (Bell & McCaffrey 2002). Validation: certified parity evidence. |
| cr3_jackknife_vcovB | CR3 cluster-jackknife variance (delete-one-cluster). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| cross_validateA | Cross-validate ONE estimand across INDEPENDENT engines (StatsPAI, pyfixest, linearmodels, DoubleML, R's fixest, Stata) and report whether they agree (AGREE / PARTIAL / DISAGREE / INSUFFICIENT). Use this to honour the cross-package reproducibility rule: trust a number only when >=2 independent implementations reproduce it. Needs a data_path. |
| cs_reportC | One-call staggered-DID workflow following Baker et al. (2026). |
| cumincC | Cumulative incidence functions for competing risks (Aalen-Johansen). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| cusum_testC | CUSUM test for parameter stability. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| dagA | Declare a causal DAG and perform identification analysis: backdoor/frontdoor adjustment sets, d-separation, path enumeration, bad controls detection, variable role classification, do-operator. Assumptions: The graph is acyclic and contains the relevant common causes; Adjustment-set validity depends on the supplied graph being substantively correct. Pre-conditions: Nodes and directed edges encode a substantive causal model; Treatment and outcome nodes are named consistently. Failure modes: No valid adjustment set or cycle detected -> Inspect graph structure, remove cycles, or use sensitivity analysis for unobserved common causes. Alternatives: sp.identify, sp.dag_recommend_estimator, sp.swig. Typical minimum N: 1. |
| dag_exampleB | Load a classic textbook DAG: confounding, collider, mediation, discrimination, movie_star, police, frontdoor, bad_control_earnings, m_bias. |
| das_guptaC | Das Gupta (1993) multi-factor decomposition. Validation: certified parity evidence. |
| dddA | Triple Differences (DDD) estimator. Adds a within-treatment-group subgroup that is unaffected by treatment as an additional control dimension, relaxing parallel trends from 'same trend across groups' to 'same differential trend across subgroups within groups'. Validation: certified parity evidence. Assumptions: Parallel trends in the DDD differential (weaker than DID PT); No anticipation; SUTVA. Pre-conditions: treat x time x subgroup variation exists; subgroup is binary and meaningful within treatment group. Failure modes: Staggered adoption with heterogeneous effects -> Textbook DDD can have negative weights with staggered timing. The Olden-Men (2022) / Strezhnev (2023) heterogeneity-robust DDD is on the roadmap (see docs/rfc/did_roadmap_gap_audit.md Section 4). Alternatives: sp.did_2x2, sp.callaway_santanna. Typical minimum N: 100. |
| ddd_heterogeneousA | Heterogeneity-robust triple differences (DDD) for staggered adoption. Decomposes DDD into per-(cohort, time) cells via a Callaway-Sant'Anna-style aggregation, with the unaffected subgroup's DID as a placebo. Avoids the negative-weight issue that textbook TWFE DDD inherits from TWFE DID (Goodman-Bacon 2021 analogue). Validation: certified evidence with scoped limitations. Known limitations: the placebo joint test is only produced on the bootstrap path; se='analytic' reports None for it, because that test needs the joint covariance of the placebo arms rather than of the DDD; control_group='notyettreated' is only partially comparable to triplediff 0.2.4: its per-control-cohort estimates agree exactly, but the reference misindexes the influence functions it combines, so the combined numbers differ by convention on cells where the comparison does not span the whole panel; the aggregation convention differs from triplediff::agg_ddd(type='simple'): the default weights cohorts by treated-eligible units; pass weight_by='cohort' to match the R package. Assumptions: Parallel trends relaxed to: same differential trend across treated vs never-treated, within both affected and unaffected subgro... |
| decomposeA | Unified entry point for all decomposition methods. Validation: certified parity evidence. Assumptions: Overlapping support of covariates across groups (reweighting / RIF methods are invalid outside overlap); Linearity assumption holds for Oaxaca-Blinder-type decompositions; non-linear methods (FFL/DFL/Machado-Mata) relax this; Conditional independence of group membership for causal interpretation (otherwise: descriptive decomposition only). Pre-conditions: Data contains a binary or categorical group indicator with both groups represented; Outcome and covariates are numeric (or properly encoded) and finite; Sample sizes per group are large enough to estimate group-specific moments (rule of thumb: each group >= 100). Failure modes: Trimming warning at common-support boundaries -> Inspect propensity-score support; restrict the analysis sample or use bounds; RIF coefficients explode at distribution tails -> Use higher-bandwidth kernel density, restrict quantile range, or switch to FFL. Alternatives: sp.dfl_decompose, sp.ffl_decompose, sp.oaxaca, sp.rif_decomposition. Typical minimum N: 200. |
| demeanC | Return the within-transformed |
| demeaned_synthA | De-meaned / De-trended Synthetic Control Method. Assumptions: A convex (or regularized) combination of donor units reproduces the treated unit's pre-treatment outcome path; No interference: the treatment does not affect the donor units (SUTVA); No anticipation before the treatment date. Pre-conditions: Panel of one or more treated units plus an untreated donor pool, observed over time; Pre-treatment window long enough to fit donor weights (rule of thumb: more pre-periods than donors used); Outcome observed for every unit in every period. Failure modes: Large pre-treatment RMSPE -- the synthetic unit fails to track the treated unit before treatment -> Add donors / predictors, lengthen the pre-period, or use a bias-corrected estimator (sdid, augsynth); Placebo / permutation inference shows the estimate is not extreme relative to donors -> Report the placebo distribution honestly; the effect may not be distinguishable from noise. Alternatives: sp.sdid, sp.augsynth, sp.gsynth, sp.callaway_santanna. Typical minimum N: 15. |
| design_intakeD | Route design facts to a method-selection status. |
| design_robust_event_studyA | Design-robust event study with explicit negative-weight diagnostics per cohort x relative-time cell. Reports which event-study coefficients receive negative weights in TWFE and flags the affected horizons. Assumptions: Parallel trends across cohorts; treatment effects may be heterogeneous across cohort and time; No anticipation prior to the event time; Implicit TWFE comparison weights are non-negative (negative-weight contamination is diagnosed, not assumed away). Pre-conditions: Long-format panel with y, treat, time, id (same conventions as callaway_santanna); Staggered/variable treatment timing so the per-(cohort, time) weight diagnostic is meaningful; Event-time window (leads, lags) contained within observed pre/post coverage. Failure modes: model_info weights show large negative TWFE weights flagging forbidden comparisons -> Drop already-treated controls and use a heterogeneity-robust staggered estimator instead of TWFE; Too few treated units per cohort-time cell to identify weights or SEs -> Coarsen the event-time window or pool cohorts to raise per-cell counts. Alternatives: sp.sun_abraham, sp.bacon_decomposition, sp.cohort_anchored_event_study, sp.callaway_santanna. Typical... |
| detect_designA | Auto-detect the study design (panel / cross-section / RD / IV-style) from column shapes and types. Returns the guessed design plus the columns that drove the inference. Call this BEFORE recommend() when the user pastes a CSV with no context. |
| dfl_decomposeA | DFL (1996) reweighting decomposition at a chosen distributional statistic. Validation: certified parity evidence. Assumptions: DiNardo-Fortin-Lemieux reweighting: ignorable group assignment given covariates; Propensity-score model is correctly specified for the reweighting kernel; Common support across groups (no extrapolation beyond observed covariate range). Pre-conditions: Binary group indicator with sufficient overlap on covariates; Outcome distribution to decompose is continuous (typically log-wage). Failure modes: Extreme propensity-score weights inflate variance -> Trim or stabilize weights, or restrict to the common-support region. Alternatives: sp.ffl_decompose, sp.oaxaca, sp.machado_mata. Typical minimum N: 500. |
| diagnoseC | Comprehensive regression diagnostics in one call. |
| diagnose_resultA | Method-aware diagnostic battery: auto-selects tests by model type (OLS/DID/RDD/IV/SCM). Assumptions: The result object carries a recognizable method_type so the correct diagnostic battery can be routed; Each sub-check (e.g. parallel-trends, weak-IV, overid, balance) is only valid under that method's own identifying assumptions; Tests use the supplied alpha as the significance threshold; p-values are interpreted, not corrected for multiplicity. Pre-conditions: A fitted EconometricResults or CausalResult from a StatsPAI estimator; The estimator must expose enough fitted internals (residuals, first-stage, design info) for its checks. Failure modes: Passed a raw DataFrame, dict, or estimate float instead of a fitted result object -> Fit an estimator first and pass the returned result object, not the input data; Method type is unrecognized so no diagnostic battery applies and 'checks' comes back empty -> Run the method-appropriate standalone diagnostic directly instead of the router. Alternatives: sp.unified_sensitivity, sp.sensemakr, sp.oster_bounds, sp.spec_curve. Typical minimum N: 30. |
| didA | Fit a classic 2-period 2-group difference-in-differences. Pass treatment / time / post column names. For staggered adoption across many cohorts use callaway_santanna instead. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| did_2stageA | Gardner (2021) two-stage DID estimator. Assumptions: Conditional parallel trends between treated and comparison groups absent treatment; No anticipation of treatment before its onset; Treatment effects may be heterogeneous across cohorts and time (no homogeneity required). Pre-conditions: Panel or repeated cross-section with a unit (or group) identifier and a time identifier; At least one never-treated or not-yet-treated comparison group; Pre-treatment periods to assess parallel trends. Failure modes: Pre-treatment event-study coefficients are jointly non-zero (pre-trend violation) -> Use honest DiD bounds to quantify robustness to trend violations, or condition on covariates; Two-way fixed-effects estimate is contaminated by 'forbidden' comparisons / negative weights -> Use a heterogeneity-robust estimator (Callaway-Sant'Anna, Borusyak et al., Gardner two-stage); Pre-trend joint test p < 0.05 (or underpowered at 0.10) -> Use sp.sensitivity_rr (Rambachan & Roth honest CI) or switch to sp.callaway_santanna. Alternatives: sp.callaway_santanna, sp.did, sp.honest_did, sp.sun_abraham. Typical minimum N: 100. |
| did_2x2A | Canonical 2x2 DID: two groups (treated / control) x two periods (pre / post). Point estimate via either group-means differencing or OLS on the treat x post interaction; optional covariates, robust / cluster SE, and sample weights. Validation: certified parity evidence. Do NOT use when: treatment timing is staggered across units -- the TWFE 2x2 estimate is a negative-weighted mix (Goodman-Bacon 2021); use sp.callaway_santanna, sp.sun_abraham or sp.did_imputation. Assumptions: Parallel trends; No anticipation; SUTVA (no spillovers). Pre-conditions: data has exactly two time periods (pre, post); treat is 0/1 constant within unit (unit-level, not time-varying); at least a handful of treated and control units. Failure modes: Staggered timing (> 2 periods with varying treat start) -> Use sp.callaway_santanna / sp.sun_abraham / sp.did_imputation; Very few clusters at the group level -> Use wild cluster bootstrap via sp.wild_cluster_bootstrap; Pre-trend joint test p < 0.05 (or underpowered at 0.10) -> Use sp.sensitivity_rr (Rambachan & Roth honest CI) or switch to sp.callaway_santanna. Alternatives: sp.drdid, sp.did_analysis, sp.callaway_santanna, sp.sun_abraham. Typical minimum N: 30. |
| did_analysisA | Workflow wrapper that runs a full DiD pipeline: auto-detects 2x2 vs. staggered, runs the right estimator (CS by default), optionally runs Bacon decomposition, event study, and Rambachan-Roth sensitivity, and aggregates into a DIDAnalysis report object. Assumptions: Parallel trends between treated and control (2x2) or across cohorts (staggered) after any covariate adjustment; No anticipation: pre-treatment outcomes unaffected by future treatment; SUTVA / no interference across units; correct design auto-detection (2x2 vs staggered). Pre-conditions: Panel or repeated cross-section with y, treat, time; id required for staggered designs; treat is binary 0/1 for 2x2, or first-treatment period (0 = never-treated) for staggered; event_window within observed periods when run_event_study is enabled. Failure modes: Staggered design detected but no id column supplied, so cohorts cannot be formed -> Pass the unit identifier via id= so first-treatment cohorts can be inferred; Event-study pre-trend test rejects parallel trends in the bundled report -> Inspect the included honest_did sensitivity output and report bounds rather than the point ATT; Requested method incompatible with the detected d... |
| did_balanceA | Covariate balance for a DiD design, in the shape Baker et al. (2026, Table 4) report it: Imbens-Rubin normalized differences computed twice -- once on baseline covariate LEVELS and once on covariate CHANGES across the treatment date -- optionally weighted and unweighted side by side. The changes panel is the informative half: DiD identifies off trends, so a covariate that is balanced in levels can still be moving differentially, and imbalances routinely flip sign between the two panels. Flags |norm. diff| > 0.25. Evidence about whether UNCONDITIONAL parallel trends is plausible; it cannot test parallel trends itself. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Known limitations: pooled multi-cohort balance is not implemented: one table per treated cohort only, because the normalized difference is a two-group statistic; only the reliability-weight variance correction is implemented for the weighted panel; survey-design (replicate-weight) variances are not supported; inference is not implemented: the normalized difference is reported as a descriptive effect size with no standard error or test, by design; the weighted denomi... |
| did_bcfA | Bayesian Causal Forests DiD. Fits a BART-style ensemble with treatment and prognostic terms on the DiD residuals, providing heterogeneous treatment-effect posterior draws per unit. Useful for machine-learning DiD with covariates. Assumptions: Parallel trends: treated and control groups would have followed the same trajectory absent treatment; No anticipation: outcomes in pre-treatment periods are unaffected by future treatment; SUTVA: no spillovers between units. Pre-conditions: data is panel or repeated cross-section with a time column; treat column is binary (0/1) for 2x2, or first-treatment-period (int) for staggered; at least one pre-treatment period (>= 2 periods for 2x2; >= 3 recommended for event study). Failure modes: Pre-trend joint test p < 0.05 (or underpowered at 0.10) -> Use sp.sensitivity_rr (Rambachan & Roth honest CI) or switch to sp.callaway_santanna; Staggered treatment timing with TWFE method -> TWFE can give negative weights; use Callaway-Sant'Anna, Sun-Abraham, or BJS imputation; Pre-trend test underpowered (Roth 2022) -> Check sp.pretrends_power -- if low, report honest CI via sp.sensitivity_rr. Alternatives: sp.did_imputation, sp.drdid, sp.callaway_santanna,... |
| did_cluster_diagnosticsA | Count the clusters treatment is assigned at and grade the count against the simulation grid of Ulloa-Perez et al. (2025), who found that at 30 clusters every modern staggered DiD estimator they evaluated under-covered a nominal 95% interval, with coverage improving as clusters accumulated. Thirty is the smallest cell they ran, so fewer clusters is reported as outside their evidence rather than as merely worse. Also reports clusters per cohort, since a group-time effect rests on the clusters in its own cohort. Assumptions: The grading reports what published simulation evidence exists at this cluster count; it is not a power calculation for this design or estimator. Pre-conditions: panel with unit and cohort columns. Failure modes: Cluster column empty or absent -> Check that the cluster column is populated. Alternatives: sp.wild_cluster_bootstrap, sp.ri_test, sp.conley. |
| did_design_contractA | Report which of Baker, Callaway, Cunningham, Goodman-Bacon & Sant'Anna's (2026) eight forward-engineering steps a fitted DiD result actually pins down: target parameter, identifying assumption, estimation strategy, inference frame, estimate, sensitivity, heterogeneity. A slot the result cannot determine is reported as undetermined rather than filled with a default, because an unstated choice is still a choice the write-up owes the reader. Assumptions: Reports what the result object records; it cannot verify that a recorded assumption is true of the data. Pre-conditions: a fitted DiD result object. Failure modes: Result carries no model_info -> Every step is reported undetermined, which is the informative answer. Alternatives: sp.audit_result, sp.assumption_audit, sp.cs_report. |
| did_estimateA | R-style alias: |
| did_hadC | Heterogeneous-adoption DiD using quasi-untreateded groups. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| did_imputationA | Borusyak-Jaravel-Spiess (2024) imputation DiD. Fits a TWFE model on untreated observations only, imputes counterfactual Y(0) for treated obs, and averages the imputation residuals. Efficient under no-anticipation + parallel trends; analytical SE via bjs_inference. Validation: certified evidence with scoped limitations. Known limitations: R/Stata parity is for the documented untreated-only TWFE and simple ATT aggregation convention only; event-study and SE rows are backend-specific diagnostics. Do NOT use when: there is no never-treated (or not-yet-treated) group to fit the untreated-potential-outcome model on -- imputation has no estimation sample; the design is a simple 2x2 -- sp.did(method='2x2') is the same estimand and far cheaper; pre-trends are visibly non-parallel -- BJS imputes Y(0) from a two-way model that assumes them away, so violations are absorbed silently rather than surfaced. Cost: Fits the untreated two-way model once, then imputes; cheap in memory. vce='bootstrap' multiplies total runtime by n_boot -- budget accordingly before raising n_boot. Assumptions: Parallel trends in absolute levels; No anticipation (no pre-treatment reaction); SUTVA. Pre-conditions: panel... |
| did_misclassifiedA | Staggered DiD robust to treatment-timing misclassification and anticipation. Adjusts the CS-style aggregation for a user-supplied misclassification probability pi_misclass and a known anticipation horizon. Use when first-treat dates are noisy (e.g., survey-reported). Assumptions: Parallel trends: treated and control groups would have followed the same trajectory absent treatment; No anticipation: outcomes in pre-treatment periods are unaffected by future treatment; SUTVA: no spillovers between units. Pre-conditions: pi_misclass is between 0 and 0.5 (else identification flips); Known anticipation horizon; data is panel or repeated cross-section with a time column. Failure modes: Pre-trend joint test p < 0.05 (or underpowered at 0.10) -> Use sp.sensitivity_rr (Rambachan & Roth honest CI) or switch to sp.callaway_santanna; Staggered treatment timing with TWFE method -> TWFE can give negative weights; use Callaway-Sant'Anna, Sun-Abraham, or BJS imputation; Pre-trend test underpowered (Roth 2022) -> Check sp.pretrends_power -- if low, report honest CI via sp.sensitivity_rr. Alternatives: sp.callaway_santanna, sp.sun_abraham, sp.did_imputation, sp.sdid. Typical minimum N: 200. |
| did_multiplegtA | de Chaisemartin & D'Haultfuille (2020) DID_M estimator. Weighted average of consecutive-period DID cells where treatment 'switchers' are compared to 'stayers'. Handles treatments that switch on AND off (unlike Callaway-Sant'Anna which assumes staggered adoption). Supports placebo lags, dynamic horizons, cluster bootstrap SE, joint placebo test and average-cumulative-effect summary from dCDH (2024). The heteroskedastic-weights variant and full dCDH (2024) intertemporal event-study (did_multiplegt_dyn Stata) are on the roadmap -- see docs/rfc/multiplegt_dyn.md. Validation: certified parity evidence. Assumptions: Parallel trends between switchers and stayers; Stable treatment effects across consecutive periods (for the DID_M weighted average interpretation); No anticipation. Pre-conditions: long-format panel with one row per unit x period; treatment is binary (0/1) and may vary over time within a unit; at least two periods observed per unit so a first difference can be computed. Failure modes: No switching cells (nobody changes treatment) -> did_multiplegt identifies effects only from treatment switches. Fall back to callaway_santanna if the design is staggered adoption; Joint placeb... |
| did_multiplegt_dynC | [experimental] dCDH (2024) intertemporal event-study DiD (MVP -- see docs/rfc/multiplegt_dyn.md). At each horizon l in {-placebo, ..., dynamic}, compares Y_{F+l} - Y_{F-1} between units first switching at F and a not-yet-treated or never-treated control set held stable across the horizon. MVP caveats: analytical influence-function variance [pending verification] is not yet implemented (SE via cluster bootstrap); switch-off events are ignored; heteroskedastic-weights variant pending. Validation status: experimental. Known limitations: switch-off events are handled, but the heteroskedastic-weights variant (dCDH 2023 EJ survey) is not implemented; se_method='analytic' is available but the paper's own variance formula is not implemented: it is not pinned to DIDmultiplegtDYN and runs about 1% below its reported SEs; the headline aggregation convention differs from DIDmultiplegtDYN's Av_tot_eff: the default weights horizons equally; pass aggregation='switchers' to match the R package. Cost: Bootstrap inference dominates: total runtime is roughly n_boot x (one full estimation pass). The default n_boot is fine for a final table but expensive inside a search loop -- lower it while iter... |
| did_plotB | Classic DID diagram showing treatment effect with counterfactual. |
| did_reportB | DID report bundle: fits selected methods and writes report artifacts. |
| did_summaryA | One-call method-robustness comparison for staggered DID. |
| did_summary_plotB | Forest plot of DID method-robustness summary. |
| did_summary_to_latexB | Render a :func: |
| did_summary_to_markdownA | Render a :func: |
| did_timevarying_covariatesA | DiD with time-varying covariates frozen at baseline (Caetano, Callaway, Payne & Rodrigues 2022 [pending verification]). Avoids the bad-controls bias that arises when treatment affects the covariates: freezes X at period g + baseline_offset (default g-1) per cohort and uses the frozen values as controls in a per-(g, t) outcome-regression DiD. Aggregates via cohort-size weights. Assumptions: Conditional parallel trends given frozen baseline X; No anticipation; SUTVA. Pre-conditions: staggered adoption with >= 1 never-treated unit; covariates column(s) exist for the baseline period per cohort; integer-valued time column. Failure modes: No observation at baseline period for some units -> Fallback uses the first observed period; review detail coverage; Covariate measured with error or missing -> Impute (sp.mice_impute) or restrict to a complete sub-sample before calling; Pre-trend joint test p < 0.05 (or underpowered at 0.10) -> Use sp.sensitivity_rr (Rambachan & Roth honest CI) or switch to sp.callaway_santanna. Alternatives: sp.callaway_santanna, sp.drdid, sp.wooldridge_did, sp.sun_abraham. Typical minimum N: 150. |
| direct_methodA | Direct outcome regression (plug-in Q-model) OPE. Assumptions: Plug-in outcome regression (Q-model) is correctly specified; No unmeasured confounding in the logged data. Pre-conditions: X (context), A (logged action), R (reward) are available to fit the outcome model. Failure modes: Model misspecification bias -- the Q-model extrapolates outside the logged action support -> Prefer the doubly-robust estimator, which is robust to Q-model misspecification. Alternatives: sp.doubly_robust, sp.ips, sp.snips. Typical minimum N: 500. |
| discosA | Distributional Synthetic Controls (Gunsilius 2023). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: A convex (or regularized) combination of donor units reproduces the treated unit's pre-treatment outcome path; No interference: the treatment does not affect the donor units (SUTVA); No anticipation before the treatment date. Pre-conditions: Panel of one or more treated units plus an untreated donor pool, observed over time; Pre-treatment window long enough to fit donor weights (rule of thumb: more pre-periods than donors used); Outcome observed for every unit in every period. Failure modes: Large pre-treatment RMSPE -- the synthetic unit fails to track the treated unit before treatment -> Add donors / predictors, lengthen the pre-period, or use a bias-corrected estimator (sdid, augsynth); Placebo / permutation inference shows the estimate is not extreme relative to donors -> Report the placebo distribution honestly; the effect may not be distinguishable from noise. Alternatives: sp.sdid, sp.augsynth, sp.gsynth, sp.callaway_santanna. Typical minimum N: 15. |
| discos_plotC | Visualise distributional synthetic control results. |
| discos_testA | Test for distributional treatment effects. Assumptions: A convex (or regularized) combination of donor units reproduces the treated unit's pre-treatment outcome path; No interference: the treatment does not affect the donor units (SUTVA); No anticipation before the treatment date. Pre-conditions: Panel of one or more treated units plus an untreated donor pool, observed over time; Pre-treatment window long enough to fit donor weights (rule of thumb: more pre-periods than donors used); Outcome observed for every unit in every period. Failure modes: Large pre-treatment RMSPE -- the synthetic unit fails to track the treated unit before treatment -> Add donors / predictors, lengthen the pre-period, or use a bias-corrected estimator (sdid, augsynth); Placebo / permutation inference shows the estimate is not extreme relative to donors -> Report the placebo distribution honestly; the effect may not be distinguishable from noise. Alternatives: sp.sdid, sp.augsynth, sp.gsynth, sp.callaway_santanna. Typical minimum N: 15. |
| disparity_decomposeC | Jackson & VanderWeele (2018) causal disparity decomposition. |
| disparity_panelC | Synthetic disparity panel with treatment, mediator, outcome. |
| dist_ivA | Distributional IV: the complier LATE at each quantile of |
| distributional_didA | Treatment effect on the distribution of the outcome, bin by bin. Bins the outcome, runs Callaway-Sant'Anna on each bin indicator, and reports the effect on P(Y in bin). The per-bin effects sum to zero by construction -- treatment redistributes probability mass, it does not create it -- so the content is the SHAPE: which parts of the outcome distribution gained and which lost. A mean ATT of zero is perfectly consistent with large offsetting movements in the tails, and this is what shows them. R didFF::distDD. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Known limitations: reports point estimates and standard errors only; the reference runs no test here and neither does this; simultaneous (uniform) confidence bands over bins are not implemented; the standard errors are pointwise only, so reading several bins at once overstates joint confidence. Assumptions: parallel trends for each bin indicator; no anticipation. Pre-conditions: panel with at least one treated cohort and a comparison group; outcome takes at least two distinct values. Alternatives: sp.functional_form_test, sp.qdid, sp.cic, sp.panel_qtet. Typical minimum N:... |
| distributional_teA | Estimate distributional treatment effects. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Selection-on-observables (unconfoundedness + overlap) or, for IV variants, instrument validity; For IV-QTE: rank invariance / rank similarity (monotonicity of the structural quantile function). Pre-conditions: Covariates, treatment, and outcome; for IV-quantile methods, a valid instrument; Enough data to estimate the outcome distribution across quantiles. Failure modes: Estimated conditional quantiles cross (non-monotone), or tail quantiles are unstable -> Use rearrangement / monotonization and avoid extreme quantiles where data are sparse. Alternatives: sp.qte, sp.iv, sp.dml. Typical minimum N: 500. |
| diversity_indexA | Species-diversity indices from record-level or count data: Shannon entropy, species richness, Pielou evenness, the Simpson family (concentration / Gini-Simpson / inverse) and Hill numbers of any order. Accepts long-format sighting records or a site-by-species matrix and groups straight onto a panel index, so an ecological outcome can be built inside the same pipeline that estimates on it. min_records makes the small-sample filter explicit rather than a footnote. |
| dl_propensity_scoreA | Neural-net propensity score estimator (arXiv:2404.04794, 2024). Assumptions: Unconfoundedness / selection on observables: treatment is conditionally independent of potential outcomes given covariates; Overlap (positivity): 0 < e(X) < 1 for all units (scores are clipped to [0.02, 0.98]); Covariates are pre-treatment and the MLP correctly approximates e(X) = P(T=1 | X). Pre-conditions: Cross-sectional or pooled DataFrame with a binary treatment column and numeric covariate columns; No missing values in the covariate matrix passed to the network; Enough observations per treatment arm to fit a small MLP without overfitting. Failure modes: Heavy clipping at 0.02/0.98 indicates near-deterministic treatment and positivity violation -> Trim or restrict to the region of common support before using the scores in a weighted estimator; torch absent and sklearn MLP fails to converge in max_iter with lbfgs -> Increase max_iter, scale covariates, or shrink hidden_sizes for a simpler network. Alternatives: sp.overlap_weighted_did, sp.drdid, sp.did. Typical minimum N: 200. |
| dmlA | Double/Debiased Machine Learning for treatment effect estimation. Supports partially linear (PLR), interactive regression (IRM, binary D), partially linear IV (PLIV), and interactive IV (IIVM, binary D/binary Z -> LATE). Validation: certified parity evidence. Assumptions: Unconfoundedness: Y(d) perp D | X (conditional ignorability); Overlap: 0 < P(D=1 | X) < 1 for the estimand support (strong for IRM); Nuisance-function estimators converge at op(n^{-1/4}) -- fast enough that orthogonal moments give sqrtn CATE. Pre-conditions: data is tabular (DataFrame); covariates include all confounders conditional on which unconfoundedness holds; cross-fitting folds >= 2 (default 5) -- more folds -> lower variance, higher compute; for irm / iivm: treatment (and for iivm: instrument) is binary 0/1. Failure modes: Extreme propensity scores (~ 0 or 1) -> Trim sample to 0.05 < e(x) < 0.95 or use overlap weights (sp.overlap_weights); Nuisance models cross-val R2 near zero -> Nuisances not learnable -- DML bias guarantees don't apply; re-featurize or pick a different model family; Large Monte-Carlo variance across folds (n_rep > 1) -> Increase n_rep to 10+ and aggregate by median; check for leakage.... |
| dml_diagnosticsA | Build a :class: |
| dml_model_averagingA | Model-averaging DML (PLR) per Ahrens et al. (2025, JAE). Fits DML-PLR under multiple candidate nuisance learners and reports a risk-weighted (or equal/single-best) average of their theta estimates with a covariance-adjusted SE. Assumptions: Unconfoundedness (IRM/PLR) or instrument validity (IIVM/PLIV) given the covariates; Overlap / positivity; Neyman-orthogonal score plus cross-fitting; nuisance estimators converge fast enough (o(n^-1/4)). Pre-conditions: Covariates, treatment, and outcome with enough data for cross-fitted machine-learning nuisances; For instrumented variants (PLIV / IIVM): an instrument as well. Failure modes: Propensity scores near 0/1 -- overlap failure inflates variance and bias -> Trim extreme scores, restrict the estimand to the overlap region, or report sensitivity (dml_sensitivity). Alternatives: sp.tmle, sp.auto_cate, sp.causal_forest. Typical minimum N: 500. |
| dml_panelA | Long-panel Double/Debiased ML for static panel models with fixed effects (Clarke & Polselli 2025, simplified). Absorbs unit (and optional time) fixed effects via within-transform, cross-fits ML nuisance learners with folds that split units, and reports cluster-robust SE at the unit level. PLR moment (continuous or binary treatment). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Conditional unconfoundedness within unit: E[epsilon_it | X_it, alpha_i, lambda_t] = 0; Strict exogeneity conditional on covariates (weaker than standard FE); Nuisance learners converge fast enough (op(n^{-1/4})) after within-transform. Pre-conditions: long panel: at least unit and outcome columns; include_time_fe=True needs time column; enough units (clusters) for cluster-robust SE -- >= 30 ideally; enough periods per unit for within-transform to leave variation in the treatment. Failure modes: Few units (< 30) -- cluster-robust SE under-coverage -> Use wild cluster bootstrap (sp.wild_cluster_bootstrap) or CR3 jackknife; Within-unit variation in treatment is near zero -> Unit FE absorbs almost all treatment variation -- switch to between... |
| dml_sensitivityA | Compute DML-OVB sensitivity for a fitted DML CausalResult. Validation: certified parity evidence. Assumptions: Unconfoundedness (IRM/PLR) or instrument validity (IIVM/PLIV) given the covariates; Overlap / positivity; Neyman-orthogonal score plus cross-fitting; nuisance estimators converge fast enough (o(n^-1/4)). Pre-conditions: Covariates, treatment, and outcome with enough data for cross-fitted machine-learning nuisances; For instrumented variants (PLIV / IIVM): an instrument as well. Failure modes: Propensity scores near 0/1 -- overlap failure inflates variance and bias -> Trim extreme scores, restrict the estimand to the overlap region, or report sensitivity (dml_sensitivity). Alternatives: sp.tmle, sp.auto_cate, sp.causal_forest. Typical minimum N: 500. |
| dose_responseA | Dose-response function for a continuous treatment under unconfoundedness. Uses generalised propensity-score weighting or double ML for the conditional expectation E[Y(d)]. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Weak unconfoundedness: Y(d) perp D | X for each d; Generalised overlap: positive conditional density of D at each evaluated dose; Smoothness of dose-response function (for local-polynomial / kernel smoothing). Pre-conditions: treat is continuous (numeric, not binary); covariates comprise the confounding set; n >= 1000 for stable dose-response curves. Failure modes: Sparse data at extreme doses -> Narrow dose_range; CIs at tails will be wide and uninformative; Heavy-tailed generalised propensity weights -> Use stabilised weights or restrict to common-support dose window. Alternatives: sp.dml, sp.metalearner, sp.causal_forest. Typical minimum N: 1000. |
| double_negative_controlA | Double negative control estimator (Miao et al. 2018; Shi et al. 2020). Assumptions: Two valid proxies of the hidden confounder U: a treatment-confounding proxy and an outcome-confounding proxy; Negative-control exposure has no causal effect on Y given (U, X) -- exclusion restriction on the NCE arm; Negative-control outcome is not caused by the treatment D given (U, X). Pre-conditions: data has columns for outcome, treatment, a negative-control exposure (nce) and a negative-control outcome (nco); nce and nco share the unmeasured confounder but satisfy the respective exclusion restrictions. Failure modes: Weak proxy: NCE barely correlated with NCO (weak-instrument analogue) -- unstable ATE -> Use stronger proxies or the doubly-robust regression-based estimator instead of just-identified 2SLS; A proxy violates its exclusion restriction (direct effect on Y or caused by D) -- biased ATE -> Validate the negative controls separately or fall back to a sensitivity analysis. Alternatives: sp.proximal, sp.proximal_regression, sp.frontdoor. Typical minimum N: 200. |
| doubly_robustA | Doubly-robust OPE (Dudik et al. 2011). Assumptions: Doubly robust: consistent if EITHER the outcome (Q) model OR the logging propensity model is correctly specified; Positivity / common support holds; No unmeasured confounding in the logged data. Pre-conditions: X, A, R, logging propensities and a fitted Q-model (or its predictions) are available. Failure modes: Both nuisance models misspecified -- DR guarantee is lost and the estimate is biased -> Cross-fit the nuisances or validate the Q-model and propensity fit separately. Alternatives: sp.ips, sp.snips, sp.direct_method. Typical minimum N: 500. |
| drdidA | Doubly-robust DiD (Sant'Anna & Zhao 2020). Combines outcome regression with IPW; consistent if either model is correct. Primary estimator for 2x2 DiD with covariates. Validation: certified parity evidence. Assumptions: Conditional parallel trends given X; Overlap / positivity: 0 < P(D=1|X) < 1; Correct specification of at least one nuisance model. Pre-conditions: panel or repeated cross-section with 2 periods; group is a binary unit-level treatment indicator; covariates have non-zero variance and overlap. Failure modes: Propensity score near 0/1 (overlap violation) -> Trim extreme propensity scores or use sp.ipw_trim. Alternatives: sp.did_2x2, sp.callaway_santanna, sp.wooldridge_did. Typical minimum N: 100. |
| ebalanceB | Hainmueller (2012) entropy balancing. Targets the ATT by exactly balancing covariate means across treatment groups. No propensity-score model specification needed. Validation: certified parity evidence. |
| effective_f_testC | Olea-Pflueger (2013) robust effective F statistic for weak instruments. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| engle_grangerC | Engle-Granger (1987) two-step cointegration test. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| enhanced_event_study_plotB | Enhanced event study plot with pre/post shading and significance coloring. |
| estatC | Unified post-estimation diagnostics dispatcher. |
| etableA | Display a pyfixest-style regression table for StatsPAI results. |
| etregressC | Endogenous treatment effects model. Validation: certified parity evidence. |
| etwfeA | Extended Two-Way Fixed Effects (Wooldridge 2021). Explicit API mirroring the R etwfe package. The headline reports the treated-observation-weighted simple ATT from etwfe::emfx(type='simple') / Stata jwdid, with cgroup selecting not-yet-treated or never-treated controls. family='poisson'/'logit' switches to Wooldridge (2023) nonlinear ETWFE for count / binary outcomes, reporting the average marginal effect on the response scale. Validation: certified evidence with scoped limitations. Known limitations: cgroup='nevertreated' combined with panel=False (repeated cross-sections) is not yet supported; pass either panel=True with cgroup='nevertreated' or panel=False with cgroup='notyet'; family='poisson'/'logit' with xvar, panel=False, or cgroup='nevertreated' is not yet supported; these raise rather than being silently ignored; family='poisson'/'logit' reports an average marginal effect on the response scale (counts / probability) rather than a link-scale coefficient -- the R etwfe::emfx convention; cgroup='nevertreated' combined with panel=False (repeated cross-sections) is not yet supported. Use panel=True with cgroup='nevertreated' or panel=False with cgroup='notyet'. Do NOT use when... |
| etwfe_emfxA | R |
| evalueA | Compute the E-value for sensitivity to unmeasured confounding. Validation: certified parity evidence. Assumptions: VanderWeele-Ding (2017) E-value: quantifies the minimum confounder-exposure and confounder-outcome risk ratios that could explain away an observed association; The estimate is expressed (or convertible) to a risk-ratio scale; OR and HR map to RR via the rare-outcome approximation (rare=True) or the Ding-VanderWeele common-outcome conversion (rare=False, default); MD/SMD/OLS use exp(0.91*d); The E-value bounds joint confounding but assumes no other bias (selection, measurement, model misspecification). Pre-conditions: A point estimate on a supported scale (RR/OR/HR/MD/SMD/OLS); for an exact risk-difference E-value call sp.evalue_rd with the 2x2 cell counts; Either an SE or an explicit CI to obtain the CI E-value (OLS also needs the outcome sd). Failure modes: Ratio estimate <= 0 supplied for measure RR/OR/HR, or risk difference outside [-1, 1] -> Pass a positive ratio for RR/OR/HR or a difference within [-1, 1], matching the measure argument; Reported E-value near 1.0, i.e. trivially weak confounding overturns the result -> Treat the finding as fragile to unmeasured co... |
| evalue_from_resultB | Compute an E-value from a StatsPAI CausalResult object. |
| evalue_rdB | Exact E-value for a risk difference from a 2x2 table. |
| evalue_rrC | E-value computed directly from a risk ratio and its CI bounds. Validation: certified parity evidence. |
| event_studyA | Traditional OLS event-study with entity and time FEs. Generates relative-time dummies around the treatment date, omits a reference period, and estimates via TWFE + optional clustered SE. Exposed for users who want the classical specification alongside CS / SA / BJS; not robust to staggered-effect heterogeneity -- use sp.sun_abraham for that. Validation: certified parity evidence. Do NOT use when: only one pre-treatment period is available -- there are no leads to test parallel trends with, so the plot cannot support a pre-trend claim; treatment timing is staggered and heterogeneous -- a pooled TWFE event study contaminates leads with other cohorts' treated periods; use sp.sun_abraham or sp.callaway_santanna. Assumptions: Parallel trends across event time; No anticipation beyond window lead; SUTVA. Pre-conditions: panel with unit x time x outcome; treat_time column gives first-treatment period (or 0/NaN). Failure modes: Staggered heterogeneity -- TWFE event-study biased -> Use sp.sun_abraham for contamination-robust event-study coefficients. Alternatives: sp.sun_abraham, sp.callaway_santanna, sp.did_imputation. Typical minimum N: 50. |
| event_study_conventionA | Report how each DiD estimator builds its event-study reference periods. Two implementations can agree on every post-treatment coefficient and still plot different pre-trends, because the leads are a separate construction (Roth 2026). Returns the convention registry: what each half of the path is differenced against, whether the two halves are symmetric, and whether the path coincides with a dynamic TWFE event study in a non-staggered design. Failure modes: Estimator name not in the convention registry -> Call sp.event_study_convention() with no argument to list the recorded estimators. Alternatives: sp.compare_event_study_conventions, sp.event_study. |
| event_study_tableB | Adapter that turns an event-study fit into a regtable input. |
| examplesC | Return runnable code examples + registry metadata for a function. |
| fairlieB | Fairlie (2005) nonlinear decomposition for binary outcomes. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| fciA | Run FCI. Returns a :class: |
| fectA | Counterfactual estimators for time-series cross-sectional data (Liu, Wang and Xu 2024): impute the untreated potential outcome of every treated unit-period from a model fitted on untreated cells only -- two-way fixed effects ('fe', the imputation estimator), interactive fixed effects with r factors ('ife'), or nuclear-norm matrix completion ('mc') -- and average Y - Y(0) over treated cells, with the ATT path by relative period. Native port of the R package fect; handles staggered adoption, many treated units, unbalanced panels and treatment reversals. Validation: certified evidence with scoped limitations. Known limitations: Inference is resampling-only (unit bootstrap or jackknife on request); the default returns point estimates only; r and lam are user-supplied; fect's cross-validated choice of r / lambda is not yet supported. Assumptions: Y(0) follows the chosen model (two-way FE / low-rank factors / low nuclear norm) on untreated cells; No anticipation and no carryover after treatment ends; Strict exogeneity of treatment status conditional on the fixed effects / factors. Pre-conditions: long panel with unit x time x outcome and a 0/1 treatment status; every retained unit has a... |
| feglmA | Estimate GLM (logit, probit, Gaussian) with high-dimensional fixed effects. Validation: certified parity evidence. |
| feolsA | Estimate OLS / IV with high-dimensional fixed effects via pyfixest. Validation: certified parity evidence. Do NOT use when: vce='conley' on more than ~20,000 rows -- that path is dense O(n^2) (see cost); use sp.conley on the fitted result, which is sparse and scales. Cost: Default (OLS / HC / CRV1) is linear in n. vce='conley' is the exception: it calls conley_vcov_matrix, which materialises several dense n x n float64 arrays (lat/lon differences, distances, the uniform kernel) -- ~0.8 GB at n=10,000, ~80 GB at n=100,000, ~157 GB at n=140,000. Prefer sp.conley (sparse cKDTree) above ~20,000 rows. Assumptions: Strict exogeneity conditional on the absorbed fixed effects; No perfect collinearity after FE absorption (within-transformation rank); Cluster structure for |
| fepoisA | Estimate Poisson regression with high-dimensional fixed effects via pyfixest. Validation: certified parity evidence. Assumptions: Conditional mean exponential link: E[y | x, alpha] = exp(x'beta + alpha); Strict exogeneity conditional on the absorbed fixed effects (PPML consistency). Pre-conditions: Outcome is a non-negative count or non-negative continuous variable; Fixed effects columns are categorical; absorbed groups exist. Failure modes: Convergence failure or extreme exponentiated predictions -> Drop large-magnitude regressors, rescale, or switch to OLS on log(1+y) (with caveats); Separation: some FE level perfectly predicts zero outcomes -> Drop perfectly-predicted groups and rerun; document the restriction. Alternatives: sp.feols, sp.regress, sp.panel. Typical minimum N: 200. |
| ffl_decomposeA | 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. |
| finegrayB | Fine & Gray (1999) proportional subdistribution hazards model. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| fisher_exactC | Fisher's exact randomization test with enhanced features. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| focal_cateA | Functional doubly-robust CATE estimator. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness given the covariates; Overlap / positivity across the covariate space; Nuisance functions are estimated consistently; cross-fitting controls overfitting bias. Pre-conditions: Covariates, a treatment indicator, and an outcome for each unit; Enough data to fit flexible nuisance models with sample-splitting / cross-fitting. Failure modes: CATE estimates are unstable or extrapolate beyond the covariate support -> Restrict to the overlap region, increase data, or use a doubly-robust learner (DR-/R-learner). Alternatives: sp.dml, sp.causal_forest, sp.tmle. Typical minimum N: 500. |
| forest_diagnosticsA | Return overlap and CATE-distribution diagnostics for a fitted forest. Assumptions: Unconfoundedness given the covariates; Overlap / positivity; Honesty: separate subsamples are used to choose splits and to estimate effects. Pre-conditions: Covariates, treatment, and outcome with enough data to grow an honest forest. Failure modes: Calibration test rejects -- the forest's heterogeneity is not well calibrated -> Increase the sample / number of trees, or fall back to a doubly-robust learner. Alternatives: sp.dml, sp.auto_cate, sp.tmle. Typical minimum N: 1000. |
| fortified_pciA | Fortified proximal causal inference (Yu, Shi & Tchetgen Tchetgen 2025). Adds a bridge-function stability constraint that gives robust ATT under mild misspecification of the outcome/treatment bridge. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: The proxies are valid negative controls (relevant to the confounder, excluded from the causal channel); A bridge function exists (completeness conditions hold). Pre-conditions: Treatment-inducing and outcome-inducing proxy variables (negative controls) for the unobserved confounder. Failure modes: Proxies are weak or invalid -- the bridge function is poorly identified -> Test proxy relevance, select stronger proxies, or fall back to sensitivity analysis. Alternatives: sp.select_pci_proxies, sp.dml. Typical minimum N: 500. |
| fracregC | Fractional response model (Papke & Wooldridge 1996). Validation: certified parity evidence. |
| from_rA | Translate a single R / fixest / felm / did expression to a verified StatsPAI tool-call payload. Returns the same shape as from_stata. Supported callables: feols / felm / lm / att_gt / did. Pass ONE expression -- no assignment, no piping. |
| from_stataA | Translate a single Stata command to a verified StatsPAI tool-call payload. Returns |
| front_doorA | Pearl's front-door adjustment: identifies ATE with unmeasured confounding when a mediator fully transmits the effect of D on Y. Supports binary or continuous mediator; integrate_by controls Pearl (marginal) vs Fulcher et al. (conditional) aggregation. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Sequential exchangeability / no unmeasured confounding at each time point; Positivity: every treatment level is possible given the past; Correct specification of the treatment and/or outcome models. Pre-conditions: Sequentially measured covariates, (time-varying) treatment, and outcome; Models for the treatment process and the outcome (or weights). Failure modes: Stabilized weights have extreme values (positivity near-violation) -> Truncate weights, simplify the treatment model, or use a doubly-robust estimator (TMLE). Alternatives: sp.tmle, sp.g_computation, sp.ipw. Typical minimum N: 300. |
| frontdoorC | Front-door adjustment -- article-friendly alias for Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| functional_form_testA | Roth & Sant'Anna (2023) test of whether parallel trends can hold for EVERY strictly monotonic transformation of the outcome. Bins the outcome, recovers the counterfactual probability mass the design implies for the treated group in each bin via Callaway-Sant'Anna, and tests the moment inequalities that mass must satisfy to be a density. Rejection means levels and logs are answering different questions, so the functional form is doing identifying work. Validation: certified evidence with scoped limitations. Known limitations: a large p-value is only a failure to reject, not evidence FOR functional-form insensitivity: the test has little power with few units or coarse bins; standard errors and the critical value are asymptotic; a bootstrap variant is not implemented. Assumptions: Callaway-Sant'Anna identification for each binned indicator; No anticipation before g - anticipation. Pre-conditions: staggered or single-cohort panel with never-treated or not-yet-treated controls; outcome with enough support to bin. Failure modes: Every bin has a degenerate influence function -> The binning is finer than the data support. Lower n_bins or supply binpoints; Test rejects -> Parallel trends c... |
| g_computationA | Parametric g-formula (standardization) estimator. ATE/ATT for binary D, or dose-response curve for continuous D. Consistent under correctly-specified outcome model; not doubly robust. Validation: certified parity evidence. Assumptions: Sequential exchangeability / no unmeasured confounding at each time point; Positivity: every treatment level is possible given the past; Correct specification of the treatment and/or outcome models. Pre-conditions: Sequentially measured covariates, (time-varying) treatment, and outcome; Models for the treatment process and the outcome (or weights). Failure modes: Stabilized weights have extreme values (positivity near-violation) -> Truncate weights, simplify the treatment model, or use a doubly-robust estimator (TMLE). Alternatives: sp.tmle, sp.g_computation, sp.ipw. Typical minimum N: 300. |
| g_estimationA | G-estimation for a multi-stage dynamic treatment regime. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Sequential exchangeability / no unmeasured confounding at each time point; Positivity: every treatment level is possible given the past; Correct specification of the treatment and/or outcome models. Pre-conditions: Sequentially measured covariates, (time-varying) treatment, and outcome; Models for the treatment process and the outcome (or weights). Failure modes: Stabilized weights have extreme values (positivity near-violation) -> Truncate weights, simplify the treatment model, or use a doubly-robust estimator (TMLE). Alternatives: sp.tmle, sp.g_computation, sp.ipw. Typical minimum N: 300. |
| gap_closingC | Counterfactual gap after equalising covariate distributions. Validation: certified parity evidence. |
| garchB | Fit GARCH(p,q) by conditional Gaussian MLE. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| gardner_didA | Gardner (2021) two-stage DID. Stage-1 fits two-way FEs on untreated observations; Stage-2 regresses the residualised outcome on treatment dummies (ATT or event study). Numerically close to Borusyak-Jaravel-Spiess imputation with unit-clustered SEs. Validation: certified parity evidence. Assumptions: Conditional parallel trends between treated and comparison groups absent treatment; No anticipation of treatment before its onset; Treatment effects may be heterogeneous across cohorts and time (no homogeneity required). Pre-conditions: Panel or repeated cross-section with a unit (or group) identifier and a time identifier; At least one never-treated or not-yet-treated comparison group; Pre-treatment periods to assess parallel trends. Failure modes: Pre-treatment event-study coefficients are jointly non-zero (pre-trend violation) -> Use honest DiD bounds to quantify robustness to trend violations, or condition on covariates; Two-way fixed-effects estimate is contaminated by 'forbidden' comparisons / negative weights -> Use a heterogeneity-robust estimator (Callaway-Sant'Anna, Borusyak et al., Gardner two-stage). Alternatives: sp.callaway_santanna, sp.did, sp.honest_did. Typical minimum... |
| gate_testA | Test for significant heterogeneity across GATE (Group ATE) groups. Assumptions: Unconfoundedness given the covariates; Overlap / positivity across the covariate space; Nuisance functions are estimated consistently; cross-fitting controls overfitting bias. Pre-conditions: Covariates, a treatment indicator, and an outcome for each unit; Enough data to fit flexible nuisance models with sample-splitting / cross-fitting. Failure modes: CATE estimates are unstable or extrapolate beyond the covariate support -> Restrict to the overlap region, increase data, or use a doubly-robust learner (DR-/R-learner). Alternatives: sp.dml, sp.causal_forest, sp.tmle. Typical minimum N: 500. |
| gelbachC | Gelbach (2016) decomposition of omitted variable bias. Validation: certified parity evidence. |
| general_bunchingA | High-order bunching design with bias correction. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: The counterfactual density would be smooth through the threshold absent the policy; Excess mass at the threshold reflects the behavioural elasticity of interest; No other discontinuity coincides with the threshold. Pre-conditions: A behavioural choice variable (earnings, hours, ...) with a known kink or notch in the budget/choice set; A visible empirical density of the running variable around the threshold. Failure modes: Round-number heaping or a coincident policy contaminates the bunching mass -> Exclude heaping points, widen the excluded region, and test the counterfactual polynomial order. Alternatives: sp.rdrobust, sp.rkd. Typical minimum N: 500. |
| genmatchA | Genetic Matching for ATT estimation. Validation: certified parity evidence. Cost: Genetic search: population_size x generations full matching + balance evaluations (default 40 x 20 = 800 matching passes), each of which builds a pairwise distance matrix. Budget it as hundreds of sp.match calls, not one. Assumptions: Unconfoundedness: treatment is as-good-as-random given the measured covariates; Overlap / common support: every unit has a non-degenerate probability of each treatment; The covariate set blocks all back-door paths. Pre-conditions: Pre-treatment covariates measured for treated and control units; A binary (or low-cardinality) treatment indicator; Sufficient covariate overlap between treatment arms. Failure modes: Poor overlap -- extreme propensity scores or few acceptable matches -> Trim or restrict to the common-support region and report the discarded units; Covariate imbalance remains after matching/weighting -> Re-specify the balancing model (CBPS, entropy balancing) and re-check standardized mean differences. Alternatives: sp.propensity_score, sp.cbps, sp.ebalance, sp.dml. Typical minimum N: 200. |
| geographic_rdA | User-friendly alias for :func: |
| german_reunificationC | German reunification dataset (simulated). |
| gesA | Greedy Equivalence Search. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Causal Markov condition and faithfulness (PC/GES/FCI); Causal sufficiency for PC/GES (no latent confounders); FCI relaxes this; Acyclicity; LiNGAM additionally assumes a linear non-Gaussian model. Pre-conditions: Constraint-/score-based discovery needs i.i.d. observational data with enough samples for reliable conditional-independence tests; Invariance-based discovery (ICP) needs data labelled by environment / intervention. Failure modes: Unstable skeleton / many undirected edges -- faithfulness or sample size is the likely culprit -> Increase the sample, relax the CI-test threshold, or switch to FCI if latent confounders are plausible. Alternatives: sp.pc_algorithm, sp.fci, sp.ges, sp.lingam. Typical minimum N: 500. |
| ggdidC | Plot an |
| glmC | Fit a Generalized Linear Model. Validation: certified parity evidence. |
| gmmB | General GMM estimator for arbitrary moment conditions. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| granger_causalityC | Granger causality test. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| group_time_plotA | Plot group-time ATT estimates from Callaway-Sant'Anna. |
| gsynthA | Generalized Synthetic Control via interactive fixed effects. Validation: certified parity evidence. Do NOT use when: there is only one treated unit and a short pre-period -- the interactive fixed-effects factors are not identified; use sp.synth; fewer pre-treatment periods than the number of factors being fit -- factor estimation is degenerate. Cost: Cross-validating n_factors refits the factor model cv_folds x max_factors times, and placebo/bootstrap inference refits again per replication -- runtime is multiplicative in those three knobs. Pin n_factors to skip the CV sweep. Assumptions: A convex (or regularized) combination of donor units reproduces the treated unit's pre-treatment outcome path; No interference: the treatment does not affect the donor units (SUTVA); No anticipation before the treatment date. Pre-conditions: Panel of one or more treated units plus an untreated donor pool, observed over time; Pre-treatment window long enough to fit donor weights (rule of thumb: more pre-periods than donors used); Outcome observed for every unit in every period. Failure modes: Large pre-treatment RMSPE -- the synthetic unit fails to track the treated unit before treatment -> Add don... |
| hal_tmleA | TMLE with Highly Adaptive Lasso (HAL) nuisance learners (Qian & van der Laan 2025). The stable 'delta' variant plugs HAL into standard TMLE. The reserved 'projection' variant raises NotImplementedError until the Riesz-projection targeting step has reference parity. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Known limitations: variant='projection' raises NotImplementedError -- the Riesz-projection targeting step from Li-Qiu-Wang-vdL (2025) Section 3.2 is not yet ported (the v1.11.x code path was a no-op on the point estimate; see CHANGELOG). The implementation roadmap and parity-test gates are in docs/rfc/hal_tmle_projection.md. Assumptions: Unconfoundedness (sequential exchangeability for longitudinal/LTMLE); Positivity / overlap of treatment given history; At least one nuisance (outcome or treatment) is estimated consistently; the targeting step gives double robustness. Pre-conditions: Covariates, treatment, and outcome (for survival/longitudinal variants: time-to-event and time-varying covariates); Enough data to fit a Super Learner / HAL nuisance library. Failure modes: Near-positivity violations create extreme clever... |
| harvest_didA | Harvest every valid 2x2 DID comparison from a staggered panel and aggregate them via precision-weighted / simple / cohort-weighted averages. Agnostic to cohort structure; useful for robustness comparisons against CS / SA / BJS. Assumptions: Parallel trends hold for every valid 2x2 sub-comparison being harvested and aggregated; No anticipation before each cohort's first treated period (reference horizon -1 is clean); Independence across units within each cohort (unit-level cluster-robust SEs); cross-horizon covariance ignored. Pre-conditions: Long-format panel with unit, time, outcome columns; Either a binary treat indicator or a precomputed cohort (first-treatment) column with a never_value marker; Multiple cohorts and overlapping periods so valid 2x2 comparisons exist across the requested horizons. Failure modes: No clean (never-treated or not-yet-treated) controls so no valid 2x2 cells can be harvested -> Add never-treated units or restrict horizons to periods with available clean controls; Precision weighting dominated by one tiny high-variance comparison distorts the aggregate -> Switch weighting to 'equal' or 'n_treated' to down-weight unstable cells. Alternatives: sp.callawa... |
| hausman_testB | Hausman test for FE vs RE in panel data. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| hdfe_olsA | reghdfe-style OLS with high-dimensional fixed effects. Validation: certified parity evidence. Do NOT use when: vce='conley' on more than ~20,000 rows -- dense O(n^2) memory (see cost); use sp.conley on the fitted result instead. Cost: Absorption is linear in n. vce='conley' is the exception: the within-transformed design goes through conley_vcov_matrix, which builds dense n x n distance and kernel matrices -- ~80 GB at n=100,000. vce='cr2'/'cr3' are per-cluster and cheap by comparison. Assumptions: Linear conditional mean after absorbing high-dimensional fixed effects (Frisch-Waugh-Lovell); Exogeneity of regressors conditional on the absorbed fixed-effect dimensions; Clustered SEs require enough clusters for asymptotics; multiway cluster needs each dimension well-populated. Pre-conditions: Continuous outcome; Fixed-effect factor variable(s) in the '| fe1 + fe2' part of the formula. Failure modes: Singleton groups absorb their own observations and bias clustered SEs -> Keep drop_singletons=True so singletons are removed before estimation; Alternating-projections absorber does not converge -> Raise maxiter / loosen tol, or reduce the number of FE dimensions; Too few clusters make wi... |
| heckmanA | Heckman two-step selection model correcting for sample selection bias. Validation: certified parity evidence. |
| het_testC | Breusch-Pagan test for heteroskedasticity. Validation: certified parity evidence. |
| holmC | Holm (1979) step-down correction. Validation: certified parity evidence. |
| honest_didA | Rambachan-Roth (2023) 'honest' DID sensitivity analysis. Operates on a fitted event-study / DID result: pass |
| honest_did_from_resultA | Rambachan-Roth (2023) honest CIs on a fitted DID / event-study result. Auto-extracts betas + sigma + pre/post-period counts from the result; the LLM never ferries arrays. |
| honest_varianceA | Half-sample bootstrap variance of the ATE/GATE estimate. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness given the covariates; Overlap / positivity; Honesty: separate subsamples are used to choose splits and to estimate effects. Pre-conditions: Covariates, treatment, and outcome with enough data to grow an honest forest. Failure modes: Calibration test rejects -- the forest's heterogeneity is not well calibrated -> Increase the sample / number of trees, or fall back to a doubly-robust learner. Alternatives: sp.dml, sp.auto_cate, sp.tmle. Typical minimum N: 1000. |
| horowitz_manskiA | Horowitz-Manski (2000) bounds conditioning on covariates. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Only weak (set-identifying) assumptions are imposed; the result is an interval, not a point; Lee bounds add monotonicity of selection; Oster's delta adds proportional selection on observed vs. unobserved. Pre-conditions: The data needed for the point-identifying analysis, plus the weakest credible identifying restriction; For Lee bounds: a binary selection/attrition indicator. Failure modes: Bounds are too wide to be informative -> Add a credible auxiliary restriction (monotone treatment response, instrument) to tighten the bounds. Alternatives: sp.oster_delta, sp.lee_bounds, sp.manski_bounds. Typical minimum N: 100. |
| hurdleB | Hurdle (two-part) model for count data. Validation: certified parity evidence. |
| iccB | Intra-class correlation for a fitted mixed model. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| impactplotA | Causal Impact visualization (Google-style 3-panel plot). |
| inequality_indexB | Compute a single inequality index. Validation: certified parity evidence. |
| influence_functionsA | Export the per-unit influence functions of a Callaway-Sant'Anna fit as a tidy, self-contained DataFrame (optionally written to disk) -- the StatsPAI equivalent of Stata csdid saverif(). Feed the export to sp.aggte_from_influence for post-hoc custom aggregation without refitting or re-loading the data. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Pre-conditions: result was produced by sp.callaway_santanna. Failure modes: result carries no influence functions -> Fit with sp.callaway_santanna first; other estimators do not store the (g,t) influence-function grid. Alternatives: sp.aggte, sp.aggte_from_influence. Typical minimum N: 50. |
| interactive_feC | Interactive fixed effects estimator (Bai 2009). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| interferenceA | Unified interference / spillover dispatcher. design= selects the estimator: 'partial' (Hudgens-Halloran cluster) / 'network_exposure' (Aronow-Samii HT) / 'peer_effects' (Manski / Bramoulle linear-in-means) / 'network_hte' (Wu & Yuan 2025 orthogonal, arXiv:2509.18484) / 'inward_outward' (directed network; Fang, Airoldi & Forastiere 2025, arXiv:2506.06615) / 'cluster_matched_pair' (Bai 2022) / 'cluster_cross' (Ding et al. 2025) / 'cluster_staggered' (Zhou et al. 2025) / 'dnc_gnn' (Zhao et al. 2026). Kwargs pass through to the target function; see sp.interference_family guide. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Partial interference (within-cluster spillover only) OR an explicit exposure mapping; SUTVA modulo the declared spillover structure; Correctly specified exposure function (e.g. fraction-treated, neighbour-share). Pre-conditions: clustered data OR network / adjacency matrix; treatment varies within cluster (or exposure is well-defined on the network); enough clusters (>= 30) for cluster-robust inference. Failure modes: Few clusters (< 30) with cluster-level inference -> Use wild cluster bootstrap... |
| interflexA | Conditional marginal effects of |
| interflex_plotC | The interflex figure: marginal effect of |
| interpret_resultA | Natural-language interpretation of a fitted result. When the connected MCP client advertised sampling, this REUSES the agent's own model (no API key) to explain the estimate, its uncertainty, and what the design does / does not identify -- optionally focused by a |
| ipsA | Inverse propensity score OPE. Assumptions: Logging (behaviour) policy propensities are known or correctly estimated; Positivity / common support: the logging policy assigns positive probability to every action the target policy takes; No unmeasured confounding in the logged data. Pre-conditions: X (context), A (logged action), R (reward) and logging propensities are available. Failure modes: High-variance estimate from extreme importance weights when the target policy diverges from logging -> Use self-normalised IPS (snips) or the doubly-robust estimator to reduce variance. Alternatives: sp.snips, sp.doubly_robust, sp.direct_method. Typical minimum N: 500. |
| ipwA | Inverse Probability Weighting for ATE/ATT/ATC with propensity score trimming. Validation: certified parity evidence. Assumptions: Sequential exchangeability / no unmeasured confounding at each time point; Positivity: every treatment level is possible given the past; Correct specification of the treatment and/or outcome models. Pre-conditions: Sequentially measured covariates, (time-varying) treatment, and outcome; Models for the treatment process and the outcome (or weights). Failure modes: Stabilized weights have extreme values (positivity near-violation) -> Truncate weights, simplify the treatment model, or use a doubly-robust estimator (TMLE). Alternatives: sp.tmle, sp.g_computation, sp.ipw. Typical minimum N: 300. |
| irfB | Compute impulse response functions from VAR. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| itsC | Segmented regression for interrupted time series. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| ivA | Unified IV estimation and the entry point for the whole IV family: k-class (2SLS, LIML, Fuller, GMM, JIVE) plus the many-weak-instrument jackknife variants (jive1, ujive, ijive, rjive, jive_mw), rigorous/post-Lasso instrument selection (lasso, rlasso, post_lasso), marginal treatment effects (mte) and their MST sharp bounds (ivmte_bounds), plausibly-exogenous sensitivity (plausibly_exog_ltz / plausibly_exog_uci), nonparametric and ML variants (npiv, kernel, ivdml, deepiv), quantile IV (ivqreg), Bayesian IV (bayes), continuous-instrument LATE (continuous_late), many-weak-IV Anderson-Rubin (many_weak_ar) and shift-share (shift_share). Includes first-stage F, Sargan/Hansen J, Kleibergen-Paap rk, Sanderson-Windmeijer per-endog F and Hausman diagnostics. Validation: certified parity evidence. Assumptions: Relevance: instruments predict the endogenous regressor (first-stage F >= 10 rule of thumb); Exclusion: instruments affect outcome only through the endogenous regressor; Monotonicity (for LATE interpretation under heterogeneous effects). Pre-conditions: formula includes the (endog ~ instruments) parenthesised block; at least as many instruments as endogenous regressors (order condition... |
| iv_boundsA | Nevo-Rosen (2012) bounds for LATE under imperfect instruments. Assumptions: Only weak (set-identifying) assumptions are imposed; the result is an interval, not a point; Lee bounds add monotonicity of selection; Oster's delta adds proportional selection on observed vs. unobserved. Pre-conditions: The data needed for the point-identifying analysis, plus the weakest credible identifying restriction; For Lee bounds: a binary selection/attrition indicator. Failure modes: Bounds are too wide to be informative -> Add a credible auxiliary restriction (monotone treatment response, instrument) to tighten the bounds. Alternatives: sp.oster_delta, sp.lee_bounds, sp.manski_bounds. Typical minimum N: 100. |
| iv_compareA | Run several k-class / JIVE estimators on the same IV specification and return a one-row-per-method comparison DataFrame (estimate, SE, CI, first-stage F). Useful as a sensitivity sanity check before reporting. Assumptions: Instrument relevance (non-zero first stage); Exclusion restriction: the instrument affects the outcome only through the treatment; Independence/exogeneity of the instrument; for LATE, monotonicity (no defiers). Pre-conditions: An instrument plausibly affecting treatment, an endogenous treatment, and an outcome; A strong first stage (assess instrument strength before interpreting estimates). Failure modes: Weak first stage -- biased point estimates and unreliable conventional SEs -> Report first-stage F / effective F and use weak-IV-robust inference (Anderson-Rubin). Alternatives: sp.iv, sp.anderson_rubin_ci, sp.dml. Typical minimum N: 200. |
| iv_diagA | Modern IV reporting bundle (R |
| ivqregC | Instrumental-variable quantile regression (Chernozhukov-Hansen). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| ivregA | 2SLS instrumental-variables regression with robust or clustered SEs and first-stage F diagnostics. Formula syntax: 'y ~ x_exog + (d_endog ~ z_instrument)'. Validation: certified parity evidence. |
| jackknife_seB | Leave-one-cluster-out jackknife standard errors. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| jiveC | Jackknife Instrumental Variables Estimation (JIVE). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| johansenB | Johansen (1991) cointegration test. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| kan_dlateA | Deprecated alias for :func: |
| kaplan_meierB | Kaplan-Meier non-parametric survival function estimator. Validation: certified parity evidence. |
| kernel_ivA | Kernel IV regression with uniform confidence bands (Lob et al. 2025). Estimates the structural function h*(d) = E[Y | do(D=d)] via kernel-weighted local averaging under a continuous instrument Z, with wild-bootstrap uniform SEs. Assumptions: Instrument relevance (non-zero first stage); Exclusion restriction: the instrument affects the outcome only through the treatment; Independence/exogeneity of the instrument; for LATE, monotonicity (no defiers). Pre-conditions: An instrument plausibly affecting treatment, an endogenous treatment, and an outcome; A strong first stage (assess instrument strength before interpreting estimates); formula includes the (endog ~ instruments) parenthesised block. Failure modes: Weak first stage -- biased point estimates and unreliable conventional SEs -> Report first-stage F / effective F and use weak-IV-robust inference (Anderson-Rubin); First-stage F < 10 (Stock-Yogo 5% bias) -> Use weak-IV-robust inference (Anderson-Rubin) or LIML; Over-identification test rejects (sp.estat 'overid') -> At least one instrument is invalid; drop instruments or switch to just-identified LIML. Alternatives: sp.iv, sp.anderson_rubin_ci, sp.dml, sp.deepiv. Typical minimum... |
| kink_unifiedA | Run RDD + RKD + Bunching on the same data. Assumptions: The counterfactual density would be smooth through the threshold absent the policy; Excess mass at the threshold reflects the behavioural elasticity of interest; No other discontinuity coincides with the threshold. Pre-conditions: A behavioural choice variable (earnings, hours, ...) with a known kink or notch in the budget/choice set; A visible empirical density of the running variable around the threshold. Failure modes: Round-number heaping or a coincident policy contaminates the bunching mass -> Exclude heaping points, widen the excluded region, and test the counterfactual polynomial order. Alternatives: sp.rdrobust, sp.rkd. Typical minimum N: 500. |
| kitagawa_decomposeB | Kitagawa (1955) two-factor rate decomposition. Validation: certified parity evidence. |
| kitagawa_testC | Kitagawa (2015) specification test for the validity of LATE. |
| lasso_ivA | LASSO-selected instrumental variables. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Relevance: instruments predict the endogenous regressor (first-stage F >= 10 rule of thumb); Exclusion: instruments affect outcome only through the endogenous regressor; Monotonicity (for LATE interpretation under heterogeneous effects). Pre-conditions: formula includes the (endog ~ instruments) parenthesised block; at least as many instruments as endogenous regressors (order condition); instruments are not themselves endogenous in the outcome equation. Failure modes: First-stage F < 10 (Stock-Yogo 5% bias) -> Use weak-IV-robust inference (Anderson-Rubin) or LIML; Over-identification test rejects (sp.estat 'overid') -> At least one instrument is invalid; drop instruments or switch to just-identified LIML; Hausman endogeneity test fails to reject -> OLS may be consistent and more efficient; report both. Alternatives: sp.deepiv, sp.bartik, sp.proximal, sp.regress. Typical minimum N: 100. |
| lasso_selectB | LASSO-based variable selection. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| lee_boundsA | Compute Lee (2009) bounds for ATE under sample selection. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Only weak (set-identifying) assumptions are imposed; the result is an interval, not a point; Lee bounds add monotonicity of selection; Oster's delta adds proportional selection on observed vs. unobserved. Pre-conditions: The data needed for the point-identifying analysis, plus the weakest credible identifying restriction; For Lee bounds: a binary selection/attrition indicator. Failure modes: Bounds are too wide to be informative -> Add a credible auxiliary restriction (monotone treatment response, instrument) to tighten the bounds. Alternatives: sp.oster_delta, sp.lee_bounds, sp.manski_bounds. Typical minimum N: 100. |
| limlA | Limited Information Maximum Likelihood (LIML) estimator. Validation: certified parity evidence. Assumptions: Relevance: instruments predict the endogenous regressor (first-stage F >= 10 rule of thumb); Exclusion: instruments affect outcome only through the endogenous regressor; Monotonicity (for LATE interpretation under heterogeneous effects). Pre-conditions: formula includes the (endog ~ instruments) parenthesised block; at least as many instruments as endogenous regressors (order condition); instruments are not themselves endogenous in the outcome equation. Failure modes: First-stage F < 10 (Stock-Yogo 5% bias) -> Use weak-IV-robust inference (Anderson-Rubin) or LIML; Over-identification test rejects (sp.estat 'overid') -> At least one instrument is invalid; drop instruments or switch to just-identified LIML; Hausman endogeneity test fails to reject -> OLS may be consistent and more efficient; report both. Alternatives: sp.deepiv, sp.bartik, sp.proximal, sp.regress. Typical minimum N: 100. |
| lincomB | Estimate a linear combination of coefficients with inference. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| lingamA | Fit DirectLiNGAM (Shimizu 2011). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Causal Markov condition and faithfulness (PC/GES/FCI); Causal sufficiency for PC/GES (no latent confounders); FCI relaxes this; Acyclicity; LiNGAM additionally assumes a linear non-Gaussian model. Pre-conditions: Constraint-/score-based discovery needs i.i.d. observational data with enough samples for reliable conditional-independence tests; Invariance-based discovery (ICP) needs data labelled by environment / intervention. Failure modes: Unstable skeleton / many undirected edges -- faithfulness or sample size is the likely culprit -> Increase the sample, relax the CI-test threshold, or switch to FCI if latent confounders are plausible. Alternatives: sp.pc_algorithm, sp.fci, sp.ges, sp.lingam. Typical minimum N: 500. |
| list_replicationsB | List all available replication datasets and guides. |
| llm_dag_proposeA | Propose a candidate DAG from variable names + domain description. Assumptions: LLM-proposed graphs / priors are hypotheses to validate, not statistical identification; Human review or data-driven falsification is required before any causal claim. Pre-conditions: Domain context and a bounded list of candidate variables; A configured, logged LLM provider for reproducibility. Failure modes: Proposals are unstable across runs or include hallucinated variables/edges -> Fix the model release and seed, add constraints, and cross-check with constraint-based discovery. Alternatives: sp.llm_dag_constrained, sp.causal_discovery, sp.dag. Typical minimum N: 1. |
| llm_sensitivity_priorsA | Propose sensitivity-analysis priors for the substantive setting. Assumptions: LLM-proposed graphs / priors are hypotheses to validate, not statistical identification; Human review or data-driven falsification is required before any causal claim. Pre-conditions: Domain context and a bounded list of candidate variables; A configured, logged LLM provider for reproducibility. Failure modes: Proposals are unstable across runs or include hallucinated variables/edges -> Fix the model release and seed, add constraints, and cross-check with constraint-based discovery. Alternatives: sp.llm_dag_constrained, sp.causal_discovery, sp.dag. Typical minimum N: 1. |
| llm_unobserved_confoundersA | Enumerate plausible unobserved confounders for a study. Assumptions: LLM-proposed graphs / priors are hypotheses to validate, not statistical identification; Human review or data-driven falsification is required before any causal claim. Pre-conditions: Domain context and a bounded list of candidate variables; A configured, logged LLM provider for reproducibility. Failure modes: Proposals are unstable across runs or include hallucinated variables/edges -> Fix the model release and seed, add constraints, and cross-check with constraint-based discovery. Alternatives: sp.llm_dag_constrained, sp.causal_discovery, sp.dag. Typical minimum N: 1. |
| local_projectionsA | Estimate impulse responses via Jorda (2005) local projections. Validation: certified parity evidence. Assumptions: Outcome and shock series are (covariance-)stationary so horizon-h projections are not spurious; Shock is conditionally exogenous at t given controls and the auto-added lags (no contemporaneous feedback from y_t to shock_t); Newey-West truncation lag is adequate for the moving-average serial correlation induced by overlapping horizons. Pre-conditions: Single time-ordered series in a DataFrame with the outcome and shock columns; For identification='lpirfs_cholesky', endog_order contains the outcome and shock columns in the intended Cholesky ordering; Length comfortably exceeds horizons + max lag so the deepest horizon regression retains enough usable rows. Failure modes: Confidence bands explode or flip sign at long horizons after passing already-lagged controls together with auto_lag=True -> Set auto_lag=False for a bare specification, or drop your manual lags so collinear duplicate-lag columns are not formed; The horizon-0 response is zero when the shock is ordered after the response variable -> Use the intended endog_order, or switch back to identification='direct' i... |
| logitC | Logit (logistic) regression via maximum likelihood. Validation: certified parity evidence. |
| logrank_testB | Log-rank test for equality of survival distributions across groups. Validation: certified parity evidence. |
| love_plotB | Love plot: dot plot of standardized mean differences before/after. |
| lp_didA | Local-Projections DiD (Dube-Girardi-Jorda-Taylor 2023). At each event-time horizon h in {-P, ..., H}, runs a separate OLS of Y_{t+h} - Y_{t-1} on the treatment change Deltad_{t} with time FE and cluster-robust SE, using 'not-yet-treated' or 'never-treated' units as controls. Event-study beta_h paths are returned in |
| lrtestB | Likelihood-ratio test comparing a restricted and a full model. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| ltmleA | Longitudinal TMLE for static regime contrasts. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Sequential exchangeability (no unmeasured time-varying confounding) at every treatment time point; Positivity at each time point conditional on the past; Correctly specified outcome (Q) and treatment (g) models, though TMLE is doubly robust to one of them. Pre-conditions: Long-format data with time-varying treatment, confounders and the static regime contrast of interest. Failure modes: Near-positivity violation: estimated treatment probabilities approach 0 or 1, inflating variance -> Bound (truncate) the cumulative weights or use a marginal structural model with stabilised weights. Alternatives: sp.tmle, sp.g_computation, sp.msm. Typical minimum N: 500. |
| ltmle_survivalA | LTMLE for a discrete-time survival outcome under dynamic regimes. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness (sequential exchangeability for longitudinal/LTMLE); Positivity / overlap of treatment given history; At least one nuisance (outcome or treatment) is estimated consistently; the targeting step gives double robustness. Pre-conditions: Covariates, treatment, and outcome (for survival/longitudinal variants: time-to-event and time-varying covariates); Enough data to fit a Super Learner / HAL nuisance library. Failure modes: Near-positivity violations create extreme clever-covariate weights -> Truncate weights, restrict the estimand, or report a positivity diagnostic. Alternatives: sp.dml, sp.ipw, sp.g_computation. Typical minimum N: 400. |
| machado_mataC | Machado-Mata (2005) quantile decomposition. |
| manski_boundsA | Compute Manski (1990) worst-case bounds on ATE. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Only weak (set-identifying) assumptions are imposed; the result is an interval, not a point; Lee bounds add monotonicity of selection; Oster's delta adds proportional selection on observed vs. unobserved. Pre-conditions: The data needed for the point-identifying analysis, plus the weakest credible identifying restriction; For Lee bounds: a binary selection/attrition indicator. Failure modes: Bounds are too wide to be informative -> Add a credible auxiliary restriction (monotone treatment response, instrument) to tighten the bounds. Alternatives: sp.oster_delta, sp.lee_bounds, sp.manski_bounds. Typical minimum N: 100. |
| marginsB | Compute marginal effects from a fitted model. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| margins_atA | Compute predictive margins at specific covariate values. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| margins_at_plotA | Plot predictive margins from |
| margins_tableC | Marginal-effects result that pipes straight into |
| marginsplotB | Plot marginal effects with confidence intervals. |
| matchA | Propensity score and covariate matching for treatment effect estimation. Validation: certified evidence with scoped limitations. Known limitations: greedy nearest-neighbour matching without replacement is order-dependent: the m_order convention can differ across packages and materially moves the estimate (>5x spread on MatchIt::lalonde with Mahalanobis distance). m_order='data' and 'closest' reproduce MatchIt exactly; m_order='farthest' is StatsPAI's own dynamic rule and is not MatchIt-equivalent; bias_correction=True follows a different convention from Matching::Match's BiasAdjust: StatsPAI regresses on the full covariate vector with unweighted OLS over all controls, the reference regresses on the matching variables weighted by match counts, so bias-corrected estimates can differ from it by about 0.1%. The uncorrected estimate and its Abadie-Imbens standard error are exact. Cost: Builds the dense n_treated x n_control distance matrix via scipy cdist before selecting neighbours: memory is O(n_treated x n_control). Comfortable into the thousands per arm; use a caliper or coarser blocking beyond that. Assumptions: Unconfoundedness / CIA: Y(d) perp D | X; Overlap / common support: tr... |
| matrix_completionC | Matrix-completion causal panel estimator (Athey et al., 2021). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| mc_panelA | Estimate treatment effects using matrix completion. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Do NOT use when: the panel is nearly fully treated -- matrix completion needs a substantial observed-control block to recover the low-rank structure. Cost: Iterative soft-impute: one SVD of the N x T outcome matrix per iteration, i.e. O(max_iter x N x T x min(N,T)). n_bootstrap multiplies the whole loop -- this is the dominant cost on wide panels. Assumptions: The relationship between the treated unit and controls is stable absent the intervention (causal_impact); Matrix-completion: the untreated potential outcomes follow a low-rank factor structure with treatment as the missingness pattern; No concurrent intervention affects the controls. Pre-conditions: A treated unit with a pre-period and a set of control series, or a panel with a low-rank structure. Failure modes: Pre-period fit is poor or controls are themselves affected by the intervention -> Re-select controls, lengthen the pre-period, or use synthetic-control / DiD diagnostics. Alternatives: sp.synth, sp.sdid, sp.gsynth. Typical minimum N: 50. |
| mc_synthA | Matrix Completion Synthetic Control Method. Assumptions: A convex (or regularized) combination of donor units reproduces the treated unit's pre-treatment outcome path; No interference: the treatment does not affect the donor units (SUTVA); No anticipation before the treatment date. Pre-conditions: Panel of one or more treated units plus an untreated donor pool, observed over time; Pre-treatment window long enough to fit donor weights (rule of thumb: more pre-periods than donors used); Outcome observed for every unit in every period. Failure modes: Large pre-treatment RMSPE -- the synthetic unit fails to track the treated unit before treatment -> Add donors / predictors, lengthen the pre-period, or use a bias-corrected estimator (sdid, augsynth); Placebo / permutation inference shows the estimate is not extreme relative to donors -> Report the placebo distribution honestly; the effect may not be distinguishable from noise. Alternatives: sp.sdid, sp.augsynth, sp.gsynth, sp.callaway_santanna. Typical minimum N: 15. |
| mccrary_testA | McCrary (2008) density test for manipulation of the running variable at the cutoff in regression-discontinuity designs. A significant discontinuity in the density of x at c is direct evidence that units are sorting around the cutoff (e.g. test-taking strategy, income manipulation), invalidating local randomisation. Assumptions: Smooth density of x at c under the null of no manipulation; Local-linear density estimator captures the shape near c. Pre-conditions: x is continuous with mass on both sides of c; no extreme heaping at c (rounded data invalidates the local-linear density estimate). Failure modes: Test rejects (p < alpha) -- manipulation evidence -> Switch to donut-hole RD (sp.rdrobust(donut=delta)) or partial-identification bounds (sp.rdrbounds); Heaped data near c (e.g. integer-rounded scores) -> The density-test statistic is unreliable on heaped data; consider Frandsen (2017) integer-RD adjustment. Alternatives: sp.rddensity, sp.rdrbounds. Typical minimum N: 200. |
| mediateA | Mediation analysis (Imai-Keele-Tingley 2010). Decomposes the total effect into natural direct effect (NDE) and natural indirect effect (NIE) via an interventional or sequential-ignorability identification strategy. Validation: certified parity evidence. Assumptions: Sequential ignorability: (Y(t,m), M(t)) perp T | X; Y(t,m) perp M | T, X; No post-treatment confounder of the mediator-outcome relationship (classical Imai-Keele-Tingley); SUTVA on both mediator and outcome. Pre-conditions: binary treatment 0/1; mediator is a post-treatment variable causally between treat and y; pre-treatment covariates capture confounding for T-Y, M-Y, T-M. Failure modes: NDE + NIE do not sum to total effect (difference vs product decomposition) -> Nonlinear / interactive mediator model -- use sp.mediate_interventional or four-way decomposition; Sensitivity to unobserved T-M / M-Y confounder unknown -> Always report sp.mediate_sensitivity (Imai-Keele-Yamamoto rho bound); Post-treatment confounder L suspected -> Use sp.four_way_decomposition (VanderWeele 2014) which handles L. Alternatives: sp.mediate_sensitivity, sp.mediate_interventional, sp.four_way_decomposition, sp.proximal. Typical minimum N: 500. |
| mediate_interventionalA | Interventional (in)direct effects (VanderWeele, Vansteelandt, Robins 2014). Identifies mediation effects in the presence of treatment-induced mediator-outcome confounders where natural (in)direct effects are not identified. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Sequential exchangeability / no unmeasured confounding at each time point; Positivity: every treatment level is possible given the past; Correct specification of the treatment and/or outcome models. Pre-conditions: Sequentially measured covariates, (time-varying) treatment, and outcome; Models for the treatment process and the outcome (or weights). Failure modes: Stabilized weights have extreme values (positivity near-violation) -> Truncate weights, simplify the treatment model, or use a doubly-robust estimator (TMLE). Alternatives: sp.tmle, sp.g_computation, sp.ipw. Typical minimum N: 300. |
| mediationC | Causal-mediation analysis -- article-facing alias for Validation: certified parity evidence. |
| mediation_decomposeC | Linear nested-models mediation decomposition (VanderWeele 2014 Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| megammaB | Random-effects Gamma GLMM with log link (Stata |
| meglmC | Fit a generalised linear mixed model. |
| melly_decomposeC | Melly (2005) quantile decomposition. |
| melogitA | Random-effects logistic regression (Stata |
| menbregB | Random-effects negative-binomial regression (Stata |
| meologitA | Random-effects ordinal logit (Stata |
| mepoissonA | Random-effects Poisson regression (Stata |
| meta_analysisB | Summary-data meta-analysis with fixed- and random-effects pooling. Validation: certified parity evidence. |
| metalearnerA | Meta-learner framework for CATE: S-, T-, X-, R-, DR-Learner. Validation: certified parity evidence. Assumptions: Unconfoundedness: Y(d) perp D | X; Overlap: 0 < P(D=1 | X) < 1; For R-Learner / DR-Learner: orthogonality between treatment residual and outcome residual. Pre-conditions: binary treatment (0/1); covariates numeric; categoricals encoded; enough treated AND control to train separate outcome models (T/X/DR-Learner). Failure modes: Large divergence across learner types -> Use sp.compare_metalearners to identify which learner is biased; DR-Learner is safest under model misspecification; S-Learner estimates near zero regardless of true effect -> S-Learner regularization smooths treatment coefficient toward zero; use T/X/DR instead; X-Learner fails when treated group is very small -> X-Learner needs well-identified control-outcome model; fall back to T-Learner or weighted T-Learner. Alternatives: sp.causal_forest, sp.dml, sp.tmle, sp.bcf. Typical minimum N: 500. |
| methods_appendixB | Generate a referee-grade Methods and Formulas appendix for results. |
| mincer_wage_panelC | Two-period Mincer wage distribution with a structural shift. |
| mixedA | Fit a linear mixed-effects model. Validation: certified parity evidence. Assumptions: Continuous outcome, linear in fixed effects; Random effects (intercepts/slopes) normally distributed with the chosen covariance structure; Residuals normal and homoscedastic conditional on random effects; random effects independent of covariates. Pre-conditions: Continuous outcome; Grouping variable (or nested list of grouping levels) for random effects. Failure modes: REML/ML optimizer fails to converge with rich random-slope covariance -> Switch cov_type to 'diagonal' or 'identity', or drop random slopes; Singular covariance (boundary variance estimate) -> Simplify the random-effects covariance or remove the offending random term; Binary or count outcome passed to a linear model -> Use a generalized mixed model for the appropriate family. Alternatives: sp.regress, sp.melogit, sp.feols. Typical minimum N: 200. |
| mixlogitC | Mixed Logit (random-coefficient MNL) via simulated maximum likelihood. |
| ml_boundsA | ML-enhanced partial-identification bounds on the ATE. Assumptions: Only weak (set-identifying) assumptions are imposed; the result is an interval, not a point; Lee bounds add monotonicity of selection; Oster's delta adds proportional selection on observed vs. unobserved. Pre-conditions: The data needed for the point-identifying analysis, plus the weakest credible identifying restriction; For Lee bounds: a binary selection/attrition indicator. Failure modes: Bounds are too wide to be informative -> Add a credible auxiliary restriction (monotone treatment response, instrument) to tighten the bounds. Alternatives: sp.oster_delta, sp.lee_bounds, sp.manski_bounds. Typical minimum N: 100. |
| mlogitB | Multinomial logit for J > 2 unordered categories via MLE. Validation: certified parity evidence. |
| model_averaging_dmlB | Model-averaging / stacking DML-PLR estimator. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| mrA | Unified Mendelian Randomization dispatcher. method= selects the estimator: 'ivw' / 'egger' / 'median' / 'penalized_median' / 'mode' / 'all' (runs IVW+Egger+Median together) / 'mvmr' / 'mediation' / 'bma' (multi-exposure) / 'presso' / 'radial' / 'leave_one_out' / 'steiger' / 'heterogeneity' / 'pleiotropy_egger' / 'f_statistic' (diagnostics). Kwargs are passed through to the target function unchanged; see sp.mendelian_family guide. Validation: certified parity evidence. Assumptions: Relevance: SNPs predict exposure (F-statistic >= 10 per SNP or set-F); Independence: SNPs perp confounders of exposure-outcome; Exclusion restriction: SNPs affect outcome only through exposure (InSIDE for Egger; >= 50% valid for median; modal for mode-based). Pre-conditions: SNP-summary statistics for exposure and outcome aligned by SNP; beta_exposure / beta_outcome / se_exposure / se_outcome arrays of equal length; >= 10 genetic instruments for reliable IVW/median/mode; >= 20 for robust Egger intercept. Failure modes: Egger intercept p < 0.05 -- directional pleiotropy -> Use weighted-median or mode-based estimator; report Egger intercept + I2 as pleiotropy diagnostic; Q-statistic rejects homogeneity (Co... |
| msmA | Marginal Structural Models for time-varying treatments with time-varying confounders. Uses stabilized IPTW and cluster-robust inference. Handles binary or continuous treatment; exposure summary can be current, cumulative, or ever. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Sequential exchangeability / no unmeasured confounding at each time point; Positivity: every treatment level is possible given the past; Correct specification of the treatment and/or outcome models. Pre-conditions: Sequentially measured covariates, (time-varying) treatment, and outcome; Models for the treatment process and the outcome (or weights). Failure modes: Stabilized weights have extreme values (positivity near-violation) -> Truncate weights, simplify the treatment model, or use a doubly-robust estimator (TMLE). Alternatives: sp.tmle, sp.g_computation, sp.ipw. Typical minimum N: 300. |
| multi_cutoff_rdA | User-friendly alias for :func: |
| multi_outcome_synthA | Multiple Outcomes Synthetic Control Method (Sun 2023). Assumptions: A convex (or regularized) combination of donor units reproduces the treated unit's pre-treatment outcome path; No interference: the treatment does not affect the donor units (SUTVA); No anticipation before the treatment date. Pre-conditions: Panel of one or more treated units plus an untreated donor pool, observed over time; Pre-treatment window long enough to fit donor weights (rule of thumb: more pre-periods than donors used); Outcome observed for every unit in every period. Failure modes: Large pre-treatment RMSPE -- the synthetic unit fails to track the treated unit before treatment -> Add donors / predictors, lengthen the pre-period, or use a bias-corrected estimator (sdid, augsynth); Placebo / permutation inference shows the estimate is not extreme relative to donors -> Report the placebo distribution honestly; the effect may not be distinguishable from noise. Alternatives: sp.sdid, sp.augsynth, sp.gsynth, sp.callaway_santanna. Typical minimum N: 15. |
| multi_score_rdB | User-friendly alias for :func: |
| multi_treatmentA | Effects of multi-valued (3+ level) treatments via AIPW. Returns pairwise contrasts versus a reference level. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Generalised unconfoundedness: Y(a) perp T | X for all a; Generalised overlap: 0 < P(T=a | X) < 1 for each arm a; SUTVA across arms. Pre-conditions: treat is integer-valued with >= 2 distinct levels; covariates comprise the confounding set; enough units per treatment arm (>= 50 per arm). Failure modes: Some arm has near-zero propensity in the data -> Violates overlap -- drop that arm or use bounds; Tiny treatment cells (< 30) -> Collapse sparse arms or use regularised multinomial propensity. Alternatives: sp.multi_arm_forest, sp.dml, sp.metalearner. Typical minimum N: 300. |
| multiway_cluster_vcovB | Compute N-way cluster-robust variance of an OLS coefficient vector. Validation: certified parity evidence. |
| nbregA | Fit a negative-binomial count model. Use this for overdispersed non-negative count outcomes; formulas may include explicit fixed effects with 'y ~ x | id' for moderate panels. Validation: certified parity evidence. |
| negative_control_exposureA | Regress outcome on a negative-control exposure. Assumptions: The negative-control exposure has no causal effect on the outcome by design (Lipsitch et al. 2010); It shares the same confounding structure as the real exposure. Pre-conditions: data has the outcome and a negative-control exposure column. Failure modes: Significant coefficient on the negative-control exposure signals residual confounding, not an effect -> Treat a non-zero coefficient as a confounding alarm; add covariates or run a sensitivity analysis. Alternatives: sp.negative_control_outcome, sp.sensemakr, sp.evalue. Typical minimum N: 100. |
| negative_control_outcomeA | Lipsitch-style NCO calibration. Assumptions: The negative-control outcome is not caused by the treatment (Lipsitch-style calibration); It shares confounders with the real outcome. Pre-conditions: data has a negative-control outcome and a treatment column. Failure modes: Coefficient on treatment differs significantly from zero -- residual confounding detected -> Condition on more covariates or quantify the implied bias with a sensitivity analysis. Alternatives: sp.negative_control_exposure, sp.sensemakr, sp.evalue. Typical minimum N: 100. |
| network_exposureA | Aronow-Samii Horvitz-Thompson estimator for arbitrary interference via a user-supplied exposure mapping. Handles Bernoulli randomisation designs with simulated conservative variance. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Known limitations: design='complete' is reserved but not implemented; passing it raises NotImplementedError. Use design='bernoulli' with p_treat=K/N as an approximation only if that matches the assignment mechanism you are willing to assume. Assumptions: Exposure mapping is correctly specified (as4 / as3 / as2 -- Aronow-Samii hierarchy); Positivity: every exposure level has positive probability under the design; Network adjacency is fixed / known (measurement error in ties introduces bias). Pre-conditions: adjacency is a binary n x n matrix encoding network ties; Y, Z have same length n; randomisation design is known (bernoulli with p_treat, or complete). Failure modes: Some exposure level has < 5 observed units -> Switch to a coarser mapping (as4 -> as3) or increase sample size; Variance estimate extremely conservative (wide CI) -> HT-style variance is conservative by design -- use sp.spillover for... |
| nonlinear_icpA | Alias for |
| notchA | Bunching at Notches estimator (Kleven & Waseem 2013). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: The counterfactual density would be smooth through the threshold absent the policy; Excess mass at the threshold reflects the behavioural elasticity of interest; No other discontinuity coincides with the threshold. Pre-conditions: A behavioural choice variable (earnings, hours, ...) with a known kink or notch in the budget/choice set; A visible empirical density of the running variable around the threshold. Failure modes: Round-number heaping or a coincident policy contaminates the bunching mass -> Exclude heaping points, widen the excluded region, and test the counterfactual polynomial order. Alternatives: sp.rdrobust, sp.rkd. Typical minimum N: 500. |
| notearsA | Learn a DAG from data using NOTEARS (Zheng et al. 2018). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Causal Markov condition and faithfulness (PC/GES/FCI); Causal sufficiency for PC/GES (no latent confounders); FCI relaxes this; Acyclicity; LiNGAM additionally assumes a linear non-Gaussian model. Pre-conditions: Constraint-/score-based discovery needs i.i.d. observational data with enough samples for reliable conditional-independence tests; Invariance-based discovery (ICP) needs data labelled by environment / intervention. Failure modes: Unstable skeleton / many undirected edges -- faithfulness or sample size is the likely culprit -> Increase the sample, relax the CI-test threshold, or switch to FCI if latent confounders are plausible. Alternatives: sp.pc_algorithm, sp.fci, sp.ges, sp.lingam. Typical minimum N: 500. |
| oaxacaA | Oaxaca-Blinder decomposition of mean outcome gaps. Validation: certified parity evidence. Assumptions: Linearity of conditional mean within each group; Constant returns to covariates within group (no interactions ignored); Reference-group choice does not change interpretive sign of explained vs. unexplained gaps. Pre-conditions: Binary group indicator with both groups represented; Linear specification of outcome on covariates within each group. Failure modes: Detailed decomposition signs flip when reference group changes -> Report aggregated decomposition only, or use pooled reference (Neumark / Cotton). Alternatives: sp.ffl_decompose, sp.dfl_decompose, sp.rif_decomposition. Typical minimum N: 200. |
| offline_safe_policyA | Safe offline policy learning with a cost-constraint. Assumptions: Sequential ignorability: no unobserved confounders of actions and outcomes; Positivity: the behaviour policy explores all evaluated actions; The environment satisfies the assumed (Markov) dynamics. Pre-conditions: Logged trajectories (states, actions, rewards) from a known or estimable behaviour policy. Failure modes: Poor behaviour-policy coverage -- the target policy queries unseen state-action regions -> Use offline-safe / pessimistic methods and report effective sample size of the importance weights. Alternatives: sp.offline_safe_policy, sp.policy_value. Typical minimum N: 1000. |
| ologitB | Ordered logit (proportional odds) model via MLE. Validation: certified parity evidence. |
| oprobitC | Ordered probit model via MLE. Validation: certified parity evidence. |
| optimal_matchA | Optimal 1:1 matching via the Hungarian algorithm. Validation: certified parity evidence. Do NOT use when: either arm has more than ~10,000 units -- the assignment problem is superquadratic (see cost); use sp.psm or sp.match (greedy nearest-neighbour) at that scale. Cost: Materialises the dense n_treated x n_control distance matrix, then solves a linear sum assignment (Hungarian, ~O(n^3) worst case). Both memory and time degrade sharply past a few thousand units per arm. Assumptions: Unconfoundedness: treatment is as-good-as-random given the measured covariates; Overlap / common support: every unit has a non-degenerate probability of each treatment; The covariate set blocks all back-door paths. Pre-conditions: Pre-treatment covariates measured for treated and control units; A binary (or low-cardinality) treatment indicator; Sufficient covariate overlap between treatment arms. Failure modes: Poor overlap -- extreme propensity scores or few acceptable matches -> Trim or restrict to the common-support region and report the discarded units; Covariate imbalance remains after matching/weighting -> Re-specify the balancing model (CBPS, entropy balancing) and re-check standardized mean dif... |
| oster_boundsA | Oster (2019) sensitivity to selection on unobservables -- computes the bounding coefficient under the assumption that selection on unobservables (proportional to delta x selection on observables) brings the explained variance to r_max. The breakdown delta tells you how strong unobserved selection has to be to overturn your result. Assumptions: Selection on unobservables is proportional (by factor delta) to selection on observables; r_max upper-bounds the explained variance achievable with all confounders included; Linear functional form for y on (treat, controls). Pre-conditions: you have fitted both a short (treatment-only) and long (treatment + controls) regression of y; long-regression R^2 is meaningfully larger than short-regression R^2. Failure modes: breakdown delta < 1.0 (weak unobservables overturn the result) -> The result is fragile; report the breakdown delta alongside the point estimate; r2_long ~ r2_short (controls add no explanatory power) -> Oster's identified set degenerates when long and short R^2 are nearly equal; use sp.evalue or sp.sensemakr instead. Alternatives: sp.evalue, sp.sensemakr, sp.rosenbaum_bounds. Typical minimum N: 200. |
| oster_deltaA | Oster (2019) coefficient stability bounds and delta* computation. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Only weak (set-identifying) assumptions are imposed; the result is an interval, not a point; Lee bounds add monotonicity of selection; Oster's delta adds proportional selection on observed vs. unobserved. Pre-conditions: The data needed for the point-identifying analysis, plus the weakest credible identifying restriction; For Lee bounds: a binary selection/attrition indicator. Failure modes: Bounds are too wide to be informative -> Add a credible auxiliary restriction (monotone treatment response, instrument) to tighten the bounds. Alternatives: sp.oster_delta, sp.lee_bounds, sp.manski_bounds. Typical minimum N: 100. |
| overlap_plotB | Mirrored density plot of propensity scores by treatment group. |
| overlap_weighted_didA | Overlap-weighted 2x2 DiD. Weights observations by e(X)(1-e(X)), where e(X) is the estimated propensity score, placing highest weight on units with the most overlap between treated and control covariate distributions. Useful when overlap is poor at the tails. Assumptions: Overlap weights target the sub-population with positive overlap; Correct PS model OR outcome model for DR variant; Conditional parallel trends given covariates X after overlap weighting. Pre-conditions: 2 periods, binary treat; covariates with variation; Two-period panel with a binary treat indicator and a binary pre/post time indicator. Failure modes: Propensity scores pile up near 0/1 giving near-zero overlap weights and unstable ATT -> Trim extreme-PS units or simplify the covariate set to restore common support; ps_model='dl' requested but the deep-learning propensity backend fails to converge -> Fall back to ps_model='logit' or 'gbm' for a more stable propensity estimate; More than two time periods passed to this 2x2-only estimator -> Collapse to a single pre/post contrast or use a staggered/multi-period estimator. Alternatives: sp.drdid, sp.did_2x2, sp.did, sp.callaway_santanna. Typical minimum N: 200. |
| overlap_weightsA | Overlap-weight (ATO) treatment effect estimator. Validation: certified parity evidence. Assumptions: Unconfoundedness: treatment is as-good-as-random given the measured covariates; Overlap / common support: every unit has a non-degenerate probability of each treatment; The covariate set blocks all back-door paths. Pre-conditions: Pre-treatment covariates measured for treated and control units; A binary (or low-cardinality) treatment indicator; Sufficient covariate overlap between treatment arms. Failure modes: Poor overlap -- extreme propensity scores or few acceptable matches -> Trim or restrict to the common-support region and report the discarded units; Covariate imbalance remains after matching/weighting -> Re-specify the balancing model (CBPS, entropy balancing) and re-check standardized mean differences. Alternatives: sp.propensity_score, sp.cbps, sp.ebalance, sp.dml. Typical minimum N: 200. |
| panelA | Unified panel regression: FE, RE, between, FD, pooled OLS, two-way FE, Mundlak/Chamberlain CRE, Arellano-Bond, Blundell-Bond system GMM. Results include built-in diagnostics: .hausman_test(), .bp_lm_test(), .f_test_effects(), .pesaran_cd_test(), .compare(method). Validation: certified parity evidence. Assumptions: Static FE: strict exogeneity of regressors conditional on unit fixed effects (E[u_it | x_i, alpha_i] = 0); Random effects: unit effect uncorrelated with regressors; relax with Mundlak / Chamberlain; Dynamic GMM: weak exogeneity and no second-order serial correlation in differenced errors. Pre-conditions: Data is a long-format panel keyed by (entity, time) with at least 2 time periods per entity; Outcome and regressors are numeric or properly encoded; Method-specific structure satisfied (e.g. dynamic GMM needs T moderate, system GMM needs initial-condition validity). Failure modes: Hausman test rejects RE -> Switch to fixed effects (method='fe') or correlated random effects (method='mundlak'); Few clusters (< 30) inflate Type I error with cluster-robust SEs -> Use wild-cluster bootstrap or CR2/CR3 small-sample corrections; High-dimensional fixed effects make the design si... |
| panel_compareA | Estimate the same model with multiple panel methods and return a side-by-side comparison table. |
| panel_fglsC | Panel FGLS (Feasible Generalized Least Squares). Validation: certified parity evidence. |
| panel_logitC | Panel logit model. Validation: certified parity evidence. |
| panel_probitD | Panel probit model. Validation: certified parity evidence. |
| panel_qtetA | Callaway & Li (2019) quantile treatment effect on the treated for panel data. Recovers the counterfactual DISTRIBUTION of untreated outcomes for the treated group via distributional DiD plus a copula-stability assumption. Needs a balanced THREE-period panel (the third period identifies the copula). Exact parity with R qte::panel.qtet (6.8e-12). Validation: certified parity evidence. Assumptions: Distributional DiD; Copula stability: the dependence between the period-t change and the period-(t-1) level equals that between the period-(t-1) change and the period-(t-2) level, for the treated. Untestable at t, but checked on the untreated group and reported in model_info['copula_check']; Continuous outcome: with mass points the rank map is not measure-preserving; model_info['coherence_check'] flags it. Pre-conditions: balanced panel over three periods; binary treatment, read at period t; continuous outcome (mass points distort the rank map). Failure modes: Outcome has mass points (e.g. many zero earnings) -> The rank map collapses tied units onto one value and the QTT curve is distorted; the reported ATT (a mean DiD) is unaffected. Use sp.cic bounds for discrete outcomes; Only two peri... |
| panel_unitrootC | Panel unit root test. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| panel_viewB | panelView-style display of a panel's treatment status and outcomes. |
| parallel_trends_plotB | Plot raw outcome means over time for treatment and control groups. |
| parallel_trends_robustnessA | Run the full parallel-trends robustness pipeline on a DiD result. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| partial_corr_pvalueA | Partial-correlation p-value for H0: |
| partial_identificationA | Partial identification of ATE -- article alias for the |
| pateB | Estimate the Population Average Treatment Effect (PATE). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| pc_algorithmA | Learn causal structure using the PC algorithm. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Causal Markov condition and faithfulness (PC/GES/FCI); Causal sufficiency for PC/GES (no latent confounders); FCI relaxes this; Acyclicity; LiNGAM additionally assumes a linear non-Gaussian model. Pre-conditions: Constraint-/score-based discovery needs i.i.d. observational data with enough samples for reliable conditional-independence tests; Invariance-based discovery (ICP) needs data labelled by environment / intervention. Failure modes: Unstable skeleton / many undirected edges -- faithfulness or sample size is the likely culprit -> Increase the sample, relax the CI-test threshold, or switch to FCI if latent confounders are plausible. Alternatives: sp.pc_algorithm, sp.fci, sp.ges, sp.lingam. Typical minimum N: 500. |
| pci_mtpA | Proximal causal inference for modified treatment policies (Park & Ying 2025). Estimates the effect of a policy that shifts the treatment distribution (e.g., raises the dose by 10%) under unobserved confounding identified by PCI. Assumptions: The proxies are valid negative controls (relevant to the confounder, excluded from the causal channel); A bridge function exists (completeness conditions hold). Pre-conditions: Treatment-inducing and outcome-inducing proxy variables (negative controls) for the unobserved confounder. Failure modes: Proxies are weak or invalid -- the bridge function is poorly identified -> Test proxy relevance, select stronger proxies, or fall back to sensitivity analysis. Alternatives: sp.select_pci_proxies, sp.dml. Typical minimum N: 500. |
| pcmciA | PCMCI causal discovery for stationary time-series. Assumptions: Causal Markov condition and faithfulness (PC/GES/FCI); Causal sufficiency for PC/GES (no latent confounders); FCI relaxes this; Acyclicity; LiNGAM additionally assumes a linear non-Gaussian model. Pre-conditions: Constraint-/score-based discovery needs i.i.d. observational data with enough samples for reliable conditional-independence tests; Invariance-based discovery (ICP) needs data labelled by environment / intervention. Failure modes: Unstable skeleton / many undirected edges -- faithfulness or sample size is the likely culprit -> Increase the sample, relax the CI-test threshold, or switch to FCI if latent confounders are plausible. Alternatives: sp.pc_algorithm, sp.fci, sp.ges, sp.lingam. Typical minimum N: 500. |
| pipeline_didA | End-to-end DID workflow: preflight -> did/CS estimator -> audit -> honest-DID sensitivity -> bacon decomposition -> brief. Returns one markdown report + the primary result_id. Use this when the user pastes a DID dataset and asks 'is the effect real?' -- the pipeline runs every diagnostic the literature expects. |
| pipeline_ivA | End-to-end IV workflow: ivreg -> first-stage F (effective + Olea-Pflueger) -> Anderson-Rubin CI -> e-value. Returns one markdown report + result_id. |
| pipeline_rdA | End-to-end RD workflow: rdrobust -> rdplot (PNG image) -> rddensity (McCrary) -> rdsensitivity (bandwidth). Returns one markdown report + result_id + an image content block. |
| plot_from_resultA | Render the canonical diagnostic plot for a fitted result and return it as an inline PNG image content block. MCP clients with vision (Claude Desktop, vision-capable agents) get the plot for free; clients that don't support image content see only the JSON metadata. Plot kind is auto-selected from the result type: event-study for DID, rdplot for RD, gap plot for synth, balance plot for matching, ROC for classification, etc. |
| poissonB | Poisson regression via MLE (IRLS). Validation: certified parity evidence. |
| policy_targetingB | Rank-and-treat policy under a budget constraint. |
| policy_treeC | Doubly-robust policy-tree -- article-facing alias. Validation: certified parity evidence. |
| policy_valueA | Evaluate the expected value of a treatment policy. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: The relationship between the treated unit and controls is stable absent the intervention (causal_impact); Matrix-completion: the untreated potential outcomes follow a low-rank factor structure with treatment as the missingness pattern; No concurrent intervention affects the controls. Pre-conditions: A treated unit with a pre-period and a set of control series, or a panel with a low-rank structure. Failure modes: Pre-period fit is poor or controls are themselves affected by the intervention -> Re-select controls, lengthen the pre-period, or use synthetic-control / DiD diagnostics. Alternatives: sp.synth, sp.sdid, sp.gsynth. Typical minimum N: 50. |
| postestimation_contractC | Return the post-estimation actions supported by result. |
| postestimation_reportB | Return the post-estimation actions supported by result. |
| ppi_meanC | Prediction-powered estimate of a population mean. |
| ppi_olsB | Prediction-powered OLS with a labeled audit sample. |
| ppmlhdfeA | Pseudo-Poisson Maximum Likelihood with high-dimensional fixed effects. Validation: certified parity evidence. Do NOT use when: vce='conley' on more than ~20,000 rows -- dense O(n^2) memory (see cost); vce='conley' with high-dimensional fixed effects -- the conleyreg-matching construction is dummy-based and raises MethodIncompatibility past 1,000 dummy columns; use cluster= (CRV1) there. Cost: IRLS is linear in n. vce='conley' builds the FE-as-dummies design plus dense n x n great-circle distance and kernel matrices (glm_conley_vcov) -- ~0.8 GB at n=10,000 and ~80 GB at n=100,000 -- and it refuses designs with >= n or > 1,000 dummy columns. Use cluster= (CRV1) instead at that scale. |
| predict_cateA | Predict CATE on new (out-of-sample) data. Assumptions: Unconfoundedness given the covariates; Overlap / positivity across the covariate space; Nuisance functions are estimated consistently; cross-fitting controls overfitting bias. Pre-conditions: Covariates, a treatment indicator, and an outcome for each unit; Enough data to fit flexible nuisance models with sample-splitting / cross-fitting. Failure modes: CATE estimates are unstable or extrapolate beyond the covariate support -> Restrict to the overlap region, increase data, or use a doubly-robust learner (DR-/R-learner). Alternatives: sp.dml, sp.causal_forest, sp.tmle. Typical minimum N: 500. |
| preflightA | Run pre-fit identification checks for a chosen method on a DataFrame. Verdict in {PASS, WARN, FAIL}. ALWAYS call this before fitting on an unfamiliar dataset to surface design problems (overlap, cohort sizes, IV first-stage F, running-variable density at the cutoff). |
| pretrends_equivalenceA | Pre-trend equivalence tests (Liu, Wang & Xu 2024, the fect diagnostic panel). Reverses the usual null: instead of testing whether pre-period effects are zero, tests whether they are demonstrably small. Failing to reject 'no pre-trend' is often just low power (Roth 2022), so the conventional test alone overstates the evidence for parallel trends. Reports the joint F test alongside its non-central-F and TOST equivalence counterparts, where a small p-value is the reassuring outcome. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Known limitations: the TOST is computed only when tost_threshold is supplied; there is no universal outcome-scale default, so it is not invented. Pre-conditions: result carries influence functions so the joint pre-period covariance can be recovered; at least two pre-treatment periods (one is absorbed as the normalisation reference); more treated units than pre-periods. Alternatives: sp.pretrends_test, sp.pretrends_power, sp.honest_did. |
| pretrends_powerA | Power of the pre-trend test against a hypothesised violation. Validation: certified parity evidence. |
| pretrends_slope_for_powerC | Slope of a linear pre-trend the pre-test would detect |
| pretrends_summaryC | Print a combined pre-trends diagnostic report. |
| pretrends_testA | Joint Wald test of pre-treatment ATTs (or event-study leads) against zero -- the canonical sanity check for the parallel-trends assumption in DiD designs. Failing to reject is necessary but not sufficient evidence for parallel trends; always pair with sp.honest_did / sp.sensitivity_rr for design-robust inference. Assumptions: The test asks whether the pre-period ATTs jointly differ from zero; Failing to reject is consistent with parallel trends but does NOT prove it (low power problem -- Roth 2022). Pre-conditions: result has at least one pre-treatment period coefficient and its variance; covariance between pre-period coefficients is available (cluster-robust SE recommended). Failure modes: Single pre-period (no pretrends to test) -> Pretrends test needs >= 2 pre-treatment periods; widen the panel or drop the test; High-power study rejects but visual pretrends look flat -> Use sp.honest_did + sp.sensitivity_rr to bound the bias; reporting both is standard practice. Alternatives: sp.sensitivity_rr, sp.honest_did, sp.event_study. Typical minimum N: 50. |
| principal_stratA | Principal Stratification (Frangakis & Rubin 2002). 'monotonicity' method identifies the complier PCE (= LATE) and reports Zhang-Rubin sharp bounds on the always-survivor SACE. 'principal_score' uses Ding-Lu covariate weighting to point-identify stratum-specific effects under principal ignorability. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Known limitations: Always-survivor SACE under encouragement design (Mealli & Pacini 2013, partial identification) is not yet implemented; only AIR / Wald LATE point estimates (tau_Y on outcome, tau_S on the post-treatment stratum) are reported when an instrument is supplied. Assumptions: Monotonicity (no defiers) for method='monotonicity'; Principal ignorability for method='principal_score' (strata perp Y(d) | X); SUTVA and exclusion restriction for the never-takers / always-takers interpretation. Pre-conditions: binary treatment; binary post-treatment stratum variable (compliance, survival, employment, ...); covariates required when method='principal_score' (for Ding-Lu weighting). Failure modes: Zhang-Rubin bounds include 0 and both signs -> Strata partition too weak for point ident... |
| probitC | Probit regression via maximum likelihood. Validation: certified parity evidence. |
| propensity_scoreA | Estimate propensity scores P(D=1|X). Assumptions: Unconfoundedness: treatment is as-good-as-random given the measured covariates; Overlap / common support: every unit has a non-degenerate probability of each treatment; The covariate set blocks all back-door paths. Pre-conditions: Pre-treatment covariates measured for treated and control units; A binary (or low-cardinality) treatment indicator; Sufficient covariate overlap between treatment arms. Failure modes: Poor overlap -- extreme propensity scores or few acceptable matches -> Trim or restrict to the common-support region and report the discarded units; Covariate imbalance remains after matching/weighting -> Re-specify the balancing model (CBPS, entropy balancing) and re-check standardized mean differences. Alternatives: sp.propensity_score, sp.cbps, sp.ebalance, sp.dml. Typical minimum N: 200. |
| proximalA | Proximal Causal Inference via linear 2SLS on the outcome bridge. Identifies ATE with unmeasured confounding using two proxy variables: a treatment-side Z (instrument for W) and an outcome-side W (endogenous bridge regressor). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Existence of an outcome bridge function h(w, a, x) that recovers E[Y(a) | U, X]; Z and W are conditionally independent given U and (A, X); Z perp Y | U, A, X (exclusion on Z). Pre-conditions: at least one treatment-side proxy Z (independent of outcome given U, X); at least one outcome-side proxy W (independent of treatment given U, X); proxy_z and proxy_w measure the same unmeasured confounder U from different angles. Failure modes: First-stage (Z -> W) too weak -> Try richer Z or more proxies; without first-stage strength the bridge is underidentified; Proxies collapse to nearly-constant -> Proxy variation insufficient -- redesign measurement or fall back to sensitivity (sp.sensemakr); Estimate highly sensitive to bridge specification -> Report multiple bridge families; compare with sp.negative_control_outcome / _exposure. Alternatives: sp.neg... |
| proximal_regressionA | Doubly-robust regression-based PCI estimator for the ATE. Assumptions: A treatment-inducing confounding proxy Z and an outcome-inducing confounding proxy W are observed; Outcome and treatment confounding bridge functions exist (proximal-g and proximal-h completeness conditions); Latent confounding is fully captured by (Z, W, X) -- no residual unmeasured confounding outside the proxy span. Pre-conditions: data has outcome, binary treatment, z_proxy and w_proxy columns; treatment is binary for the bridge logistic step. Failure modes: Treatment-bridge logistic regression fails to converge; propensity collapses to the marginal P(D=1) -> Check detail['propensity_fallback']; the DR correction is neutralised -- improve proxies or covariates. Alternatives: sp.proximal, sp.double_negative_control, sp.frontdoor. Typical minimum N: 200. |
| ps_balanceB | Compute comprehensive propensity score balance table. |
| psmA | Propensity-score matching -- article alias for :func: |
| psmatch2A | Stata psmatch2-faithful supported propensity-score matching paths (nearest-neighbour, kernel, radius, local linear regression, Mahalanobis): returns matched-sample variables (_pscore _treated _support _weight _y; plus _n1 through _nn _pdif for nearest-neighbour), the psmatch2 analytic ATT standard error, plus post-matching balance (.pstest() reproduces Stata pstest exactly), common-support plotting, and weighted PSM-DID. Validation: certified parity evidence. Assumptions: Unconfoundedness / CIA: Y(d) perp D | X; Overlap / common support on the propensity score; SUTVA: no interference between matched units. Pre-conditions: binary treatment 0/1; covariates are pre-treatment (temporally prior to D); enough control units for each treated unit under k:1 matching. Failure modes: Residual imbalance after matching (max |SMD| > 0.1) -> Tighten caliper, add covariate interactions (ps_poly), or switch to sp.ebalance; Treated units off common support -> Pass common_support='minmax' (Stata |
| psplotA | Propensity score distribution plot (common support diagnostic). |
| pub_readyC | Publication readiness checklist. |
| pwcompareC | Pairwise comparisons of predictive margins across all levels. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| qdidA | Quantile Difference-in-Differences (QDiD): applies the DiD contrast to quantiles, [Q11(t)-Q10(t)] - [Q01(t)-Q00(t)], on a 2x2 design with bootstrap SE. This is NOT changes-in-changes -- Athey & Imbens (2006) propose CiC and explicitly criticise QDiD; use sp.cic for CiC. Validation: certified parity evidence. Assumptions: CIC rank invariance: the quantile rank in the untreated distribution is stable across groups; Continuous outcome support covering both groups in both periods; SUTVA (no cross-group spillovers). Pre-conditions: panel or repeated cross-section; group is binary 0/1; time is binary 0/1 (pre / post). Failure modes: Outcome heavily discrete / zero-inflated -> CIC rank-matching is unstable on discrete supports -- use QTE regression (sp.qte) or Firpo-RIF; Bootstrap CI across quantiles varies wildly -> Thin tails at extreme quantiles -- restrict to [0.2, 0.8] or raise n_boot to 2000. Alternatives: sp.qte, sp.did, sp.rifreg. Typical minimum N: 500. |
| qqsynthA | Quantile Synthetic Control (alias for DiSCo with |
| qregA | Quantile regression at specified quantile(s). Validation: certified parity evidence. Assumptions: Conditional quantile is linear in covariates; Outcome continuous (or finely discretized) so the check-function minimization is well-posed; Powell (1991) sandwich SEs require a consistent kernel density of the conditional density at zero. Pre-conditions: Continuous outcome variable; Quantile tau strictly in (0,1). Failure modes: Sparse data in tail quantiles gives unstable density estimate and wide SEs -> Estimate a more central quantile or pool more data near the tail; Crossing/degenerate fit when regressors are collinear -> Drop or combine collinear regressors before refitting. Alternatives: sp.regress, sp.feols. Typical minimum N: 200. |
| qteA | Quantile treatment effects. 'firpo_qte' / 'firpo_qtt' give Firpo (2007) efficient UNCONDITIONAL QTE / QTT by propensity reweighting (analytic influence-function SE); 'conditional_qr' gives the CONDITIONAL QTE (coefficient on D in a quantile regression, Koenker & Bassett 1978); 'distribution' gives the QTT via an IPW counterfactual distribution. Validation: certified parity evidence. Assumptions: For 'firpo_qte' / 'firpo_qtt' / 'distribution': unconfoundedness + overlap; For 'conditional_qr': unconfoundedness conditional on controls; note this is a CONDITIONAL estimand with no causal reading absent rank invariance; Correct parametric quantile model (sensitivity tested via multiple quantiles). Pre-conditions: binary treatment (all methods); continuous outcome; controls cover the confounding set. Failure modes: Large IPW weights (method='ipw') -> Extreme propensities -- trim (sp.trimming) or switch to doubly-robust DR-QTE; Quantile crossing -> Use rearrangement (Chernozhukov-Fernandez-Val-Galichon) or monotone constraints. Alternatives: sp.qdid, sp.rifreg, sp.cic, sp.metalearner. Typical minimum N: 500. |
| qte_hd_panelA | Panel quantile treatment effects with high-dimensional controls. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Selection-on-observables (unconfoundedness + overlap) or, for IV variants, instrument validity; For IV-QTE: rank invariance / rank similarity (monotonicity of the structural quantile function). Pre-conditions: Covariates, treatment, and outcome; for IV-quantile methods, a valid instrument; Enough data to estimate the outcome distribution across quantiles. Failure modes: Estimated conditional quantiles cross (non-monotone), or tail quantiles are unstable -> Use rearrangement / monotonization and avoid extreme quantiles where data are sparse. Alternatives: sp.qte, sp.iv, sp.dml. Typical minimum N: 500. |
| quasi_untreated_testB | Test that quasi-untreateded groups exist (dCDH et al., Section 3.3). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| rateA | Rank-Average Treatment Effect (Yadlowsky et al. 2023). Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness given the covariates; Overlap / positivity; Honesty: separate subsamples are used to choose splits and to estimate effects. Pre-conditions: Covariates, treatment, and outcome with enough data to grow an honest forest. Failure modes: Calibration test rejects -- the forest's heterogeneity is not well calibrated -> Increase the sample / number of trees, or fall back to a doubly-robust learner. Alternatives: sp.dml, sp.auto_cate, sp.tmle. Typical minimum N: 1000. |
| rd2dA | 2D boundary regression discontinuity estimation. Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect. Typical minimum N: 500. |
| rd2d_bwB | Bandwidth selection for 2D boundary RD. |
| rd2d_plotD | 2D boundary RD visualization. |
| rd_bayes_hteA | Bayesian RDD allowing CATE to depend on covariates. Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect. Typical minimum N: 500. |
| rd_bias_aware_fuzzyA | Bias-aware confidence interval for fuzzy RD via Anderson-Rubin test inversion (Noack-Rothe 2024 Econometrica). Robust to weak first stages and avoids the power asymmetry of conventional 2SLS-style fuzzy RD CIs (Kaliski-Keane-Neal 2025). Assumptions: Continuity of potential outcomes in x at c (Hahn, Todd, van der Klaauw 2001); No manipulation of x at c (McCrary density test); Local randomization only in a neighborhood of c -- extrapolation away from c is not identified. Pre-conditions: running variable x is continuous with support on both sides of c; treatment assignment is determined by the cutoff c (sharp) or probabilistically at c (fuzzy); sufficient mass of observations within the optimal bandwidth. Failure modes: McCrary density test p < 0.05 -> Use donut-hole RD (donut=) or partial-identification bounds; Covariate imbalance at cutoff (sp.rdbalance rejects) -> Include covariates as controls, narrow bandwidth, or report as caveat; Effect unstable across bandwidth halvings -> Report sp.rdbwsensitivity and sp.rd_honest (Armstrong-Kolesar honest CI). Alternatives: sp.rdrobust, sp.rd_honest, sp.rdrbounds, sp.bounds. Typical minimum N: 500. |
| rd_boostB | Gradient Boosting for RD -- flexible CATE estimation. |
| rd_cate_summaryB | Run multiple ML-RD methods and compare CATE estimates. |
| rd_compareC | Compare multiple RD estimators on the same data. |
| rd_dashboardC | Four-panel RD diagnostic dashboard. |
| rd_discreteA | Honest CI for RD when the running variable takes only a moderate number of distinct values (Kolesar-Rothe 2018 AER). Uses bounded second derivative or bounded misspecification smoothness classes; robust to the loss of asymptotics that affects rdrobust under sparse mass points. Assumptions: Continuity of potential outcomes in x at c (Hahn, Todd, van der Klaauw 2001); No manipulation of x at c (McCrary density test); Local randomization only in a neighborhood of c -- extrapolation away from c is not identified. Pre-conditions: running variable x is continuous with support on both sides of c; treatment assignment is determined by the cutoff c (sharp) or probabilistically at c (fuzzy); sufficient mass of observations within the optimal bandwidth. Failure modes: McCrary density test p < 0.05 -> Use donut-hole RD (donut=) or partial-identification bounds; Covariate imbalance at cutoff (sp.rdbalance rejects) -> Include covariates as controls, narrow bandwidth, or report as caveat; Effect unstable across bandwidth halvings -> Report sp.rdbwsensitivity and sp.rd_honest (Armstrong-Kolesar honest CI). Alternatives: sp.rdrobust, sp.rd_honest, sp.rdrbounds, sp.bounds. Typical minimum N:... |
| rd_distributionA | Distribution-valued sharp RDD. Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial; running variable x is continuous with support on both sides of c. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth; McCrary density test p < 0.05 -> Use donut-hole RD (donut=) or partial-identification bounds. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect, sp.rd_honest. Typical minimum N: 500. |
| rd_distributional_designA | Joint RDD + RKD on the conditional distribution of Y. Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect. Typical minimum N: 500. |
| rd_external_validityA | Diagnostic assessment of RD external validity. Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect. Typical minimum N: 500. |
| rd_extrapolateA | Angrist-Rokkanen (2015) extrapolation of RD effects away from the cutoff. Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial; running variable x is continuous with support on both sides of c. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth; McCrary density test p < 0.05 -> Use donut-hole RD (donut=) or partial-identification bounds. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect, sp.rd_honest. Typical minimum N: 500. |
| rd_flexA | RD with flexible covariate adjustment via cross-fit ML residualisation (Noack-Olma-Rothe 2025). Reduces variance of tau at the cutoff by subtracting an ML estimate of E[Y|W] before running rdrobust; consistent under free-of-cutoff continuity of eta, asymptotically efficient when eta converges to E[Y|X=c, W]. Assumptions: Continuity-based RD identification at the cutoff: potential outcomes are continuous in the running variable except for the treatment jump; Cross-fit ML residualisation of the outcome (and treatment, when fuzzy) on covariates only removes outcome variance and does not bias the cutoff estimate, requiring honest K-fold cross-fitting; Covariates predict the outcome well enough to shorten CIs relative to plain rdrobust; covariates are pre-determined (not affected by treatment). Pre-conditions: data has continuous running variable with adequate mass on both sides of the cutoff; Covariates list valid pre-treatment columns (or is empty/None to fall back to rdrobust); n_folds>=2 for genuine cross-fitting. Failure modes: Sparse data near the cutoff makes the local fit and learner unstable -> Widen the bandwidth via bwselect or collect more mass around the cutoff; Covariates... |
| rd_forestA | Causal Forest for RD -- heterogeneous treatment effect estimation. Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect. Typical minimum N: 500. |
| rd_honestA | Armstrong-Kolesar (2018) honest confidence intervals for sharp regression discontinuity -- the only RD inference procedure with provable finite-sample coverage without bandwidth-selection bias. M is the upper bound on the second derivative of E[Y|X] near the cutoff; smaller M means tighter CIs but riskier coverage if the true curvature is larger. Validation: certified parity evidence. Assumptions: E[Y|X] has bounded second derivative |E[Y|X]''| <= M near c; Continuity of potential outcomes at c (Hahn-Todd-van der Klaauw 2001); No manipulation of x at c (run sp.mccrary_test alongside). Pre-conditions: x is continuous with support on both sides of c; Sample mass within the optimal bandwidth on each side; User-supplied M (or willingness to estimate it from data). Failure modes: M estimated from data and effective sample tiny -> Pass an explicit M based on theory or sensitivity analysis (M_grid in Armstrong-Kolesar 2018 Section 4); Honest CI much wider than rdrobust CI -> rd_honest is honest by construction (covers under any |f''| <= M); rdrobust trades coverage for precision. Reporting both is recommended; McCrary density test p < 0.05 -> Use donut-hole RD (donut=) or partia... |
| rd_interferenceA | Sharp RDD with network interference (Cabrelli-Marconi 2024). Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect. Typical minimum N: 500. |
| rd_lassoA | LASSO-assisted RD via post-double-selection. Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect. Typical minimum N: 500. |
| rd_multi_extrapolateA | Multi-cutoff RD extrapolation (Cattaneo, Keele, Titiunik, Vazquez-Bare 2021). Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect. Typical minimum N: 500. |
| rd_multi_scoreB | Multi-score RDD: treatment if all running variables exceed cutoffs. |
| rd_robustness_tableC | Sweep over (kernel, bwselect, polynomial, donut) and return a |
| rdbalanceB | Covariate balance test at the RD cutoff. |
| rdbwhteB | MSE-optimal bandwidth selection for the fully interacted RD model. |
| rdbwselectB | Bandwidth selection for local polynomial RD estimation. Validation: certified parity evidence. |
| rdbwsensitivityC | Bandwidth sensitivity analysis for RD estimates. |
| rddB | Sharp / fuzzy RD -- article-friendly alias for :func: |
| rddensityA | CJM (2020) density discontinuity test for RD manipulation. Validation: certified evidence with scoped limitations. Known limitations: Certified native reference-parity evidence covers the default rddensity::rddensity unrestricted triangular-kernel selector and test path on the JSS Lee/RD Senate fixture. Manual side-specific bandwidths follow an explicit user-control convention, not a reference-parity guarantee; backend='r' remains available when direct R package execution is required. Assumptions: Cattaneo-Jansson-Ma (2020) local-polynomial density test: under no manipulation the running-variable density is continuous at the cutoff; Density is estimated from the empirical CDF via local polynomial regression with a data-driven CJM bandwidth and bias-corrected inference (no binning); Sufficient mass on both sides of the cutoff within the bandwidth for the polynomial fit of order p. Pre-conditions: Running variable column + cutoff c for the RD density test; Adequate observations on each side of the cutoff within the chosen bandwidth. Failure modes: Too few points on one side of the cutoff for the local polynomial density fit -> Widen the bandwidth h or lower the polynomial order p to... |
| rdhteA | Estimate conditional average treatment effects (CATE) in RD designs. Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect. Typical minimum N: 500. |
| rdhte_lincomB | Compute a weighted linear combination of CATE estimates. |
| rditA | Regression Discontinuity in Time (Hausman & Rapson, 2018). Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect. Typical minimum N: 500. |
| rdmcA | Multi-cutoff RD design. Validation: certified parity evidence. Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect. Typical minimum N: 500. |
| rdmsA | Multi-score / Geographic RD design at a single boundary point. Validation: certified parity evidence. Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect. Typical minimum N: 500. |
| rdplaceboC | Placebo cutoff test for RD validity. |
| rdplotA | RD plot: binned scatter with polynomial fit on each side of the cutoff. |
| rdplotdensityB | Boundary-adaptive density discontinuity plot at the RD cutoff. |
| rdpowerB | Power of an RD design given sample size and effect size. Validation: certified parity evidence. |
| rdrandinfA | Randomization inference for regression discontinuity designs. Validation: certified parity evidence. Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect. Typical minimum N: 500. |
| rdrboundsC | Rosenbaum sensitivity bounds for RD under local randomization. |
| rdrobustA | Sharp or fuzzy regression-discontinuity with robust bias-corrected CIs (Calonico-Cattaneo-Titiunik 2014). Use fuzzy= for IV-style fuzzy RD. Validation: certified evidence with scoped limitations. Known limitations: observation-level weights are not yet supported -- passing a weight column raises NotImplementedError; R-parity certification applies to bwselect='cct' or manually matched h/b bandwidths; the dependency-light default bwselect='mserd' uses StatsPAI's calibrated selector and can differ from rdrobust::rdrobust defaults. |
| rdsampsiB | Minimum sample size for a given power in an RD design. Validation: certified parity evidence. |
| rdsensitivityC | Sensitivity of RD estimates across different window widths. |
| rdsummaryC | One-stop RD diagnostic battery. |
| rdwinselectB | Data-driven window selection for local randomization RD. Validation: certified parity evidence. |
| recommendA | Method advisor: given a dataset + research question, recommends a ranked list of estimators with reasoning, precondition checks, and a full suggested workflow. This is the first call an agent should make if it doesn't know which estimator to run. Supports DAG input, mediator / proxy / principal-strata variables, and optional resampling-stability verification. |
| recommend_benchmarkB | Score |
| regressA | Fit an OLS regression with robust (HC1) or clustered SEs. Input is a Wilkinson-style formula like 'y ~ x1 + x2'. Use this for baseline specifications or covariate-adjusted RCT analyses. Validation: certified parity evidence. |
| replicateC | Load a famous dataset and a step-by-step replication guide. |
| reset_testC | Ramsey RESET test for functional form misspecification. Validation: certified parity evidence. |
| ri_testC | Randomization inference p-value. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| rif_decompositionA | RIF Oaxaca-Blinder decomposition (FFL 2009, Section 5). Validation: certified parity evidence. Assumptions: The recentered influence function for the chosen distributional statistic (quantile, variance, Gini, etc.) is a valid first-order approximation, so its expectation recovers the statistic (Firpo-Fortin-Lemieux 2009); The aggregate Oaxaca-Blinder split into explained (endowments) vs unexplained (coefficients) requires no omitted covariates correlated with group and a correctly specified RIF regression; Detailed (per-covariate) decompositions assume path/normalization invariance and, for the unexplained part, an ignorable reference-group choice. Pre-conditions: group is a binary 0/1 indicator and reference in {0,1}; Covariates and the target distributional statistic are well-defined in both groups; Both groups have enough observations to fit the RIF regression at the chosen statistic. Failure modes: RIF for a tail quantile is noisy where the density is near zero, giving unstable shares -> Avoid extreme quantiles or smooth/bootstrap the density estimate underlying the RIF; Limited covariate overlap between groups makes the explained component unreliable (specification error) ->... |
| rifregC | RIF regression (Firpo, Fortin & Lemieux 2009). Validation: certified parity evidence. |
| rkdA | Regression Kink Design estimator (Card et al., 2015). Assumptions: Conditional expectations of potential outcomes are continuous at the cutoff; Units cannot precisely manipulate the running variable around the cutoff (no sorting); For fuzzy designs: monotonicity of treatment take-up at the cutoff. Pre-conditions: A continuous running/forcing variable with a known cutoff that (sharply or fuzzily) assigns treatment; Enough observations in a neighbourhood of the cutoff to fit a local polynomial. Failure modes: Density of the running variable jumps at the cutoff (manipulation / sorting) -> Run a McCrary / density test (rdplotdensity); if manipulation is present the design is invalid near the cutoff; Estimate swings with the bandwidth -- results are not robust -> Report a bandwidth-sensitivity curve and use a data-driven MSE-optimal bandwidth. Alternatives: sp.rdrobust, sp.rdrandinf, sp.rdbwselect. Typical minimum N: 500. |
| rlassoC | Rigorous Lasso / post-Lasso -- a faithful port of |
| rlasso_effectB | Effect of |
| rlasso_effectsC | Estimate the effect of each targeted column of |
| rlasso_ivB | Instrumental-variables estimation with rigorous-Lasso selection. |
| rlassologitC | Logistic rigorous (post-)Lasso -- a faithful port of |
| rlassologit_effectA | Effect of |
| rlassologit_effectsC | Logistic high-dimensional effect of each targeted column of |
| robust_synthA | Robust / unconstrained Synthetic Control. Assumptions: A convex (or regularized) combination of donor units reproduces the treated unit's pre-treatment outcome path; No interference: the treatment does not affect the donor units (SUTVA); No anticipation before the treatment date. Pre-conditions: Panel of one or more treated units plus an untreated donor pool, observed over time; Pre-treatment window long enough to fit donor weights (rule of thumb: more pre-periods than donors used); Outcome observed for every unit in every period. Failure modes: Large pre-treatment RMSPE -- the synthetic unit fails to track the treated unit before treatment -> Add donors / predictors, lengthen the pre-period, or use a bias-corrected estimator (sdid, augsynth); Placebo / permutation inference shows the estimate is not extreme relative to donors -> Report the placebo distribution honestly; the effect may not be distinguishable from noise. Alternatives: sp.sdid, sp.augsynth, sp.gsynth, sp.callaway_santanna. Typical minimum N: 15. |
| robustness_reportC | Run an automated battery of robustness checks. |
| romano_wolfB | Romano-Wolf stepdown adjusted p-values for multiple outcomes. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| rosenbaum_boundsC | Compute Rosenbaum bounds on a paired observational study. |
| rosenbaum_gammaB | Compute Rosenbaum bounds on a paired observational study. |
| sbwA | Stable Balancing Weights (Zubizarreta 2015) with optional ATT/ATE Validation: certified parity evidence. Assumptions: Unconfoundedness: treatment is as-good-as-random given the measured covariates; Overlap / common support: every unit has a non-degenerate probability of each treatment; The covariate set blocks all back-door paths. Pre-conditions: Pre-treatment covariates measured for treated and control units; A binary (or low-cardinality) treatment indicator; Sufficient covariate overlap between treatment arms. Failure modes: Poor overlap -- extreme propensity scores or few acceptable matches -> Trim or restrict to the common-support region and report the discarded units; Covariate imbalance remains after matching/weighting -> Re-specify the balancing model (CBPS, entropy balancing) and re-check standardized mean differences. Alternatives: sp.propensity_score, sp.cbps, sp.ebalance, sp.dml. Typical minimum N: 200. |
| sc_estimateA | R-style alias: |
| scdataC | Prepare data matrices for synthetic control estimation. |
| scestA | Estimate synthetic control weights. Assumptions: A convex (or regularized) combination of donor units reproduces the treated unit's pre-treatment outcome path; No interference: the treatment does not affect the donor units (SUTVA); No anticipation before the treatment date. Pre-conditions: Panel of one or more treated units plus an untreated donor pool, observed over time; Pre-treatment window long enough to fit donor weights (rule of thumb: more pre-periods than donors used); Outcome observed for every unit in every period. Failure modes: Large pre-treatment RMSPE -- the synthetic unit fails to track the treated unit before treatment -> Add donors / predictors, lengthen the pre-period, or use a bias-corrected estimator (sdid, augsynth); Placebo / permutation inference shows the estimate is not extreme relative to donors -> Report the placebo distribution honestly; the effect may not be distinguishable from noise. Alternatives: sp.sdid, sp.augsynth, sp.gsynth, sp.callaway_santanna. Typical minimum N: 15. |
| sciganA | Adversarial dose-response estimator (Bica et al. 2020). Assumptions: Unconfoundedness given covariates X for the continuous treatment; Positivity over the dose support; The adversarial generator recovers the counterfactual dose distribution (Bica et al. 2020). Pre-conditions: data with a continuous treatment (dose), outcome and covariates; torch is installed (neural extra) -- imported lazily. Failure modes: Unstable adversarial training -- dose-response estimates vary across seeds -> Average across seeds or use the smoother varying-coefficient estimator. Alternatives: sp.vcnet, sp.dose_response. Typical minimum N: 500. |
| scpiA | Prediction intervals for synthetic control methods. Cost: Prediction intervals come from a simulation step on top of the point fit, so runtime is dominated by the number of simulations rather than n. cores= parallelises it. Assumptions: A convex (or regularized) combination of donor units reproduces the treated unit's pre-treatment outcome path; No interference: the treatment does not affect the donor units (SUTVA); No anticipation before the treatment date. Pre-conditions: Panel of one or more treated units plus an untreated donor pool, observed over time; Pre-treatment window long enough to fit donor weights (rule of thumb: more pre-periods than donors used); Outcome observed for every unit in every period. Failure modes: Large pre-treatment RMSPE -- the synthetic unit fails to track the treated unit before treatment -> Add donors / predictors, lengthen the pre-period, or use a bias-corrected estimator (sdid, augsynth); Placebo / permutation inference shows the estimate is not extreme relative to donors -> Report the placebo distribution honestly; the effect may not be distinguishable from noise. Alternatives: sp.sdid, sp.augsynth, sp.gsynth, sp.callaway_santanna. Typical minimu... |
| sdidA | Synthetic Difference-in-Differences estimator (and SC / DID variants). Validation: certified parity evidence. Do NOT use when: there is no clean pre-treatment block for every unit -- the unit and time weights are fit on the pre-period grid. Cost: Placebo / bootstrap standard errors refit the full weighting problem n_reps times; the point estimate alone is cheap. Lower n_reps while iterating. Assumptions: Parallel trends in the absence of treatment, after the synthetic/DiD weighting; No anticipation and no interference between units (SUTVA); The control pool's outcome process is stable around the intervention. Pre-conditions: Panel with treated and control units and a clear treatment date; Pre-treatment periods available to assess comparability of trends. Failure modes: Weighted pre-treatment trends still diverge between treated and synthetic control -> Inspect the unit/time weights and pre-trend fit; consider event-study DiD with honest bounds. Alternatives: sp.synth, sp.augsynth, sp.callaway_santanna, sp.gardner_did. Typical minimum N: 15. |
| select_pci_proxiesA | Score and rank candidate proxies for PCI. Assumptions: The proxies are valid negative controls (relevant to the confounder, excluded from the causal channel); A bridge function exists (completeness conditions hold). Pre-conditions: Treatment-inducing and outcome-inducing proxy variables (negative controls) for the unobserved confounder. Failure modes: Proxies are weak or invalid -- the bridge function is poorly identified -> Test proxy relevance, select stronger proxies, or fall back to sensitivity analysis. Alternatives: sp.select_pci_proxies, sp.dml. Typical minimum N: 500. |
| selection_boundsA | Lee (2009) bounds for ATE under sample selection, optionally Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Only weak (set-identifying) assumptions are imposed; the result is an interval, not a point; Lee bounds add monotonicity of selection; Oster's delta adds proportional selection on observed vs. unobserved. Pre-conditions: The data needed for the point-identifying analysis, plus the weakest credible identifying restriction; For Lee bounds: a binary selection/attrition indicator. Failure modes: Bounds are too wide to be informative -> Add a credible auxiliary restriction (monotone treatment response, instrument) to tighten the bounds. Alternatives: sp.oster_delta, sp.lee_bounds, sp.manski_bounds. Typical minimum N: 100. |
| sensemakrA | Sensitivity analysis for omitted variable bias (Cinelli & Hazlett 2020). Validation: certified parity evidence. Assumptions: Cinelli-Hazlett (2020) omitted-variable sensitivity in the partial-R-squared framework; the Robustness Value is the minimum partial R-squared a confounder needs with both treatment and outcome to nullify the estimate; Outcome is modeled by OLS of y on treat plus observed controls; benchmarking calibrates confounder strength relative to named observed controls; rv_q is the RV to change the point-estimate sign; rv_qa is the RV to lose significance at alpha. Pre-conditions: A DataFrame with outcome, treatment, and observed control columns; At least one control to anchor the benchmark comparison. Failure modes: Benchmark names a control not present in the controls list or data -> Pass benchmark names that are a subset of the controls actually included in the regression; Perfectly collinear controls make the partial-R-squared decomposition unstable -> Drop redundant collinear controls before computing the robustness value. Alternatives: sp.oster_bounds, sp.evalue, sp.unified_sensitivity. Typical minimum N: 50. |
| sensitivityA | Unified sensitivity analysis for observational causal estimates -- supports Oster (2019) delta/R-max, Cinelli-Hazlett (2020) omitted-variable bias bounds, and E-values (VanderWeele-Ding 2017). Tells the agent how strong an unobserved confounder would have to be to overturn the result. |
| sensitivity_dashboardD | Comprehensive multi-dimensional sensitivity analysis. |
| sensitivity_from_resultA | Run sp.sensitivity / sp.evalue / sp.oster_bounds / sp.sensemakr on a cached result. Pass method='evalue' (default) for the omitted-confounder-strength bound, 'oster' for delta/R-max, 'cinelli_hazlett' for OVB bounds. |
| sensitivity_plotC | Plot Rambachan & Roth (2023) sensitivity analysis. |
| sensitivity_rrA | Rambachan-Roth (2023) honest-DiD sensitivity analysis: computes the largest violation of parallel trends (parametrised by Mbar -- relative magnitude of the post-period violation versus the worst observed pre-period one) under which the post-treatment ATT is still different from zero at level alpha. Reports both the robust confidence sets and the breakdown Mbar. Assumptions: Pre-period violations bound the magnitude of post-period violations (relative-magnitude family); Post-treatment effects are constant across event time (relax via alternative parameter families in Rambachan-Roth 2023 Section 3). Pre-conditions: result has at least one pre-period and one post-period coefficient; result carries the variance-covariance matrix of those coefficients. Failure modes: Breakdown Mbar < 1.0 (small parallel-trends violation overturns the sign) -> The result is fragile to plausible pretrends violations; report the breakdown alongside the point estimate; Confidence set is the entire real line (Mbar grid too coarse) -> Re-run with a finer grid (n_grid=50+) or restrict Mbar to a tighter interval. Alternatives: sp.honest_did, sp.pretrends_test, sp.breakdown_m. Typical minimum N: 50. |
| sequential_sdidA | Sequential Synthetic DID for staggered-adoption panels (Arkhangelsky & Samkov 2024): processes cohorts in adoption order using not-yet-treated donors, avoiding TWFE negative weights and SDID overlap failures. Assumptions: Parallel trends in the absence of treatment, after the synthetic/DiD weighting; No anticipation and no interference between units (SUTVA); The control pool's outcome process is stable around the intervention. Pre-conditions: Panel with treated and control units and a clear treatment date; Pre-treatment periods available to assess comparability of trends. Failure modes: Weighted pre-treatment trends still diverge between treated and synthetic control -> Inspect the unit/time weights and pre-trend fit; consider event-study DiD with honest bounds. Alternatives: sp.synth, sp.augsynth, sp.callaway_santanna, sp.gardner_did. Typical minimum N: 15. |
| sessionC | Set every reachable RNG to a known seed for the duration of the |
| shapley_inequalityC | Shorrocks-Shapley decomposition of an inequality index across Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| snipsA | Self-normalised IPS (bias-reduction for large IS weights). Assumptions: Same identification conditions as IPS (known propensities, positivity, no unmeasured confounding); Self-normalisation trades a small bias for large variance reduction under heavy importance weights. Pre-conditions: X (context), A (logged action), R (reward) and logging propensities are available. Failure modes: Residual bias when effective sample size is tiny (few logged actions overlap the target policy) -> Collect more on-support logged data or switch to the doubly-robust estimator. Alternatives: sp.ips, sp.doubly_robust, sp.direct_method. Typical minimum N: 500. |
| source_decomposeC | Lerman-Yitzhaki (1985) Gini source decomposition. Validation: certified parity evidence. |
| spec_curveA | Specification-curve analysis (Simonsohn et al. 2020): enumerates every combination of model choices the user declares defensible, runs them all, and returns the sign/magnitude distribution. Use when an agent needs to report robustness across a researcher-degree-of-freedom multiverse. |
| spilloverA | Direct + spillover treatment effect estimation under partial interference (within-cluster). Uses the Hudgens-Halloran decomposition with chosen exposure function. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Partial interference: spillover only within cluster, not across; Correct exposure function (fraction / any / count -- sensitivity tested); Overlap: every (treatment x exposure) cell has positive probability. Pre-conditions: data has a cluster column defining the interference boundary; treatment varies within clusters; >= 30 clusters for cluster-robust inference. Failure modes: No within-cluster variation in treatment -> Assignments are cluster-level -- use sp.cluster_matched_pair or cluster-level ATE; Exposure function misspecified -> Compare estimates under exposure_fn in {fraction, any, count}. Alternatives: sp.network_exposure, sp.cluster_matched_pair, sp.peer_effects. Typical minimum N: 500. |
| spillover_didA | Butts spillover-ring DiD. The usual fix -- a spatial lag of treatment in a TWFE regression -- measures the direct effect against controls the spillover already reached. This sorts untreated units by distance to the nearest treated unit into spillover rings plus CLEAN controls beyond every ring, and estimates the direct effect and each ring's effect against the clean controls only. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Known limitations: there is no reference implementation, so this carries design-recovery evidence only and no cross-language parity; ring boundaries are the analyst's choice; there is no selector, and a too-wide outer ring silently contaminates the clean controls; covariate adjustment is not implemented. Assumptions: Parallel trends between each group and the clean controls; Spillovers vanish beyond the outermost ring; No anticipation. Pre-conditions: unit positions or a distance matrix; some untreated units beyond the outermost ring. Failure modes: No clean controls -> Every untreated unit is inside a ring. Narrow ring_edges or widen the study area; Ring effects do not decay with distance -> The outer... |
| sqregC | Simultaneous quantile regression at multiple quantiles. Validation: certified parity evidence. |
| stabilized_weightsA | Compute stabilized IPTW weights for time-varying treatments. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Sequential exchangeability / no unmeasured confounding at each time point; Positivity: every treatment level is possible given the past; Correct specification of the treatment and/or outcome models. Pre-conditions: Sequentially measured covariates, (time-varying) treatment, and outcome; Models for the treatment process and the outcome (or weights). Failure modes: Stabilized weights have extreme values (positivity near-violation) -> Truncate weights, simplify the treatment model, or use a doubly-robust estimator (TMLE). Alternatives: sp.tmle, sp.g_computation, sp.ipw. Typical minimum N: 300. |
| stacked_didA | Stacked DiD (Cengiz, Dube, Lindner, Zipperer 2019). For each treatment cohort, constructs a sub-experiment with only that cohort + clean (never-treated or not-yet-treated) controls, then TWFE on the stacked panel. Robust to staggered-adoption contamination at the cost of dropping late-treated units in early sub-experiments. Validation: certified parity evidence. Do NOT use when: there is a single adoption cohort -- stacking produces one sub-experiment and is equivalent to sp.did(method='2x2'). Cost: Duplicates rows into one sub-experiment per treated cohort: the stacked dataset is roughly O(n x number of cohorts) before the event window trims it. Narrow window= to bound memory. Assumptions: Parallel trends within each sub-experiment; No anticipation within window; SUTVA. Pre-conditions: staggered adoption with >= 2 cohorts; window horizon available per cohort (else dropped). Failure modes: No clean controls for the latest cohort -> Late cohort's sub-experiment is dropped; check coverage in model_info. Consider sp.callaway_santanna. Alternatives: sp.callaway_santanna, sp.sun_abraham, sp.did_imputation. Typical minimum N: 100. |
| staggered_csA | Callaway-Sant'Anna's estimand with design-based inference (Roth & Sant'Anna 2023). Same weights as sp.callaway_santanna -- every not-yet-treated cohort is a control -- but the standard error comes from random adoption timing rather than parallel trends. Use when timing was randomised and you want the familiar CS estimand; use sp.callaway_santanna when it was not. Units already treated in the first period are dropped, since ATT(g,t) is not identified for them. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Do NOT use when: adoption timing was not randomised -- use sp.callaway_santanna, whose inference rests on parallel trends instead. Assumptions: treatment timing is randomly assigned; balanced panel. Pre-conditions: balanced panel with at least two cohorts. Alternatives: sp.staggered_rollout, sp.staggered_sa, sp.callaway_santanna. Typical minimum N: 50. |
| staggered_rolloutA | Efficient DiD for a randomised staggered rollout (Roth & Sant'Anna 2023). Identifies off random adoption timing, not parallel trends, so it is the right estimator for policy lotteries, phased launches and wave-randomised RCTs -- and the wrong one for observational rollouts. Uses the cohort's pre-treatment moments as optimal controls; efficient=False gives the plug-in. Validation: certified parity evidence. Do NOT use when: adoption timing was not randomised -- use a parallel-trends estimator such as sp.callaway_santanna instead. Assumptions: treatment timing is randomly assigned (this is the identifying assumption; parallel trends is neither assumed nor sufficient); balanced panel. Pre-conditions: balanced panel with at least two cohorts; single-unit cohorts are dropped with a warning, matching R staggered: their within-cohort covariance is not estimable. Alternatives: sp.callaway_santanna, sp.did_imputation, sp.sun_abraham. Typical minimum N: 50. |
| staggered_saA | Sun-Abraham's estimand with design-based inference (Roth & Sant'Anna 2023). Identical to sp.staggered_cs except that only the last-treated cohort serves as control, which is what Sun & Abraham's interaction-weighted estimator does. Inference identifies off random adoption timing, not parallel trends. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Do NOT use when: adoption timing was not randomised -- use sp.sun_abraham, whose inference rests on parallel trends instead. Assumptions: treatment timing is randomly assigned; balanced panel. Pre-conditions: balanced panel with at least two cohorts. Alternatives: sp.staggered_rollout, sp.staggered_cs, sp.sun_abraham. Typical minimum N: 50. |
| staggered_synthA | Staggered Adoption Synthetic Control. Assumptions: A convex (or regularized) combination of donor units reproduces the treated unit's pre-treatment outcome path; No interference: the treatment does not affect the donor units (SUTVA); No anticipation before the treatment date. Pre-conditions: Panel of one or more treated units plus an untreated donor pool, observed over time; Pre-treatment window long enough to fit donor weights (rule of thumb: more pre-periods than donors used); Outcome observed for every unit in every period. Failure modes: Large pre-treatment RMSPE -- the synthetic unit fails to track the treated unit before treatment -> Add donors / predictors, lengthen the pre-period, or use a bias-corrected estimator (sdid, augsynth); Placebo / permutation inference shows the estimate is not extreme relative to donors -> Report the placebo distribution honestly; the effect may not be distinguishable from noise. Alternatives: sp.sdid, sp.augsynth, sp.gsynth, sp.callaway_santanna. Typical minimum N: 15. |
| stepwiseC | Stepwise variable selection for OLS regression. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| stochastic_dominanceC | Test for stochastic dominance of the treated distribution over the Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| structural_breakC | Structural break detection. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| subcluster_wild_bootstrapB | Subcluster wild cluster bootstrap for few-treated-clusters. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). |
| subgroup_analysisB | Run subgroup heterogeneity analysis with forest plot. |
| subgroup_decomposeC | Subgroup decomposition (between / within) of an inequality index. Validation: certified parity evidence. |
| sun_abrahamA | Sun-Abraham (2021) interaction-weighted event-study. Fixes the contamination in dynamic event-study TWFE coefficients from other relative-time bins by using cohort-specific interaction weights. Canonical companion to Callaway-Sant'Anna for event studies. Validation: certified parity evidence. Do NOT use when: all units adopt treatment simultaneously -- the cohort x relative-time interactions collapse; use sp.did(method='2x2'); cohorts are very small (a handful of units each) -- interaction-weighted estimates become noisy and the cohort-share weights unstable. Cost: Builds a saturated cohort x relative-time interaction design: columns grow as (cohorts x event-time window), so a wide window on a many-cohort panel produces a large dense design matrix. Trim via event_window=. Assumptions: Parallel trends across cohorts; No anticipation within event_window lead horizon; SUTVA. Pre-conditions: panel with unit x time x outcome; g is the first-treatment period (int), 0 / NaN for never-treated; >= 2 pre-periods per cohort for event-study leads. Failure modes: No never-treated cohort when control_group='nevertreated' -> Pass control_group='notyettreated' or add never-treated units; Pre-tren... |
| super_learnerA | Fit a Super Learner ensemble. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Unconfoundedness (sequential exchangeability for longitudinal/LTMLE); Positivity / overlap of treatment given history; At least one nuisance (outcome or treatment) is estimated consistently; the targeting step gives double robustness. Pre-conditions: Covariates, treatment, and outcome (for survival/longitudinal variants: time-to-event and time-varying covariates); Enough data to fit a Super Learner / HAL nuisance library. Failure modes: Near-positivity violations create extreme clever-covariate weights -> Truncate weights, restrict the estimand, or report a positivity diagnostic. Alternatives: sp.dml, sp.ipw, sp.g_computation. Typical minimum N: 400. |
| suregC | Seemingly Unrelated Regression (SUR). Validation: certified parity evidence. |
| survival_sensitivityA | Nonparametric sensitivity for survival / hazard-ratio outcomes. |
| survivor_average_causal_effectA | Zhang-Rubin (2003) sharp bounds on the Survivor Average Causal Effect. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Assumptions: Sequential exchangeability / no unmeasured confounding at each time point; Positivity: every treatment level is possible given the past; Correct specification of the treatment and/or outcome models. Pre-conditions: Sequentially measured covariates, (time-varying) treatment, and outcome; Models for the treatment process and the outcome (or weights). Failure modes: Stabilized weights have extreme values (positivity near-violation) -> Truncate weights, simplify the treatment model, or use a doubly-robust estimator (TMLE). Alternatives: sp.tmle, sp.g_computation, sp.ipw. Typical minimum N: 300. |
| survregC | Parametric survival model (AFT parameterization). Validation: certified parity evidence. |
| synthA | Unified synthetic control estimator. method= selects variant: 'classic', 'demeaned', 'detrended', 'unconstrained', 'elastic_net', 'augmented', 'sdid', 'gsynth', 'staggered'. inference= selects: 'placebo', 'conformal', 'bootstrap', 'jackknife'. Validation: certified evidence with scoped limitations. Known limitations: Classical SCM certification is specification-specific: ADH/Synth parity requires passing the same special_predictors recipe; the default outcome-only V=I path is a documented Kaul-style convention; Default native classical SCM can differ from Synth on Basque-style panels by a documented local-optimum convention (the outer V optimisation has multiple near-equivalent minima); use backend='synth' or canonical special_predictors when exact R parity is required. Do NOT use when: many units are treated at once -- classic SCM is built for one (or few) treated units; use sp.gsynth, sp.sdid or sp.callaway_santanna; the pre-treatment window is short (fewer than ~10 periods) -- the donor weights overfit noise and pre-period fit stops being evidence; the treated unit's pre-period outcome lies outside the convex hull of the donors -- no non-negative weighting can match it; check t... |
| synth_compareA | Run multiple SCM variants and compare them side by side. Cost: Runs every estimator in methods= end to end, so cost is the sum of the individual fits -- and each placebo-enabled member internally re-runs once per donor. Expect it to be the slowest call in a synthetic-control workflow; narrow methods= once you have shortlisted. |
| synth_donor_sensitivityB | Donor-pool bootstrap sensitivity for Synthetic Control. |
| synth_looC | Leave-one-out donor sensitivity for Synthetic Control. |
| synth_mdeB | Minimum Detectable Effect for a Synthetic Control design. |
| synth_powerB | Power analysis for Synthetic Control designs. |
| synth_power_plotA | Plot the power curve from :func: |
| synth_recommendB | Quickly recommend the best SCM method for the given data. |
| synth_reportC | Generate a comprehensive Synthetic Control analysis report. |
| synth_report_to_fileC | Generate an SCM report and write it directly to a file. |
| synth_rmspe_filterC | Pre-RMSPE-filtered p-value robustness (Abadie et al. 2010). |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| audit_did_result | Run a DID estimator on a CSV, surface the estimate, and walk through every reviewer-checklist gap. Uses pipeline_did to consolidate preflight + estimate + audit + honest-DID + Bacon into one call. |
| audit_iv_result | End-to-end IV workflow: 2SLS + first-stage F + Anderson-Rubin CI + e-value sensitivity, all wrapped in pipeline_iv. |
| audit_rd_result | End-to-end RD workflow: rdrobust + rdplot (image content) + density test + bandwidth sensitivity via pipeline_rd. |
| design_then_estimate | Given an unfamiliar CSV, auto-detect the study design, recommend an estimator, run it with diagnostics. |
| robustness_followup | Take an existing fitted result handle and run all high-importance follow-up sensitivities the audit identifies as missing. |
| paper_render | Compose a paper-style memo from a fitted result handle: estimate, diagnostics, robustness, BibTeX. The output is a ready-to-paste markdown section. |
| compare_methods | Run two or more estimators on the same data and compare conclusions side by side. |
| policy_evaluation | Causal-forest-driven policy evaluation: fit causal_forest, summarise CATE, evaluate a candidate policy. |
| synth_full | End-to-end Synthetic Control workflow: synth fit + placebo + synthdid + permutation. |
| decompose_inequality | RIF / FFL / Oaxaca-Blinder decomposition of an outcome gap. |
| stata_command_workflow | Translate one Stata command, run the matched StatsPAI tool on the supplied data, then audit the fitted result. Use when a user pastes commands such as reghdfe, csdid, rdrobust, ivreg2, synth, psmatch2, or teffects workflows. |
| r_command_workflow | Translate one R / fixest / felm / did expression, run the matched StatsPAI tool on the supplied data, then audit the result. Use for users migrating R code into the MCP loop. |
| cross_language_command_check | Compare one Stata command and one R expression through StatsPAI's translators before fitting. This is a cheap guard against Stata/R snippets targeting different estimands or covariance conventions. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| StatsPAI estimator catalog | Markdown list of every registered StatsPAI estimator with its description and a pointer to the per-function agent-card URI pattern. |
| StatsPAI tool index (machine-readable) | JSON array of {name, description} entries. Read this once during session setup to enumerate available tools. |
| StatsPAI result output schema | JSON Schema for the agent-facing result envelope returned by every tools/call (estimate / std_error / conf_int / method / diagnostics / violations / next_steps / citations / error …). Each tool's outputSchema points here for the full field-by-field reference. |
| StatsPAI Track A parity summary | Machine-readable summary of committed Python/R/Stata parity evidence: strictness-tier counts, module ids, Stata commands, and convention notes where available. This summarizes artifacts; it is not a live external Stata/R run. |
TDQS
Scored across 548 tools
Hundreds of tools are exact or near-exact duplicates: bjs is the same estimator as borusyak_jaravel_spiess and did_imputation; gardner_did duplicates did_2stage; frontdoor duplicates front_door; rosenbaum_bounds and rosenbaum_gamma share identical descriptions; postestimation_contract and postestimation_report are identical; and there are dozens of R-style or article-facing aliases (synthdid_estimate, sc_estimate, did_estimate, xlearner, psm). An agent cannot reliably distinguish the intended tool among so many overlapping aliases and variants.
Names are mostly snake_case, but the convention is inconsistent: some are concise verbs (did, regress, test, contrast), some are bare nouns (bridge, panel, rate), some are R-package aliases (synthdid_estimate, did_estimate), and some use different spellings of the same concept (frontdoor vs front_door, psm vs psmatch2 vs match). Abbreviated and opaque names like discos, megamma, sqreg, and rlassologit_effects break any predictable verb_noun pattern.
548 tools is an extreme mismatch for any server purpose, far beyond even the 50+ upper bound. The surface is a sprawling econometrics library rather than a curated decision-agent toolset, and an agent would face a prohibitive selection problem before doing any actual analysis.
For the causal-inference domain, coverage is effectively exhaustive: DiD (2x2, staggered, continuous, DDD, event studies), RD (sharp/fuzzy/multi-cutoff/bunching), IV (k-class, weak-instrument, shift-share, MR), synthetic control variants, matching and weighting, mediation, decompositions, sensitivity analysis, survival, time series, CATE/meta-learners, causal discovery, and offline policy learning are all represented. There are no obvious methodological gaps; the problem is surplus, not scarcity.