dat2bsplinemat: B-Spline matrix from dataset

View source: R/dat2bsplinemat.R

dat2bsplinematR Documentation

B-Spline matrix from dataset

Description

Convert a dataset to its b-spline basis set

Usage

dat2bsplinemat(
  x,
  df = NULL,
  knots = NULL,
  degree = 3L,
  intercept = FALSE,
  Boundary.knots = range(x, na.rm = TRUE),
  return.deriv = FALSE,
  as.data.frame = TRUE
)

Arguments

x

data.frame: Input

df

Integer: Degrees of freedom. See splines::bSpline

knots

Float, vector: Internal breakpoints. See splines::bSpline

degree

Integer (>0): Degree of the piecewise polynomial. See splines::bSpline

intercept

Logical: If TRUE, an intercept is included. Default = FALSE

Boundary.knots

Float, vector (length = 2): Boundary points to anchor the spline basis.

return.deriv

Logical: If TRUE, return list containing a data frame with the splines and another data frame with their derivatives

as.data.frame

Logical: If TRUE, return data.frame, otherwise matrix. Default = TRUE See splines::bSpline

Value

If return.deriv=F, a data frame where each original feature is replaced with its basis set or a list, otherwise a list containing a data frame with splines and a data frame with their derivatives

Author(s)

E.D. Gennatas


egenn/rtemis documentation built on Dec. 17, 2024, 6:16 p.m.