# lspkselect: Tuning Parameter Selection Procedures for Partitioning-Based... In lspartition: Nonparametric Estimation and Inference Procedures using Partitioning-Based Least Squares Regression

## Description

`lspkselect` implements IMSE-optimal data-driven procedures to select the number of partitioning knots for partitioning-based least squares regression estimators. Three series methods are supported: B-splines, compact supported wavelets, and piecewise polynomials (generalized regressograms). See Cattaneo and Farrell (2013) and Cattaneo, Farrell and Feng (2018a) for more technical details and further references.

Companion command: `lsprobust` for partitioning-based least squares regression estimation and inference; `lsprobust.plot` for plotting results; `lsplincom` for multiple sample estimation and inference.

A detailed introduction to this command is given in Cattaneo, Farrell and Feng (2018b).

For more details, and related Stata and R packages useful for empirical analysis, visit https://sites.google.com/site/nppackages/.

## Usage

 ```1 2 3 4 5 6 7 8 9``` ```lspkselect(y, x, m = NULL, m.bc = NULL, deriv = NULL, method = "bs", ktype = "uni", kselect = "imse-dpi", proj = TRUE, bc = "bc3", vce = "hc2", subset = NULL) ## S3 method for class 'lspkselect' print(x, ...) ## S3 method for class 'lspkselect' summary(object, ...) ```

## Arguments

 `y` Outcome variable. `x` Independent variable. A matrix or data frame. `m` Order of basis used in the main regression. Default is `m=2`. `m.bc` Order of basis used to estimate leading bias. Default is `m.bc=m+1`. `deriv` Derivative order of the regression function to be estimated. A vector object of the same length as `ncol(x)`. Default is `deriv=c(0,...,0)`. `method` Type of basis used for expansion. Options are `"bs"` for B-splines, `"wav"` for compact-supported wavelets (Cohen, Daubechies and Vial, 1993), and `"pp"` for piecewise polynomials. Default is `method="bs"`. `ktype` Knot placement. Options are `"uni"` for evenly spaced knots over the support of `x` and `"qua"` for quantile-spaced knots. Default is `ktype="uni"`. `kselect` Method for selecting the number of inner knots used by `lspkselect`. Options are `"imse-rot"` for ROT implementation of IMSE-optimal number of knots, `"imse-dpi"` for second generation of DPI implementation of IMSE-optimal number of knots, and `"all"` for both. Default is `kselect="imse-dpi"`. `proj` If true, projection of leading approximation error onto the lower-order approximating space is included for bias correction (splines and piecewise polynomial only). Default is `proj=TRUE`. `bc` Bias correction method. Options are `"bc1"` for higher-order bias correction, `"bc2"` for least squares bias correction, and `"bc3"` for plug-in bias correction. Default are `"bc3"` for splines and local polynomial partition series and `"bc2"` for wavelets. `vce` Procedure to compute the variance-covariance matrix estimator. Options are `"hc0"` heteroskedasticity-robust plug-in residuals variance estimator without weights. `"hc1"` heteroskedasticity-robust plug-in residuals variance estimator with hc1 weights. `"hc2"` heteroskedasticity-robust plug-in residuals variance estimator with hc2 weights. Default. `"hc3"` heteroskedasticity-robust plug-in residuals variance estimator with hc3 weights. `subset` Optional rule specifying a subset of observations to be used. `...` further arguments `object` class `lspkselect` objects.

## Value

 `ks` A matrix may contain `k.rot`(IMSE-optimal number of knots for the main regression through ROT implementation), `k.bias.rot` (IMSE-optimal number of knots for bias correction through ROT implementation), `k.dpi`IMSE-optimal number of knots for the main regression through DPI implementation, `k.bias.dpi`(IMSE-optimal number of knots for bias correction through DPI implementation) `opt` A list containing options passed to the function.

## Methods (by generic)

• `print`: `print` method for class "`lspkselect`".

• `summary`: `summary` method for class "`lspkselect`".

## Author(s)

Matias D. Cattaneo, University of Michigan, Ann Arbor, MI. [email protected].

Max H. Farrell, University of Chicago, Chicago, IL. [email protected].

Yingjie Feng (maintainer), University of Michigan, Ann Arbor, MI. [email protected].

## References

Cattaneo, M. D., and M. H. Farrell (2013): Optimal convergence rates, Bahadur representation, and asymptotic normality of partitioning estimators. Journal of Econometrics 174(2): 127-143.

Cattaneo, M. D., M. H. Farrell, and Y. Feng (2018a): Large Sample Properties of Partitioning-Based Series Estimators. Working paper.

Cattaneo, M. D., M. H. Farrell, and Y. Feng (2018b): lspartition: Partitioning-Based Least Squares Regression. Working paper.

Cohen, A., I. Daubechies, and P.Vial (1993): Wavelets on the Interval and Fast Wavelet Transforms. Applied and Computational Harmonic Analysis 1(1): 54-81.

`lsprobust`, `lsprobust.plot`, `lsplincom`
 ```1 2 3 4``` ```x <- data.frame(runif(500), runif(500)) y <- sin(4*x[,1])+cos(x[,2])+rnorm(500) est <- lspkselect(y, x) summary(est) ```