Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

psp

Tool to build the basis matrix and the penalty matrix of P-splines.


Description

psp builds the basis matrix and the penalty matrix to approximate a smooth function using a P-spline.

Usage

psp(xx, lambda, b.order, nknots, diff)

Arguments

xx

the explanatory variable.

lambda

an optional positive value that represents the smoothing parameter value.

b.order

an optional positive integer that specifies the degree of the B-spline basis matrix. Default is 3.

nknots

an optional positive integer that represents the number of internal knots of the P-spline. Default is m=[n^{\frac{1}{3}}]+3. The knots are located at the quantiles of order 0/(m-1),1/(m-1),…,(m-1)/(m-1) of xx.

diff

an optional positive integer that specifies the order of the difference penalty term. Default is 2.

Value

xx

the explanatory variable xx with the following attributes: set of knots, B-spline basis matrix, penalty matrix and smoothing parameter (if it was specified).

Author(s)

Luis Hernando Vanegas <hvanegasp@gmail.com> and Gilberto A. Paula

References

Eilers P.H.C. and Marx B.D. (1996). Flexible smoothing with B-splines and penalties. Statistical Science. 11, 89-121.

Examples

n <- 300
t <- sort(round(runif(n),digits=2))

t2 <- psp(t, diff=3)
N <- attr(t2, "N") ## B-spline basis matrix
M <- attr(t2, "K") ## Penalty Matrix
knots <- attr(t2,"knots") ## Set of knots

ssym

Fitting Semi-Parametric log-Symmetric Regression Models

v1.5.7
GPL-2 | GPL-3
Authors
Luis Hernando Vanegas <hvanegasp@gmail.com> and Gilberto A. Paula
Initial release
2016-10-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.