Skip to main content

empfin - Empirical Finance Tools in Python

empfin is a Python toolkit for empirical asset pricing models and risk premia estimation. This library is in active development and aims to implement models from all corners of the literature.

What's Inside

Currently available models for estimation of risk premia:

  • TimeseriesReg: single-pass OLS time-series regression, described in Cochrane (2005), Section 12.1
  • CrossSectionReg: two-pass cross-sectional regression, described in Cochrane (2005), Section 12.2. Includes options for OLS and GLS estimators.
  • NonTradableFactors: iterative maximum-likelihood estimator for non-tradable factors, described in Campbell, Lo & MacKinlay (2012), Section 6.2.3
  • FamaMacBeth: classical two-pass Fama-MacBeth regression, with optional rolling-window first pass, Newey-West HAC standard errors, and Shanken (1992) errors-in-variables correction, from Fama & MacBeth (1973)
  • RiskPremiaTermStructure: term structure of risk premia with a single factor, tradable or not, following Bryzgalova, Huang & Julliard (2024). I would like to thank the authors for sharing their replication files.
  • ConditionalRiskPremiaTermStructure: conditional, VAR-augmented version of the term-structure estimator, from Bryzgalova, Huang & Julliard (2024).
  • Bayesian Fama-MacBeth Regressions from Bryzgalova, Huang & Julliard (2024):
    • BFM: Bayesian Fama-MacBeth (BFM-OLS), which replaces the two-pass point estimates with a posterior distribution over the risk premia
    • BFMGLS: GLS variant of the Bayesian Fama-MacBeth, which uses the idiosyncratic-error precision matrix in the cross-sectional step
    • BFMOMIT: variant of the Bayesian Fama-MacBeth that is robust to omitted factors by projecting onto the principal components of the asset-return covariance

Examples

For each model, there is a jupyter notebook with examples of their use.

Installation

pip install empfin

References

Bryzgalova, Huang, and Julliard (2024) Bayesian Fama-MacBeth Regressions) Working Paper

Bryzgalova, Huang, and Julliard (2024) Macro Strikes Back: Term Structure of Risk Premia Working Paper

Cochrane (2005) "Asset Pricing: Revised Edition". Princeton University Press.

Campbell, Lo, and MacKinlay (2012) "The Econometrics of Financial Markets"

Fama and MacBeth (1973) "Risk, Return, and Equilibrium: Empirical Tests" Journal of Political Economy, 81(3), 607-636

Library Citation

Gustavo Amarante (2026). empfin - Empirical Finance Tools in Python. Retrieved from https://github.com/gusamarante/empfin

Release files for empfin 3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for empfin 3.0
File Size Uploaded
empfin-3.0.tar.gz 33.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for empfin 3.0
File Interpreter ABI Platform
empfin-3.0-py3-none-any.whl Python 3 none any Details

Total release size:66.9 kB

Release files / empfin-3.0.tar.gz

Download URL empfin-3.0.tar.gz
Size 33.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8b6fedbe960c7d059cca23a54e43c271a566e023e6de309951765d2b99ccc0e9
BLAKE2b-256 checksum
How to use checksums
191904567aa07916fe741711af000242adc82d6f6f1daa7a9ece8f2858a702da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Release files / empfin-3.0-py3-none-any.whl

Download URL empfin-3.0-py3-none-any.whl
Size 33.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9106e66e8fa70f47c962f28ac982a476992304ad8c01bd99fdc93486381138ea
BLAKE2b-256 checksum
How to use checksums
12cb0d041369c1969dab5f897102eeb7b6c3def4215c43bf563e9d14c6bb106a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.0 This release

2 release files

2.3

2 release files

2.2

2 release files

2.1

2 release files

2.0

2 release files

1.10

2 release files

1.9

2 release files

1.8

2 release files

1.7

2 release files

1.6

2 release files

1.5

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page