dbspline: Generate a B-spline density basis of any degree

Description Usage Arguments Details Value See Also Examples

Description

This function generates a B-spline density basis of any degree.

Usage

1
dbspline(x, knots, degree = 3)

Arguments

x

numeric vector for which the B-spline densities are to be generated

knots

knots used to generate the B-spline densities

degree

positive integer specifying the degree of the B-spline densities (default is 3 for cubic B-splines)

Details

splineDesign is used to generate a B-spline basis of any degree. Each B-spline is then normalised to become a B-spline density using analytical integration. Note that the two boundary knots (0 and 1) are each coincident degree + 1 times.

Value

matrix of the B-spline density basis

See Also

splineDesign

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 

# Generate basis functions
set.seed(1)
x = seq(0, 1, length = 256)
knots = sort(c(0, runif(10), 1))
basis = dbspline(x, knots)

# Plot basis functions
plot(x, basis[1, ], type = "l", ylim = c(min(basis), max(basis)), 
     ylab = expression(b[3](x)), main = "Cubic B-spline Density Basis Functions")
for (i in 2:nrow(basis)) lines(x, basis[i, ], col = i)

## End(Not run)

Example output



bsplinePsd documentation built on May 2, 2019, 5:56 a.m.