# bbase: Compute a B-spline basis matrix In JOPS: Practical Smoothing with P-Splines

 bbase R Documentation

## Compute a B-spline basis matrix

### Description

Compute a B-spline basis matrix using evenly spaced knots.

### Usage

bbase(x, xl = min(x), xr = max(x), nseg = 10, bdeg = 3)

### Arguments

 x a vector of argument values, at which the B-spline basis functions are to be evaluated. xl the lower limit of the domain of x; default is min(x). xr the upper limit of the domain of x; default is max(x). nseg the number of equally sized segments between xl and xr; default is 10. bdeg the degree of the splines, usually 1, 2, or 3 (default).

### Details

If xl is larger than min(x), it will be adjusted to min(x) and a warning wil be given. If xr is smaller than max(x), it will be adjusted to max(x) and a warning wil be given. The values of the design parameters x, xl, xr, ndeg, bdeg and type = 'bbase' are added to the list of attributes of the matrix.

### Value

A matrix with length(x) rows and nseg + bdeg columns.

### Author(s)

Paul Eilers and Brian Marx

### References

Eilers, P.H.C. and Marx, B.D. (2021). Practical Smoothing, The Joys of P-splines. Cambridge University Press.

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

Eilers, P.H.C. and B.D. Marx (2010). Splines, knots and penalties. Wiley Interdisciplinary Reviews: Computational Statistics. Wiley: NY. DOI: 10.1002/wics.125

### Examples

# Compute and plot a B-spline basis matrix
x = seq(0, 360, by = 2)
B = bbase(x, 0, 360, nseg = 8, bdeg = 3)
matplot(x, B, type = 'l', lty = 1, lwd = 2, xlab = 'x', ylab = '')

JOPS documentation built on Sept. 8, 2023, 5:42 p.m.