Learn R Programming

MortalitySmooth (version 1.0)

MortSmooth.bbase: Construct B-spline basis

Description

This is an internal function of package MortalitySmooth which creates equally-spaced B-splines basis over an abscissa of data within the function Mort1Dsmooth.

Usage

MortSmooth.bbase(x, xl, xr, ndx, deg)

Arguments

x
Vector for the abscissa of data.
xl
Left boundary.
xr
Right boundary.
ndx
Number of internal knots minus one or number of internal intervals.
deg
Degree of the splines.

Value

  • A matrix containing equally-spaced B-splines of degree deg along x for each column.

Details

The function reproduce an algorithm presented by Eilers and Marx (2004) using differences of truncated power functions (see MortSmooth.tpower). The final matrix has a single B-spline for each of the [ndx + deg] columns. The number of rows is equal to the length of x.

References

Eilers and Marx (2004). Splines, Knots, and Penalties. Unpublished manuscript.

See Also

MortSmooth.tpower.

Examples

Run this code
x <- seq(0,1,length=100)
# B-splines basis of degree 1
B1 <- MortSmooth.bbase(x=x, xl=min(x), xr=max(x), ndx=10, deg=1)
matplot(x, B1, t="l", main="B-splines basis of degree 1")
# B-splines basis of degree 3
B3 <- MortSmooth.bbase(x=x, xl=min(x), xr=max(x), ndx=10, deg=3)
matplot(x, B3, t="l", main="B-splines basis of degree 3")

Run the code above in your browser using DataLab