bs {lazy.stat}R Documentation

Generate B Spline Basis

Description

Generate B Spline Basis

Usage

bs(
  x,
  nknots = 0,
  knots = NULL,
  intercept = TRUE,
  xmin = NULL,
  xmax = NULL,
  boundary.knots = NULL,
  degree = 3,
  xlim = NULL,
  ylim = NULL,
  title = "b-spline",
  print = 0,
  plot = 0
)

Arguments

x

Input vector.

nknots

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

knots

vector consisting of (internal) knots to be used.

intercept

= 0 to omit the intercept.

xmin

minimum of internal knots.

xmax

maximum of internal knots.

boundary.knots

Boundary knots.

degree

Degree of polynomial to be used.

xlim

xlim for plot.

ylim

ylim for plot.

title

Plot title.

print

= 1 to print the result.

plot

= 1 to plot the result.

Details

When knots are present, it has priority over nknots.
Default value of the boundary.knots is c(min(temp),max(temp))
where temp=c(x,interior.knots).

Value

List of:
x
X=length(x) x (nknots+degree+1) spline basis matrix
type="b"
knots ( boundary + inside )
interior.knots, boundary.knots, degree, nknots

Examples

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


[Package lazy.stat version 0.1.4 Index]