Skip to content

Econometrust

High-performance econometric regression library written in Rust with Python bindings.

Overview

Econometrust provides optimized implementations of fundamental econometric estimators for applied research and production applications. The library combines computational efficiency with statistical rigor, offering comprehensive inference capabilities and robust numerical algorithms.

Core Estimators

  • OLS - Ordinary Least Squares with robust standard errors
  • Ridge - Ridge Regression with L2 regularization for multicollinearity
  • WLS - Weighted Least Squares for heteroskedastic models
  • GLS - Generalized Least Squares for correlated errors
  • IV - Instrumental Variables for endogeneity
  • TSLS - Two-Stage Least Squares for overidentified models
  • FE - Fixed Effects for panel data

Key Features

Statistical Capabilities - Comprehensive statistical inference (standard errors, t-tests, confidence intervals) - Multiple R-squared measures including adjusted R-squared - Professional summary output with diagnostic statistics - Robust and cluster-robust standard error options

Computational Performance - Rust-based backend for maximum speed - Memory-optimized algorithms with intelligent selection - Vectorized operations using optimized linear algebra - Numerically stable implementations with fallback methods

API Design - Consistent interface across all estimators
- Comprehensive type annotations and documentation - Error handling with informative diagnostics - Integration with NumPy ecosystem

Installation

pip install econometrust

Basic Usage

import numpy as np
import econometrust

# Generate data
X = np.random.randn(100, 3)
y = X @ [1.5, -2.0, 0.5] + np.random.randn(100) * 0.1

# Fit model
model = econometrust.OLS(fit_intercept=True, robust=True)
model.fit(X, y)

# Results
print(f"R-squared: {model.r_squared:.4f}")
print(f"Adjusted R-squared: {model.r_squared_adj:.4f}")
print(model.summary())

Documentation

Getting Started

API Reference

  • Overview - Method comparison and selection guide
  • Individual estimator documentation with mathematical foundations

Estimator Selection Guide

Data Structure Recommended Method Key Requirement
Cross-sectional, no heteroskedasticity OLS Homoskedastic errors
Multicollinearity or overfitting concerns Ridge Need for regularization
Known heteroskedasticity WLS Specified weights
Serial/spatial correlation GLS Known covariance structure
Endogenous regressors (exact ID) IV Valid instruments
Endogenous regressors (over ID) TSLS Multiple instruments
Panel data FE Entity-time structure