Abstract
The package High-dimensional Metrics (hdm) is an evolving collection of statistical methods for estimation and quantification of uncertainty in high-dimensional approximately sparse models. It focuses on providing confidence intervals and significance testing for (possibly many) low-dimensional subcomponents of the high-dimensional parameter vector. Efficient estimators and uniformly valid confidence intervals for regression coefficients on target variables (e.g., treatment or policy variable) in a high-dimensional approximately sparse regression model, for average treatment effect (ATE) and average treatment effect for the treated (ATET), as well for extensions of these parameters to the endogenous setting are provided. Theory grounded, data-driven methods for selecting the penalization parameter in Lasso regressions under heteroscedastic and non-Gaussian errors are implemented. Moreover, joint/ simultaneous confidence intervals for regression coefficients of a high-dimensional sparse regression are implemented, including a joint significance test for Lasso regression. Data sets which have been used in the literature and might be useful for classroom demonstration and for testing new estimators are included. R and the package hdm are open-source software projects and can be freely downloaded from CRAN.
Introduction
In the era of "Big Data," researchers frequently encounter the "high-dimensional" problem: scenarios where the number of potential regressors ($p$) is large relative to the sample size ($n$). Standard econometric tools, such as Ordinary Least Squares (OLS), break down when $p \approx n$ and are mathematically impossible to compute when $p > n$. While the Lasso (Least Absolute Shrinkage and Selection Operator) has become a popular solution for prediction in these settings, it introduces a significant "regularization bias" that makes standard inference—calculating p-values and confidence intervals—extremely difficult.
If a researcher simply runs a Lasso and performs inference on the remaining variables, the estimates for a specific "target" variable (e.g., the effect of a new policy) will likely be biased and statistically invalid. The hdm (High-dimensional Metrics) package for R addresses this by providing a rigorous toolkit for estimation and valid statistical inference, moving beyond simple prediction to provide reliable results for causal parameters.
Core Methodologies
The hdm package implements several key techniques designed to "de-bias" high-dimensional estimates:
Rigorous Lasso (rlasso)
Unlike standard Lasso implementations that rely on cross-validation—which often lacks theoretical justification for inference—rlasso uses a theoretically grounded, data-driven choice for the penalty level ($\lambda$). This method is specifically designed to handle non-Gaussian and heteroscedastic (varying variance) errors, which are common in real-world economic data.
The Orthogonality Principle (Double Selection)
This is the package's primary mechanism for valid inference. To estimate the effect of a target variable $d$ on an outcome $y$ while controlling for many variables $x$, the package employs a "partialling out" approach:
- Use Lasso to predict $y$ from $x$.
- Use Lasso to predict $d$ from $x$.
- Combine these steps to create an "orthogonalized" estimating equation that is insensitive to small errors in the nuisance (control) components.
Post-Lasso
To mitigate the shrinkage bias inherent in the original Lasso estimates, the package supports Post-Lasso, which involves running OLS on the variables selected by the Lasso. This helps recover the magnitude of effects that might otherwise be artificially suppressed by the regularization process.
Key Insights and Results
Inference over Prediction
The package shifts the focus from just "getting a good fit" to "getting a valid p-value." This is crucial for policy evaluation and scientific research where the goal is to understand the impact of a specific variable rather than just forecasting an outcome.
Robustness to Heteroscedasticity
Many high-dimensional tools assume errors are "well-behaved" (homoscedastic). hdm is built to handle the "messy" variance structures common in economic datasets, ensuring that standard errors remain reliable even when the variance of the error term is not constant.
Empirical Performance
The paper demonstrates the package's power through several applications:
- Economic Growth: In a dataset of 90 countries with 60 potential predictors, OLS produces noisy estimates. The
hdmpartialling-out approach yields much more precise estimates, providing stronger evidence for the hypothesis that poorer countries grow faster (conditional on other factors). - Wage Gap: Using CPS 2012 data, the package calculates joint confidence intervals for the effect of gender and its interactions, offering a more nuanced view of labor market discrimination than a single coefficient could provide.
- Precision Gains: Across various examples, these "rigorous" methods consistently provide tighter, more reliable confidence intervals than "naive" selection alternatives.
Conclusion and Limitations
While hdm provides a robust framework for high-dimensional inference, it relies on the assumption of "approximate sparsity"—the idea that while there are many variables, only a relatively small number of them truly matter. If the true underlying model is "dense" (where every variable has a tiny, equal effect), these methods may struggle. Additionally, high-dimensional IV and ATE estimations with many bootstrap repetitions can be computationally intensive. As an evolving collection, future iterations of hdm are expected to expand into more complex non-linear and panel data structures.
Summary updated