Skip to main content

groupedpaneldatamodels: A Python Library for Grouped Fixed and Interactive Effects Models

groupedpaneldatamodels is an open‑source Python library that implements a collection of Grouped Panel Data Models (GPDMs) for econometric research.

groupedpaneldatamodels is an Open Source Python library that implements multiple Grouped Panel Data Models (GPDMs) for Econometric research. These models offer a middle ground between fully homogeneous (which are often incorrectly specified) and fully heterogeneous (which are often difficult to estimate) by grouping multiple individuals and assuming the same coeficients for all members of the groupings.

Features

This package implements the models and algorithms proposed by the following four papers, which each suggest different GPDMS.

  • Grouped Fixed Effects (GFE)
  • Grouped Interactive Fixed Effects (GIFE)
  • Automatic group selection via Information Criteria (BIC, AIC, HQIC).
  • Analytical or bootstrap standard errors
  • Fast NumPy and JIT-compiled Numba core with optional parallel bootstrap for large panels
  • Familiar, statsmodels‑like API

Installation

pip install groupedpaneldatamodels
# or update
pip install --upgrade groupedpaneldatamodels

To grab the bleeding‑edge version:

git clone https://github.com/michadenheijer/groupedpaneldatamodels.git
cd groupedpaneldatamodels
pip install .

Quick start

import numpy as np
import groupedpaneldatamodels as gpdm

# Y  shape (N, T, 1); X  shape (N, T, K)
gfe = gpdm.GroupedFixedEffects(Y, X, G=3, model="bonhomme_manresa")
gfe.fit()
print(gfe.summary())

gife = gpdm.GroupedInteractiveFixedEffects(Y, X, G=3,
                                           model="ando_bai",
                                           GF=[2, 2, 2])            # 2 common factors per grouping
gife.fit()
betas = gife.params["beta"]

Selecting the number of groups

best = gpdm.grid_search_by_ic(
    gpdm.GroupedFixedEffects,
    param_ranges={"G": range(1, 7)},
    init_params={"dependent": Y, "exog": X},
    pit_params={"gife_iterations": 100},
    ic_criterion="BIC"
)
print(best.G)          # optimal group count

Documentation

An API reference with proper installation and guidelines is available at https://groupedpaneldatamodels.michadenheijer.com

Simulation Study

A simulation study has been done for the Master's thesis creating this package. This thesis has shown that this package can succesfully reproduce the properties of the underlying estimators and can reduce the RMSE compared to a fully heterogeneous model when N is large and T is small.


Citation

Please cite the thesis if you use groupedpaneldatamodels:

@mastersthesis{denheijer2025,
    author      = {Micha den Heijer},
    title       = {groupedpaneldatamodels: A Python Library for Grouped Fixed and Interactive Effects Models},
    school      = {Vrije Universiteit Amsterdam},
    year        = {2025},
    month       = {July},
    date        = {2025-07-01},
    url         = {https://groupedpaneldatamodels.michadenheijer.com/_static/thesis.pdf}
}

License

Released under the MIT License. See LICENSE for details.

Metadata

Release files for groupedpaneldatamodels 0.1.2

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

Source distribution (sdist)

Source distribution for groupedpaneldatamodels 0.1.2
File Size Uploaded Provenance
groupedpaneldatamodels-0.1.2.tar.gz 19.8 MB Without provenance Details

Built distribution (wheel)

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

Total release size: 39.8 MB

Release files / groupedpaneldatamodels-0.1.2.tar.gz

Download URL groupedpaneldatamodels-0.1.2.tar.gz
Size 19.8 MB
Tags Source
SHA-256 checksum
How to use checksums
991b034030cc272e6176f978b597f3aa02b44ea80f84e0b55f77c2a12f332a15
BLAKE2b-256 checksum
How to use checksums
53a85490c5a6f746e7861c9afc996db95055b5e4286731693c623b8c8a080c6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.4

Release files / groupedpaneldatamodels-0.1.2-py3-none-any.whl

Download URL groupedpaneldatamodels-0.1.2-py3-none-any.whl
Size 20.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
207f84c514b19407254430e50ced1e468b46c17882d13bb902e05e07654ce31f
BLAKE2b-256 checksum
How to use checksums
c23fcc1e3dc026aad15284efea955611d3dbda36a21ce96d97b20bc9612c5173
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.4

Security for groupedpaneldatamodels 0.1.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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