KRLS: A Stata Package for Kernel-Based Regularized Least Squares
26 Pages Posted: 14 Sep 2013 Last revised: 6 Dec 2015
Date Written: 2015
Abstract
The Stata package krls implements kernel-based regularized least squares (KRLS), a machine learning method described in Hainmueller and Hazlett (2014) that allows users to tackle regression and classication problems without strong functional form assumptions or a specication search. The flexible KRLS estimator learns the functional form from the data, thereby protecting inferences against misspecication bias. Yet it nevertheless allows for interpretability and inference in ways similar to ordinary regression models. In particular, KRLS provides closed-form estimates for the predicted values, variances, and the pointwise partial derivatives that characterize the marginal eects of each independent variable at each data point in the covariate space. The method is thus a convenient and powerful alternative to OLS and other GLMs for regression-based analyses. We also provide a companion package and replication code that implements the method in R.
Keywords: machine learning, regression, classification, prediction, Stata
JEL Classification: C21
Suggested Citation: Suggested Citation