Jens Hainmueller
Home ] Research ] [ Statistical Software ] [Videos] Courses ] CV ]


KRLS is an R package written jointly with Chad Hazlett. It implements Kernel Regularized Least Squares (KRLS) as described in Hainmueller and Hazlett (2013). KRLS is a machine learning method that can flexibly fit solution surfaces of the form y=f(X) that arise in regression or classification problems without relying on linearity or other assumptions that use the columns of the predictor matrix X directly as basis functions (such as additivity). KRLS finds the best fitting function by minimizing a Tikhonov regularization problem with a square loss using Gaussian Kernels as radial basis functions. 

KRLS is currently available for R and Stata. Feedback from users is appreciated.

KRLS for R

You can obtain the KRLS package for R from CRAN by typing:


KRLS for Stata

You can obtain the krls package for Stata from SSC by typing:

ssc install krls, all replace

Ferwerda, Hainmueller, and Hazlett (2013) describes the Stata package in detail and provides empirical illustrations.