Learn R Programming

profoc (version 1.3.2)

splines2_basis: Create B-Spline basis

Description

This function creates a B-Spline matrix.

Usage

splines2_basis(x, knots, deg, periodic = FALSE, intercept = TRUE)

Value

Returns a matrix of B-Spline basis functions.

Arguments

x

Vector of values.

knots

Vector of knots.

deg

Degree of the Spline functions.

periodic

Whether the basis should be periodic or not.

intercept

Whether the firs column should be kept.

Examples

Run this code
n <- 9
deg <- 3
mu <- 0.35
x <- 0:1000 / 1000

knots <- make_knots(n, mu = mu, deg = deg)

B <- splines2_basis(x, knots, deg)
ts.plot(B, col = 1:dim(B)[2])

# Periodic Case
B <- splines2_basis(x, knots, deg, periodic = TRUE)
ts.plot(B, col = 1:dim(B)[2])

Run the code above in your browser using DataLab