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
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
- Paper: arXiv link
- Documentation (Read the Docs): twowaypanel.readthedocs.io
▶ 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:
- Documentation homepage: twowaypanel.readthedocs.io
- Tutorials: Quick Start and tutorial pages
- Examples gallery: Worked examples by model class
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
- Installation from PyPI (recommended)
pip install twowaypanel
- Install the development version from GitHub
git clone https://github.com/zizhongyan/twowaypanel.git
cd twowaypanel
pip install -e .
- 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 .
- 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.
-
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.
-
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.
- 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:
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6afe02730612a369648bfa0a31036103679e139dedebb863cb29e60aa68da7a0
|
|
| MD5 |
86479d0efca6bdef152cb2ed264304b2
|
|
| BLAKE2b-256 |
8c3fba7603ac3128a67bf069cccf51ca30e232063fea4b92391714df21a2d1e6
|
Provenance
The following attestation bundles were made for twowaypanel-0.9.5.tar.gz:
Publisher:
python-publish.yml on zizhongyan/twowaypanel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
twowaypanel-0.9.5.tar.gz -
Subject digest:
6afe02730612a369648bfa0a31036103679e139dedebb863cb29e60aa68da7a0 - Sigstore transparency entry: 1409445462
- Sigstore integration time:
-
Permalink:
zizhongyan/twowaypanel@4d93d845626ef6b4951f3238fa87d25423206cca -
Branch / Tag:
refs/heads/main - Owner: https://github.com/zizhongyan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@4d93d845626ef6b4951f3238fa87d25423206cca -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dded56a4d759dae8c5a521f4034df1c1ac3a308eac03eea1547c67f78f785367
|
|
| MD5 |
dba116552c5618ce20e682f74bb9220b
|
|
| BLAKE2b-256 |
f7524a0b56a458051d1d557fc90ef520c396c1019b37b586a358636611448618
|
Provenance
The following attestation bundles were made for twowaypanel-0.9.5-py3-none-any.whl:
Publisher:
python-publish.yml on zizhongyan/twowaypanel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
twowaypanel-0.9.5-py3-none-any.whl -
Subject digest:
dded56a4d759dae8c5a521f4034df1c1ac3a308eac03eea1547c67f78f785367 - Sigstore transparency entry: 1409445478
- Sigstore integration time:
-
Permalink:
zizhongyan/twowaypanel@4d93d845626ef6b4951f3238fa87d25423206cca -
Branch / Tag:
refs/heads/main - Owner: https://github.com/zizhongyan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@4d93d845626ef6b4951f3238fa87d25423206cca -
Trigger Event:
workflow_dispatch
-
Statement type: