DOI: 10.1515/jem-2026-0026 ISSN: 2156-6674

Estimating Semiparametric and Nonparametric Fixed Effects Panel Data Models with mgcv

Ivan Korolev

Abstract

This paper provides a practical guide to estimating semiparametric and nonparametric fixed-effects panel models using

mgcv
in R. It covers handling fixed effects with unit indicators, first differencing, or penalized unit effects; smooth specification; and cluster-robust inference. Monte Carlo experiments compare
mgcv::bam
with linear and fixed-series spline estimators. Penalized splines adapt to functional complexity and estimate functions accurately in these designs. With unit indicators or first differences, penalty-adjusted cluster-robust inference yields near-nominal size for parametric coefficients and pointwise coverage for unknown functions. Uniform bands modestly under-cover; model-based covariance inflation generally reduces undercoverage but can be conservative.

More from our Archive