Description Usage Arguments Details Value References Examples
select knots for splineDesign
at
quantiles of data or at user-specified locations.
1 | knot.select(degree, x, num.basis = NULL, plotit = FALSE)
|
degree |
positive integer for spline degree |
x |
numeric vector of data sites or desired spline knots |
num.basis |
optional. |
plotit |
logical of whether plot result |
user selects degree of spline and optionally the
number of desired basis functions. If num.basis
is
not NULL
, function produces a knot vector on
supplied data vector x
, where the remaining
interior knots are placed at the quantiles of x
.
Remaining means "after beginning/end multiplicity
was constructed". If num.basis
is NULL
, the
interior knots are given by x[-c(1,length(x))]
(i.e. all but first and last element of x) and
num.basis
is chosen accordingly. The relationship
is num.basis
= length(knots)
- degree - 1.
The minimum number of basis functions to obtain a valid
knot vector with correct multiplicity is
min(num.basis) = deg + 1
. The function overrides
choices where num.basis
is too small with a
warning.
numeric vector of spline knots of length num.basis
+ degree
+ 1, with knot multiplicity
degree+1
of class knotVec with attribute
num.basis.
http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/bspline-basis.html, http://www.uio.no/studier/emner/matnat/ifi/INF-MAT5340/v07/undervisningsmateriale/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | knot.select(degree=4,x=1:10)
knot.select(degree=3,x=1:10,num.basis=8,plotit=TRUE)
knot.select(degree=3,x=1:10,num.basis=3) # warning
knot.select(degree=1,x=1:10,num.basis=2)
knot.select(degree=4,x=1:10)
knot.select(degree=3,x=1:10,num.basis=6,plotit=TRUE)
#
# make a double exponentially-scaled grid and use as knots
#
log.grid <- grid.maker(c(-10,15),20,spacing="log.g2")
knot.select(degree=4,x=log.grid,num.basis=NULL,TRUE)
#
# choose number of basis funs on same grid: remaining interior (after constructing multiplicities)
# knots will be placed at quantiles of grid
#
knot.select(degree=4,x=log.grid,num.basis=8,TRUE)
#
# make a hyperbolic-sine-scaled grid and use as knots
#
hyp.grid <- grid.maker(c(-10,15),20,spacing="hyp.sine")
knot.select(degree=5,x=hyp.grid,num.basis=NULL,TRUE)
#
# choose number of basis funs on same grid
#
knot.select(degree=5,x=hyp.grid,num.basis=9,TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.