StatsPAI
16 Nov 2026 · Re-tested every Monday
io.github.brycewang-stanford/statspai
StatsPAI 1.43.1 is Audited (re-tested 16 Nov 2026). In our sandbox, with the network off, it completed the MCP handshake in 9.7 s and listed 45 tools, including audit, audit_result and bacon_decomposition. All 8 checks passed: 0 known advisories, no install scripts, no credential patterns in the package, MIT license. Context cost: about 17,600 tokens.
Econometrics and causal inference (DiD, IV, RD, synthetic control, DML) with Stata/R parity grades
Tools (45)
Context cost: ~17,600 tokens (45 tools) how measured
- audit 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-import
- audit_result Reviewer-grade audit of a fitted result (result_id from an as_handle=true call): every robustness check the literature expects for the design, with status 'passed|failed|missing|not_applicable' and a suggest_function for each missing one. n
- bacon_decomposition 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 trus
- bibtex 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
- brief One-line brief of a fitted result (estimand, estimate, SE, CI, N). Same output as brief_result.
- brief_result 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.
- call_function Run ANY registered StatsPAI function by name with keyword arguments -- the escape hatch for the ~1,200 functions that are not individually listed as tools. `arguments` follows the parameter schema from describe_function; column names refer
- callaway_santanna 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-tr
- causal 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.
- check_identification Design-level identification diagnostics: bad controls, overlap, cohort sizes, IV first-stage F, clustering. Run BEFORE fitting any estimator to surface design problems.
- cross_validate 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 reproduci
- describe_data Profile a dataset (data_id, data_path or inline data): shape, dtypes, missing counts, head, numeric summary and -- for a handle -- the lineage of transforms that produced it.
- describe_function Full machine-readable metadata for one registered StatsPAI function: JSON-Schema parameters (types, defaults, enums), assumptions, pre-conditions, failure modes, alternatives, validation tier and evidence notes, plus the accepted keyword al
- detect_design 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
- did Difference-in-differences dispatcher. 2x2 (two periods, 0/1 treat) when id is omitted; with id, a 0/1 indicator on a multi-period panel is converted to first-treatment cohorts and Callaway-Sant'Anna runs. Pass method= to force '2x2', 'cs',
- dml Double/debiased machine learning (Chernozhukov et al. 2018) with cross-fitting: partially linear (plr), interactive (irm, binary treatment), and the IV versions (pliv, iivm). Treatment effect under selection on observables with flexible nui
- ebalance 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.
- feols OLS with high-dimensional fixed effects (R fixest / Stata reghdfe syntax): 'y ~ x1 + x2 | unit + year'. IV as 'y ~ x | fe | d ~ z'. vcov: 'iid', 'hetero', or {'CRV1': 'cluster_col'} (two-way: 'a + b'). Validation: certified parity evidence.
- from_r 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. Va
- from_stata Translate a single Stata command to a verified StatsPAI tool-call payload. Returns ``python_code`` (string for chat replies) AND ``arguments`` (ready-to-dispatch JSON-RPC for tools/call). Tier-1 commands: regress / xtreg / reghdfe / ivreg2
- honest_did Rambachan-Roth (2023) 'honest' DID sensitivity analysis. Operates on a fitted event-study / DID result: pass ``result_id`` from a prior ``sp.event_study`` / ``sp.callaway_santanna`` / ``sp.did_imputation`` / ``sp.sun_abraham`` fit run with
- honest_did_from_result Rambachan-Roth (2023) honest CIs on a fitted DID / event-study result; betas and sigma are read off the result. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact).
- interpret_result Natural-language interpretation of a fitted result (result_id): the estimate, its uncertainty and what the design does / does not identify, grounded in the result's own numbers. Uses the client's model via MCP sampling when advertised (no A
- iv Instrumental-variables dispatcher: 2SLS, LIML, Fuller or GMM via method=, with first-stage, weak-IV (effective F) and endogeneity diagnostics. Formula 'y ~ x + (d ~ z1 + z2)'. Validation: certified parity evidence.
- ivreg 2SLS instrumental-variables regression with first-stage F diagnostics; classical SEs unless robust=. Formula syntax: 'y ~ x_exog + (d_endog ~ z_instrument)'. Validation: certified parity evidence.
- load_data Load a dataset into the server and get a data_id handle. Source: data_path (file or URL), data_records (JSON rows) or data_csv (CSV text). Returns the handle plus shape, dtypes, missing counts, the first rows and a numeric summary. Pass dat
- match Matching estimator dispatcher (ATT by default): nearest-neighbour on the propensity score or Mahalanobis distance, Abadie-Imbens nnmatch, CEM, optimal / full matching, kernel, radius, ... via method=. Returns balance diagnostics. Validation
- pipeline_did 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 eff
- pipeline_iv End-to-end IV workflow: ivreg -> first-stage F (effective + Olea-Pflueger) -> Anderson-Rubin CI -> e-value. Returns one markdown report + result_id.
- pipeline_rd 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_result Render a fitted result's diagnostic plot (event study, rdplot, synth gap, balance, ROC) as a PNG image block. Optional edits restyle it with the data locked.
- preflight 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-varia
- rdrobust 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: the weighted rbc bootstra
- recommend 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 t
- regress Fit an OLS regression; classical SEs unless robust= or cluster=. Input is a Wilkinson-style formula like 'y ~ x1 + x2'. Use this for baseline specifications or covariate-adjusted RCT analyses. Validation: certified parity evidence.
- route_estimator Route a research question to estimator calls without data. Give the family (did / iv / rd / matching / ml_causal / qte / dynamic_panel) and answers to its decision questions; get the matching registered functions with example calls, why eac
- sdid Synthetic difference-in-differences (Arkhangelsky et al. 2021): unit and time weights, one treated unit or block. Long panel; placebo / bootstrap / jackknife SEs. Validation: certified parity evidence.
- search_functions Search the StatsPAI function registry by task keywords or a short phrase (e.g. 'staggered adoption event study', 'weak instrument robust CI'). Returns ranked matches with one-line descriptions, category and validation tier. Use it when no l
- sensitivity 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 confou
- sensitivity_from_result Sensitivity of a cached fit (result_id). 'evalue' (default): E-value from the estimate. 'oster' (delta / R-max) and 'cinelli_hazlett' (OVB bounds) refit OLS of y on treat + controls on the fit's data: from a regress formula (name the term w
- spec_curve 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 acros
- sun_abraham Sun-Abraham (2021) interaction-weighted event study for staggered adoption (Stata eventstudyinteract, fixest sunab). Cohort column g = first-treatment period, 0 / NaN never treated. Validation: certified parity evidence.
- synth Synthetic control (Abadie et al.) and its variants through one entry: classic SCM with placebo inference, synthetic DiD, augmented / penalized SCM, generalized SC (gsynth), staggered adoption and more via method=. Panel in long format, one
- transform_data Derive a new dataset from a data_id (or data_path / inline data) by applying `operations` in order, and return a new data_id with the lineage recorded. Operations (each an object with `op`): query {expr} (pandas DataFrame.query), select {co
- vcov_from_result Standard errors of a cached fit (result_id) under another vce: re-runs the fit's own call with only vce= changed, so the SEs equal a direct refit. One vce returns the new result; a list returns a side-by-side table with the ratio to the fit
Install
uvx statspai==1.43.1
Version history
- : first listed at version 1.43.1, Audited
Audit report
Automated checks, not a security guarantee or a certification by any client. Payment never changes a score or a tier. How listings are checked.
- Version
- 1.43.1
- Audited
- 16 Nov 2026 · Re-tested every Monday
- Package
- pypi statspai
- Advisories
- 0 critical, 0 high, 0 medium, 0 low
- Time to ready
- 9689 ms
- Network
- Disabled
- Context cost
- ~17,600 tokens (45 tools) how measured
- Pass Version. Pinned pypi statspai@1.43.1
- Pass Known vulnerabilities
- Pass License. MIT
- Pass Install scripts
- Pass Credential patterns
- Pass Package size. 11.2 MB
- Pass Maintainer activity. Active 4 days ago.
- Pass Sandbox. MCP handshake completed. 45 tools listed.
Built for
Any MCP client.
Transports: stdio.
Links
Metadata checks
- Repository activity: Active in the last 180 days
- License: Recognized SPDX id
- Metadata quality: High
Audited by AddonAudit · 16 Nov 2026
Free to use; updates after each weekly re-test. Dark, HTML and self-hosted formats.
Badge
[](https://addonaudit.com/addon/io-github-brycewang-stanford-statspai/)
Seal
[](https://addonaudit.com/addon/io-github-brycewang-stanford-statspai/)