crabbymetrics
crabbymetrics is a Rust-backed econometrics library with a compact Python API. The docs are organized around the public estimator surface, a single binding crash course, focused numerical ablations, and a small set of supporting internals pages.
Start Here
- API reference: verified public surface, summary schemas, optimizer catalog, and runtime smoke checks.
- Binding Crash Course: OLS: the shortest end-to-end walkthrough of the Rust-to-Python wrapper pattern in this codebase.
Estimator Examples
- OLS: baseline linear regression with switchable vanilla and HC1 covariance estimators.
- Fixed Effects OLS: partial out one-way or multi-way categorical fixed effects with
within, then estimate slopes without an intercept. - ElasticNet: regularized linear regression.
- Synthetic Control: simplex-constrained donor weighting for treated-versus-donor panel matching under latent-factor drift.
- Logit: binary logistic regression.
- Multinomial Logit: multiclass classification.
- Poisson: count regression, with model-based or QMLE sandwich inference available from
summary(vcov=...). - TwoSLS: instrumental variables regression, including multiple endogenous regressors and multiple excluded instruments.
- GMM: fit just-identified score equations, overidentified two-step IV moments, and stacked nuisance-parameter moments with the first-class
GMMestimator. - FTRL: online-style binary classification.
- MEstimator Poisson: callback-driven estimation matched against the built-in Poisson estimator.
Ablations
- Variance Estimators: cached Monte Carlo coverage experiments for OLS, Poisson, and GMM variance estimators under heteroskedasticity or overdispersion.
Optimization
- Optimizers: direct optimizer usage for smooth likelihoods, rougher objective surfaces, and solver behavior comparisons.
- GMM With Optimizers: the lower-level notebook that motivated the first-class
GMMestimator and still shows the residual-collection view directly.
Supporting Pages
- Binding Internals: Poisson: a deeper built-in-estimator walkthrough after the OLS crash course.
- Binding Internals: MEstimator: the callback-heavy bridge where Rust owns optimization and Python supplies the objective and scores.
- PCA And Kernel Basis: transformer examples for richer design matrices.
- Richer Regression With Transformer Pipelines: a longer transformer-based modeling example built on
KernelBasisandPCA.
Runtime Snapshot
crabbymetrics, scikit-learn, and statsmodels. Lower is faster.The benchmark figure is generated from the repo-level benchmark assets in benchmarks/ and gives a quick scale check for the estimators that overlap cleanly with mainstream Python baselines.
Notes
api.qmdremains the main documentation page and renders toapi.html.- The site is a Quarto website, so shared navigation and search are generated under
docs/. - All pages are rendered with embedded resources so the checked-in HTML files remain self-contained.