lspartition: Partitioning-Based Least Squares Regression

Nonparametric partitioning-based least squares regression is an important tool in empirical work. Common examples include regressions based on splines, wavelets, and piecewise polynomials. This article discusses the main methodological and numerical features of the R software package lspartition, which implements results for partitioning-based least squares (series) regression estimation and inference from Cattaneo and Farrell (2013) and Cattaneo, Farrell, and Feng (2020). These results cover the multivariate regression function as well as its derivatives. First, the package provides data-driven methods to choose the number of partition knots optimally, according to integrated mean squared error, yielding optimal point estimation. Second, robust bias correction is implemented to combine this point estimator with valid inference. Third, the package provides estimates and inference for the unknown function both pointwise and uniformly in the conditioning variables. In particular, valid confidence bands are provided. Finally, an extension to two-sample analysis is developed, which can be used in treatment-control comparisons and related problems.

Matias D. Cattaneo , Max H. Farrell , Yingjie Feng

Supplementary materials

Supplementary materials are available in addition to this article. It can be downloaded at

CRAN packages used


CRAN Task Views implied by cited packages

Graphics, Phylogenetics, TeachingStatistics


Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".


For attribution, please cite this work as

Cattaneo, et al., "The R Journal: lspartition: Partitioning-Based Least Squares Regression", The R Journal, 2020

BibTeX citation

  author = {Cattaneo, Matias D. and Farrell, Max H. and Feng, Yingjie},
  title = {The R Journal: lspartition: Partitioning-Based Least Squares Regression},
  journal = {The R Journal},
  year = {2020},
  note = {},
  doi = {10.32614/RJ-2020-005},
  volume = {12},
  issue = {1},
  issn = {2073-4859},
  pages = {172-187}