spline_expand {lazy.stat}R Documentation

Generate Spline Basis

Description

Generate Spline Basis

Usage

spline_expand(
  x,
  degree = 3,
  type = "b",
  nknots = 0,
  intercept = 1,
  knots = NULL,
  boundary.knots = NULL,
  xmin = NULL,
  xmax = NULL,
  rescale = 0,
  orth = 0,
  xrange = NULL,
  xrange0 = NULL,
  Xrange0 = NULL,
  plotbase = 0,
  printbase = 0
)

Arguments

x

Input vector.

degree

Degree of polynomial to be used.

type

= "p" for piecewise spline, "b" for b-spline.

nknots

# of knots to be used in [xmin, xmax].

intercept

= 0 to omit the intercept.

knots

vector consisting of (interior) knots to be used.

boundary.knots

boundary knots for B spline.

xmin

minimum of interior knots.

xmax

maximum of interior knots.

rescale

= 1 to rescale all the basis in [0,1].

orth

= 1 to orthogonalize the basis.

xrange

new range of x for p-spline or NULL

xrange0

old range of x for p-spline or NULL

Xrange0

old range of X for p-spline or NULL

plotbase

= 1 to plot the result.

printbase

= 1 to print the result.

Details

When knots are present, it has priority over nknots.

Value

List of: x
X=length(x) x (nknots+degree+1) spline basis matrix
degree, type, knots,
knots ( interior knots ) , boundary.knots
nobs=nrow(X), nq=ncol(X)

Examples

n <- 100
x <- seq(-1,1, length=n)
spline_expand( x, nknots=2, plot=1 )


[Package lazy.stat version 0.1.4 Index]