Title: | Computation of a Cubic B-Spline Basis and Its Derivatives |
Date: | 2021-07-11 |
Version: | 1.0.0 |
Description: | Computation of a cubic B-spline basis for arbitrary knots. It also provides the 1st and 2nd derivatives, as well as the integral of the basis elements. It is used by the author to fit penalized B-spline models, see e.g. Jullion, A. and Lambert, P. (2006) <doi:10.1016/j.csda.2006.09.027>, Lambert, P. and Eilers, P.H.C. (2009) <doi:10.1016/j.csda.2008.11.022> and, more recently, Lambert, P. (2021) <doi:10.1016/j.csda.2021.107250>. It is inspired by the algorithm developed by de Boor, C. (1977) <doi:10.1137/0714026>. |
URL: | http://www.statsoc.ulg.ac.be/ |
License: | GPL-3 |
Encoding: | UTF-8 |
RoxygenNote: | 7.1.1 |
NeedsCompilation: | yes |
Packaged: | 2021-07-12 11:19:04 UTC; plambert |
Author: | Philippe Lambert [aut, cre] (Université de Liège / Université catholique de Louvain (Belgium)) |
Maintainer: | Philippe Lambert <p.lambert@uliege.be> |
Repository: | CRAN |
Date/Publication: | 2021-07-13 14:30:04 UTC |
Computation of a cubic B-spline basis associated to a given vector of knots
Description
Computation of a cubic B-spline basis associated to a given vector of knots
Usage
Bsplines(x, knots)
Arguments
x |
vector of values where the B-spline basis must be evaluated. |
knots |
vector of knots spanning the desired B-spline basis. |
Value
A matrix of dimension length(x)
by (length(knots)+2)
.
Each column of the matrix corresponds to one cubic B-spline in the basis.
Examples
Bsplines(x=runif(20),knots=seq(0,1,length=11))
Computation of the 1st derivative of a cubic B-spline basis associated to a given vector of knots
Description
Computation of the 1st derivative of a cubic B-spline basis associated to a given vector of knots
Usage
D1Bsplines(x, knots)
Arguments
x |
vector of values where the 1st derivative of the B-spline basis must be evaluated. |
knots |
vector of knots spanning the desired B-spline basis. |
Value
A matrix of dimension length(x)
by (length(knots)+2)
.
Each column corresponds to (the 1st derivative of) one cubic B-spline in the basis.
Examples
D1Bsplines(x=runif(20),knots=seq(0,1,length=11))
Computation of the 2nd derivative of a cubic B-spline basis associated to a given vector of knots
Description
Computation of the 2nd derivative of a cubic B-spline basis associated to a given vector of knots
Usage
D2Bsplines(x, knots)
Arguments
x |
vector of values where the 2nd derivative of the B-spline basis must be evaluated. |
knots |
vector of knots spanning the desired B-spline basis. |
Value
A matrix of dimension length(x)
by (length(knots)+2)
.
Each column of the matrix corresponds to (the 2nd derivative of) one cubic B-spline in the basis.
Examples
D2Bsplines(x=runif(20),knots=seq(0,1,length=11))
Computation of the integral of a cubic B-spline basis over (t0,x) for a given vector of knots
Description
Computation of the integral of a cubic B-spline basis over (t0,x) for a given vector of knots
Usage
IBsplines(t0, x, knots)
Arguments
t0 |
scalar giving lower value of the integration interval. |
x |
vector giving the upper values of the integration interval. |
knots |
vector of knots spanning the desired B-spline basis. |
Value
A matrix of dimension length(x)
by (length(knots)+2)
.
Each integrated cubic B-spline is within a given column.
Examples
IBsplines(t0=0,x=runif(20),knots=seq(0,1,length=11))
Trapeze integration from a vector of function values evaluated at quadrature points
Description
Trapeze integration from a vector of function values evaluated at quadrature points
Usage
trapeze(x, fx)
Arguments
x |
grid of values for the quadrature (vector). |
fx |
values of the function on the grid (vector). |
Value
vector with a numerical approximation of \int_{min(x)}^{max(x)} f(t) dt
on the grid using the trapeze method.
Examples
x = seq(-4,2,length=100) ; fx = dnorm(x) ; res = trapeze(x,fx)
cbind(true=pnorm(x),trapeze=res)