IDEAS home Printed from https://ideas.repec.org/a/jss/jstsof/v079i03.html

Kernel-Based Regularized Least Squares in R (KRLS) and Stata (krls)

Author

Listed:
  • Ferwerda, Jeremy
  • Hainmueller, Jens
  • Hazlett, Chad J.

Abstract

The Stata package krls as well as the R package KRLS implement kernel-based regularized least squares (KRLS), a machine learning method described in Hainmueller and Hazlett (2014) that allows users to tackle regression and classification problems without strong functional form assumptions or a specification search. The flexible KRLS estimator learns the functional form from the data, thereby protecting inferences against misspecification 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 effects of each independent variable at each data point in the covariate space. The method is thus a convenient and powerful alternative to ordinary least squares and other generalized linear models for regression-based analyses.

Suggested Citation

  • Ferwerda, Jeremy & Hainmueller, Jens & Hazlett, Chad J., 2017. "Kernel-Based Regularized Least Squares in R (KRLS) and Stata (krls)," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 79(i03).
  • Handle: RePEc:jss:jstsof:v:079:i03
    DOI: http://hdl.handle.net/10.18637/jss.v079.i03
    as

    Download full text from publisher

    File URL: https://www.jstatsoft.org/index.php/jss/article/view/v079i03/v79i03.pdf
    Download Restriction: no

    File URL: https://www.jstatsoft.org/index.php/jss/article/downloadSuppFile/v079i03/krls.zip
    Download Restriction: no

    File URL: https://www.jstatsoft.org/index.php/jss/article/downloadSuppFile/v079i03/v79i03.do
    Download Restriction: no

    File URL: https://www.jstatsoft.org/index.php/jss/article/downloadSuppFile/v079i03/KRLS_1.0-0.tar.gz
    Download Restriction: no

    File URL: https://www.jstatsoft.org/index.php/jss/article/downloadSuppFile/v079i03/v79i03.R
    Download Restriction: no

    File URL: https://www.jstatsoft.org/index.php/jss/article/downloadSuppFile/v079i03/growthdata.dta
    Download Restriction: no

    File URL: https://libkey.io/http://hdl.handle.net/10.18637/jss.v079.i03?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    References listed on IDEAS

    as
    1. Hainmueller, Jens & Hazlett, Chad, 2014. "Kernel Regularized Least Squares: Reducing Misspecification Bias with a Flexible and Interpretable Machine Learning Approach," Political Analysis, Cambridge University Press, vol. 22(2), pages 143-168, April.
    2. Simon N. Wood, 2004. "Stable and Efficient Multiple Smoothing Parameter Estimation for Generalized Additive Models," Journal of the American Statistical Association, American Statistical Association, vol. 99, pages 673-686, January.
    3. Ho, Daniel E. & Imai, Kosuke & King, Gary & Stuart, Elizabeth A., 2007. "Matching as Nonparametric Preprocessing for Reducing Model Dependence in Parametric Causal Inference," Political Analysis, Cambridge University Press, vol. 15(3), pages 199-236, July.
    Full references (including those not matched with items on IDEAS)

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Fervers, Lukas, 2018. "Can public employment schemes break the negative spiral of long-term unemployment, social exclusion and loss of skills? Evidence from Germany," Journal of Economic Psychology, Elsevier, vol. 67(C), pages 18-33.
    2. Zichen Deng & Maarten Lindeboom, 2021. "Early-life Famine Exposure, Hunger Recall and Later-life Health," Tinbergen Institute Discussion Papers 21-054/V, Tinbergen Institute.
    3. Leah Warfield Smith & Randall Lee Rose & Alex R. Zablah & Heath McCullough & Mohammad “Mike” Saljoughian, 2023. "Examining post-purchase consumer responses to product automation," Journal of the Academy of Marketing Science, Springer, vol. 51(3), pages 530-550, May.
    4. Wen, Chen & Xing, Yuhang & Wang, Tao & Liao, Sheng & Gao, Ke, 2025. "How do green supply chain management and renewable energy consumption influence carbon emissions in China and India? A comparative analysis," Energy Economics, Elsevier, vol. 143(C).
    5. Baron, Opher & Callen, Jeffrey L. & Segal, Dan, 2023. "Does the bullwhip matter economically? A cross-sectional firm-level analysis," International Journal of Production Economics, Elsevier, vol. 259(C).
    6. Jian Jiu Chen & Sai Yin Ho & Wing Man Au & Man Ping Wang & Tai Hing Lam, 2015. "Family Smoking, Exposure to Secondhand Smoke at Home and Family Unhappiness in Children," IJERPH, MDPI, vol. 12(11), pages 1-14, November.
    7. Kube, Roland & von Graevenitz, Kathrine & Löschel, Andreas & Massier, Philipp, 2019. "Do voluntary environmental programs reduce emissions? EMAS in the German manufacturing sector," Energy Economics, Elsevier, vol. 84(S1).
    8. Tetsuya Tsurumi & Shunsuke Managi, 2025. "Income and Subjective Well-Being: The Importance of Index Choice for Sustainable Economic Development," Sustainability, MDPI, vol. 17(12), pages 1-32, June.
    9. K. Poehlmann & R. Helm & O. Mauroner & J. Auburger, 2021. "Corporate spin-offs’ success factors: management lessons from a comparative empirical analysis with research-based spin-offs," Review of Managerial Science, Springer, vol. 15(6), pages 1767-1796, August.
    10. Renata Baborska & Emilio Hernandez & Emiliano Magrini & Cristian Morales-Opazo, 2020. "The impact of financial inclusion on rural food security experience: A perspective from low-and middle-income countries," Review of Development Finance Journal, Chartered Institute of Development Finance, vol. 10(2), pages 1-18.
    11. Fiaschi, Davide & Lavezzi, Andrea Mario, 2007. "Nonlinear economic growth: Some theory and cross-country evidence," Journal of Development Economics, Elsevier, vol. 84(1), pages 271-290, September.
    12. Elaine M. Wolf & Douglas A. Wolf, 2008. "Mixed Results in a Transitional Planning Program for Alternative School Students," Evaluation Review, , vol. 32(2), pages 187-215, April.
    13. Cappelletti, Matilde & Giuffrida, Leonardo M., 2022. "Targeted bidders in government tenders," ZEW Discussion Papers 22-030, ZEW - Leibniz Centre for European Economic Research.
    14. repec:osf:metaar:s42ba_v1 is not listed on IDEAS
    15. Joachim Wagner, 2025. "Digitalization Intensity and Extensive Margins of Exports in Manufacturing Firms from 27 EU Countries - Evidence from Kernel-Regularized Least Squares Regression," Economic Analysis Letters, Anser Press, vol. 4(1), pages 22-29, March.
    16. Gabriele Spilker & Tobias Böhmelt, 2013. "The impact of preferential trade agreements on governmental repression revisited," The Review of International Organizations, Springer, vol. 8(3), pages 343-361, September.
    17. Michael Funke & Helery Tasane, 2025. "Regional economic impacts of the Øresund cross-border fixed link: Cui Bono?," Regional Studies, Taylor & Francis Journals, vol. 59(1), pages 2573115-257, December.
    18. Reed, Deborah K. & Aloe, Ariel M., 2020. "Interpreting the effectiveness of a summer reading program: The eye of the beholder," Evaluation and Program Planning, Elsevier, vol. 83(C).
    19. Cauê Carrilho & Gabriela Demarchi & Amy Duchelle & Sven Wunder & Carla Morsello, 2022. "Permanence of avoided deforestation in a Transamazon REDD+ initiative (Pará, Brazil)," CEE-M Working Papers hal-03614704, CEE-M, Universtiy of Montpellier, CNRS, INRA, Montpellier SupAgro.
    20. Carrilho, Cauê D. & Demarchi, Gabriela & Duchelle, Amy E. & Wunder, Sven & Morsello, Carla, 2022. "Permanence of avoided deforestation in a Transamazon REDD+ project (Pará, Brazil)," Ecological Economics, Elsevier, vol. 201(C).
    21. Longhi, Christian & Musolesi, Antonio & Baumont, Catherine, 2014. "Modeling structural change in the European metropolitan areas during the process of economic integration," Economic Modelling, Elsevier, vol. 37(C), pages 395-407.

    More about this item

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:jss:jstsof:v:079:i03. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Christopher F. Baum (email available below). General contact details of provider: http://www.jstatsoft.org/ .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.