coef.lgspline: Extract Coefficients from a Fitted lgspline

View source: R/methods.R

coef.lgsplineR Documentation

Extract Coefficients from a Fitted lgspline

Description

Returns the per-partition polynomial coefficient lists from a fitted lgspline model.

Usage

## S3 method for class 'lgspline'
coef(object, ...)

Arguments

object

A fitted lgspline model object.

...

Not used.

Details

Coefficient names reflect the polynomial expansion terms, e.g.:

  • intercept

  • v: linear term for predictor v

  • v_^2: quadratic term

  • v^3: cubic term

  • _v_x_w_: two-way interaction

Column/variable names replace numeric indices when available.

To get all coefficients as a single matrix: Reduce('cbind', coef(model_fit)).

Value

A list of per-partition coefficient vectors. Returns NULL with a warning if object$B is not found.

See Also

lgspline

Examples


set.seed(1234)
t <- runif(1000, -10, 10)
y <- 2*sin(t) + -0.06*t^2 + rnorm(length(t))
model_fit <- lgspline(t, y)

coefficients <- coef(model_fit)
print(coefficients[[1]])
print(Reduce('cbind', coefficients))


lgspline documentation built on Aug. 5, 2026, 1:10 a.m.