intercept: should an intercept be included in the basis?
Boundary.knots: the boundary points for spline basis. Defaults to range(x).
warn.outside: if TRUE, a warning is provided when x values are outside of the Boundary.knots
periodic: should the spline basis functions be constrained to be periodic with respect to the Boundary.knots?
xlev: levels of x (only applicable if x is a factor)
Details
Given a vector of function realizations f, suppose that f=Xβ, where X is the (unregularized) spline basis and β is the coefficient vector. Let Q denote the postive semi-definite penalty matrix, such that β⊤Qβ defines the roughness penalty for the spline. See Helwig (2017) for the form of X and Q for the various types of splines.
Consider the spectral parameterization of the form f=Zα where
Z=XQ−1/2
is the regularized spline basis (that is returned by this function), and α=Q1/2β are the reparameterized coefficients. Note that Xβ=Zα and β⊤Qβ=α⊤α, so the spectral parameterization absorbs the penalty into the coefficients (see Helwig, 2021, 2024).
Syntax of this function is designed to mimic the syntax of the bs function.
Returns
Returns a basis function matrix of dimension n by df (plus 1 if an intercept is included) with the following attributes: - df: degrees of freedom
knots: knots for spline basis
m: derivative penalty order
intercept: was an intercept included?
Boundary.knots: boundary points of x
periodic: is the basis periodic?
xlev: factor levels (if applicable)
References
Helwig, N. E. (2017). Regression with ordered predictors via ordinal smoothing splines. Frontiers in Applied Mathematics and Statistics, 3(15), 1-13. tools:::Rd_expr_doi("10.3389/fams.2017.00015")
Helwig, N. E. (2021). Spectrally sparse nonparametric regression via elastic net regularized smoothers. Journal of Computational and Graphical Statistics, 30(1), 182-191. tools:::Rd_expr_doi("10.1080/10618600.2020.1806855")
Helwig, N. E. (2025). Versatile descent algorithms for group regularization and variable selection in generalized linear models. Journal of Computational and Graphical Statistics, 34(1), 239-252. tools:::Rd_expr_doi("10.1080/10618600.2024.2362232")