KRLS: A Stata Package for Kernel-Based Regularized Least Squares

26 Pages Posted: 14 Sep 2013 Last revised: 6 Dec 2015

Jeremy Ferwerda

Dartmouth College

Jens Hainmueller

Stanford University - Department of Political Science; Stanford Graduate School of Business; Stanford Immigration Policy Lab

Chad Hazlett

Massachusetts Institute of Technology (MIT)

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 classi cation problems without strong functional form assumptions or a speci cation search. The flexible KRLS estimator learns the functional form from the data, thereby protecting inferences against misspeci cation 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 e ects 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

Ferwerda, Jeremy and Hainmueller, Jens and Hazlett, Chad, KRLS: A Stata Package for Kernel-Based Regularized Least Squares (2015). Journal of Statistical Software, Vol. 55, No. 2, Forthcoming. Available at SSRN: https://ssrn.com/abstract=2325523 or http://dx.doi.org/10.2139/ssrn.2325523

Jeremy Ferwerda

Dartmouth College ( email )

Hanover, NH 03755
United States

Jens Hainmueller (Contact Author)

Stanford University - Department of Political Science ( email )

Stanford, CA 94305
United States

HOME PAGE: http://www.stanford.edu/~jhain/

Stanford Graduate School of Business ( email )

655 Knight Way
Stanford, CA 94305-5015
United States

Stanford Immigration Policy Lab

30 Alta Road
Stanford, CA 94305
United States

Chad Hazlett

Massachusetts Institute of Technology (MIT) ( email )

77 Massachusetts Avenue
50 Memorial Drive
Cambridge, MA 02139-4307
United States

Paper statistics

Downloads
616
Rank
34,465
Abstract Views
2,260