Skip to main content

Econometric Analysis of Nonlinear Panel Models with Individual and Time Effects

Project description

twowaypanel: Econometric Analysis of Nonlinear Panel Models with Individual and Time Effects

Python 3.8+ PyPI Docs PyTorch

twowaypanel is a Python package for bias-corrected estimation and inference in nonlinear panel data models with additive individual and time fixed effects.
It accompanies the paper:

Yan, Zizhong, Zhengyu Zhang, Mingli Chen, Jingrong Li, Iván Fernández-Val. (2026), Robust Priors in Nonlinear Panel Models with Individual and Time Effects. arXiv e-prints, arXiv:2604.03663.

Quick links

▶ Overview

Nonlinear panel models with additive individual and time effects are a workhorse in empirical economics. However, fixed-effects maximum likelihood estimation is subject to the incidental parameter problem, which can induce substantial finite-sample bias in both parameter estimates and economically relevant functionals (e.g., average partial effects).

twowaypanel provides bias-corrected estimation and inference for:

  • model parameters, and
  • average partial effects (APEs), for both continuous regressors and discrete regressors (finite changes).

The current release supports four model classes—binary logit, binary probit, multinomial logit, and ordered logit. The explanatory variables can be either strictly exogenous or predetermined (e.g., include lagged dependent variables to accommodate dynamic models).

▶ Documentation

User-facing documentation (tutorials, examples by model class, and API reference) is maintained on Read the Docs:

The documentation explains expected data formats, model options, and how to interpret the printed output tables (including APEs and, when relevant, MCMC diagnostics).

▶ Supported models and bias-correction methods

twowaypanel implements the likelihood-based bias-correction methods proposed in Yan et al. (2026), including:

  • Integrated-likelihood-based correction (via priors; “prior correction”), and
  • Joint-likelihood-based correction (via penalties; “penalty correction”). For logit and probit panels, the package also provides the analytical bias correction for fixed-effects MLE developed by Fernández-Val and Weidner (2016).
Model class Regressor exogeneity Generic prior / penalty Model-specific prior / penalty Analytical correction (FW16)
Binary logit Strict exogenous ✓ (Prior SE)
Binary logit Predetermined ✓ (Prior PE; Prior SE + analytical)
Binary Probit Strict exog. or predet.
Multinomial logit Strict exogenous ✓ (Prior SML)
Multinomial logit Predetermined ✓ (Prior PML)
Ordered logit Strict exog. or predet.

Notes.

  • Model-specific priors/penalties are defined in Yan et al. (2026) and are designed to deliver improved finite-sample performance within the corresponding model class.
  • The generic prior/penalty is intended to be robust across a broad class of nonlinear panel specifications; see Yan et al. (2026) for details and motivation.

▶ Installation

  1. Installation from PyPI (recommended)
pip install twowaypanel
  1. Install the development version from GitHub
git clone https://github.com/zizhongyan/twowaypanel.git
cd twowaypanel
pip install -e .
  1. Install from a local copy

If you downloaded the source code (e.g., as a ZIP file) and unzipped it locally, install from the repository root:

cd /path/to/twowaypanel
pip install -e .
  1. Jupyter / notebook users

To ensure the package is installed into the same environment as the current Jupyter kernel, run the following from the repository root directory:

%cd /path/to/twowaypanel
%pip install -e .

▶ Citing this work

Please cite both the underlying paper and the software package when using this code in your research.

  1. Paper

    • Yan, Zizhong, Zhengyu Zhang, Mingli Chen, Jingrong Li, Iván Fernández-Val (2026), “Robust priors in nonlinear panel models with individual and time effects.” arXiv e-prints, arXiv:2604.03663.
  2. Software

    • Yan, Zizhong, Zhengyu Zhang, Mingli Chen, Jingrong Li, Iván Fernández-Val (2026), “twowaypanel: A Python package for econometric analysis of nonlinear panel models with individual and time effects.“ (Version 0.9.4) [Computer software]. Source code: https://github.com/zizhongyan/twowaypanel.

References

  • Fernández-Val, Iván and Martin Weidner (2016), “Individual and time effects in nonlinear panel models with large N, T.” Journal of Econometrics, 192(1), 291–312.

Code maintainer: Zizhong Yan, Institute for Economic and Social Research (IESR), Jinan University, Guangzhou, China.
Email: helloyzz@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twowaypanel-0.9.5.tar.gz (71.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twowaypanel-0.9.5-py3-none-any.whl (84.3 kB view details)

Uploaded Python 3

File details

Details for the file twowaypanel-0.9.5.tar.gz.

File metadata

  • Download URL: twowaypanel-0.9.5.tar.gz
  • Upload date:
  • Size: 71.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for twowaypanel-0.9.5.tar.gz
Algorithm Hash digest
SHA256 6afe02730612a369648bfa0a31036103679e139dedebb863cb29e60aa68da7a0
MD5 86479d0efca6bdef152cb2ed264304b2
BLAKE2b-256 8c3fba7603ac3128a67bf069cccf51ca30e232063fea4b92391714df21a2d1e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for twowaypanel-0.9.5.tar.gz:

Publisher: python-publish.yml on zizhongyan/twowaypanel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file twowaypanel-0.9.5-py3-none-any.whl.

File metadata

  • Download URL: twowaypanel-0.9.5-py3-none-any.whl
  • Upload date:
  • Size: 84.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for twowaypanel-0.9.5-py3-none-any.whl
Algorithm Hash digest
SHA256 dded56a4d759dae8c5a521f4034df1c1ac3a308eac03eea1547c67f78f785367
MD5 dba116552c5618ce20e682f74bb9220b
BLAKE2b-256 f7524a0b56a458051d1d557fc90ef520c396c1019b37b586a358636611448618

See more details on using hashes here.

Provenance

The following attestation bundles were made for twowaypanel-0.9.5-py3-none-any.whl:

Publisher: python-publish.yml on zizhongyan/twowaypanel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page