xtdml: Double Machine Learning Estimation to Static Panel Data Models with Fixed Effects in \proglang R
Annalivia Polselli Institute for Social and Economic Research, University of Essex · 2025
Read xtdml: Double Machine Learning Estimation to Static Panel Data Models with Fixed Effects in \proglang R by Annalivia Polselli Institute for Social and Economic Research, University of Essex (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2512-15965.txt.
Introduction
Annalivia Polselli presents xtdml, an R package for double machine learning in panel data models, in a 2025 paper. Double machine learning pairs machine learning prediction with statistics to infer a target parameter while controlling for many confounders. Panel data add fixed effects for each unit, which the original methods did not handle.
The package carries out methods for partly linear panel models with low dimensional fixed effects and many controls, following Clarke and Polselli. Users can learn nuisance functions with learners from the mlr3 ecosystem. Unseen unit gaps are handled by first differences, within group changes, or correlated random effects, and controls can be rescaled or expanded. Simulated and real panel data show the package in use.
Catalog record
| CREATOR | Annalivia Polselli Institute for Social and Economic Research, University of Essex |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 66 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2512-15965
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
xtdml: Double Machine Learning Estimation to Static Panel Data Models with Fixed Effects in \proglang R Annalivia Polselli Institute for Social and Economic Research, University of Essex Abstract \Plainauthor Annalivia Polselli \Plaintitle xtdml: Extending Double Machine Learning Estimation to Static Panel Data Models with Fixed Effects in R \Shorttitle Double Machine Learning Estimation for Static Panel Data Models in R \Abstract The double machine learning (DML) method combines the predictive power of machine learning with statistical estimation to conduct inference about the structural parameter of interest. This paper presents the \proglang R package \pkg xtdml, which implements DML methods for partially linear panel regression models with low-dimensional fixed effects, high-dimensional confounding variables, proposed by 24 . The package provides functionalities to: (a) learn nuisance functions with machine learning algorithms from the \pkg mlr3 ecosystem, (b) handle unobserved individual heterogeneity choosing among first-difference transformation, within-group transformation, and correlated random effects, (c) transform the covariates with min-max normalization and polynomial expansion to improve learning performance. We showcase the use of \pkg xtdml with both simulated and real longitudinal data. \Keywords causal inference, high-dimensionality, learners, panel data, Neyman-orthogonality, unobserved individual heterogeneity \Address Annalivia Polselli Institute for Social and Economic Research University of Essex Wivenhoe Park, CO4 3SQ United Kingdom E-mail: URL: https://sites.google.com/site/annaliviapolselli/home?authuser=0 1 Introduction Double machine learning (DML) is a method for causal inference that leverages machine learning tools to flexibly model the functional form of the covariates while preserving valid statistical inference for the structural parameter (or treatment effect). Several works have contributed to the development of the DML method across a wide range of settings (i.e., treatment endogeneity, treatment heterogeneity, binary and continuous treatments) in cross-sectional models ( 19 ; 32 ; 29 ; 14 ; 18 ; 20 ) , static and dynamic panel data models ( 28 ; 40 ; 6 ; 24 ; 7 ) , and difference-in-differences (DID) designs ( 16 ; 27 ; 43 ) . The availability of \proglang R ( 2 ) packages for some of these methods has further contributed to the dissemination and practical adoption of DML in applied research. 1 1 1 A growing number of empirical studies have applied these DML methods to estimate treatment effects, including, for example, 26 , 31 , 41 , 12 ; 11 , and 33 . This article introduces the \proglang R package \pkg xtdml ( 37 ) , which implements the DML method for static panel data models with fixed effects as developed in 24 . The package fits partially linear panel regression (PLPR) models with low-dimensional fixed effects and treatment exogeneity, and permits flexible adjustment for high-dimensional confounding. To account for unobserved individual heterogeneity, the user can choose among the following panel data approaches: • within-group approximation (WG-approximation) transformation, • first-difference exact (FD-exact) transformation, • correlated random effects (CRE) device. The \pkg xtdml package builds on the object-oriented architecture of \pkg DoubleML ( 9 ) , which provides a comprehensive and user-friendly toolkit for the estimation of treatment effects in cross-sectional partially linear and interactive regression models within the DML framework. 2 2 2 The \pkg xtdml package can be viewed as the panel data counterpart of \pkg DoubleML for estimating partially linear regression models with DML, in the same way as \pkg plm ( 25 ) is the panel data analogue of the \code lm() function in the \pkg stats ( 1 ) package for linear regression. For more details on \pkg DoubleML see ( 8 ) . \pkg xtdml adopts the \pkg R6 class system ( 17 ) and integrates with the \pkg mlr3 ( 30 ) ecosystem to support state-of-the-art learners and tuning methods. The core model class \code xtdml_plr supports estimation within PLPR models with fixed effects by learning nuisance components through machine learning and constructing Neyman-orthogonal score functions based on adapted moment conditions. Common tasks implemented by \pkg xtdml include the estimation of the target parameter, the calculation of standard errors, t-tests, confidence intervals, and root mean squared errors (RMSEs). Similarly to \pkg DoubleML, the package offers users control over the estimation procedure, including the choice of learners for each nuisance function, hyperparameter tuning, the specification of the DML algorithm, and the selection of orthogonal score functions appropriate to the panel data setting. In contrast to the original \pkg DoubleML, \pkg xtdml introduces several features tailored to panel data including: 1. Panel data approaches. Users can choose among several panel data approaches (within-group, first-differences, correlated random effects) which transform both the data frame and the associated learning tasks accordingly. Alternatively, the user may select the option for a pooled estimation approach, which implements the original DML by 19 with cluster-robust inference and no panel data transformation is applied to the structural model; this approach is suitable for repeated cross-section data. 2. Covariate pre-processing. Users can select the transformation of the included covariates, with options including polynomial expansion, min-max normalization, or no transformation. 3 3 3 Each transformation is suitable for specific base learners to improve learning performance. A standard approach is to construct an extensive dictionary of the covariates when running Lasso regressions (a polynomial expansion is thus preferable) while normalising the scale of the covariates (inputs) is common with Neural Networks through min-max transformation or standardisation. Finally, no transformation of the variables is required for tree-based learners, which can capture interaction terms. 3. Panel structure specification. Users are required to specify panel and time identifiers to correctly apply one of the selected panel data transformations and obtain statistical inference. If the user requires cluster-robust standard errors at a level different from the panel identifier, an alternative clustering variable can be specified. 4. Sample splitting with cross-fitting for panel data. The implementation supports block-k-fold sample splitting, where each subject with its entire time series is assigned to a unique fold. This ensures that resampling is performed at the subject level rather than at the observation level, as preferable with panel data. 5. Model evaluation. The package provides measures of predictive performance of the base learners, such as the root mean squared error (RMSE) for the overall model and for the different nuisance parameters. \pkg xtdml is part of a limited class of \proglang R packages that allow the estimation of longitudinal or panel data models with machine learning techniques. Other \proglang R packages include the following: \pkg ablasso ( 21 ) combines the Arellano-Bond estimation method with the Least Absolute Shrinkage and Selection Operator (Lasso) for the estimation of structural parameters in dynamic linear panel models with lagged dependent variables and predetermined covariates as explanatory variables, and unobserved individual and time fixed effects ( 22 ) . Among the class of causal estimators implemented in \pkg causalweight ( 15 ) , \code didcontDML and \code didcontDMLpanel functions conduct the estimation of the average treatment effect on the treated using the DID methods for repeated cross-sections and panel data, respectively, while flexibly controlling for confounding via DML ( 16 ; 27 , based on) . 4 4 4 Similar to \pkg causalweight, \pkg xtdml can accommodate a classical DID design with two time periods and two groups (or a two-way fixed-effects setup) without staggered adoption by specifying \code approach = ”fd-exact” in \code xtdml_data_from_data_frame() and using Treat_{i}\times Post_{t}