BsBasis {mixAK} | R Documentation |
B-spline basis
Description
It creates a B-spline basis based on a specific dataset. B-splines are assumed to have common boundary knots and equidistant inner knots.
Usage
BsBasis(degree, ninner, knotsBound, knots, intercept=FALSE,
x, tgrid, Bname="B", plot=FALSE, lwd=1,
col="blue", xlab="Time", ylab="B(t)",
pch=16, cex.pch=1, knotcol="red")
Arguments
degree |
degree of the B-spline. |
ninner |
number of inner knots. |
knotsBound |
2-component vector with boundary knots. |
knots |
knots of the B-spline (including boundary ones). If
|
intercept |
logical, if |
x |
a numeric vector to be used to create the B-spline basis. |
tgrid |
if given then it is used to plot the basis. |
Bname |
label for the created columns with the B-spline basis. |
plot |
logical, if |
lwd , col , xlab , ylab |
arguments passed to the plotting function. |
pch , cex.pch |
plotting character and cex used to plot knots |
knotcol |
color for knots on the plot with the B-spline basis. |
Value
A matrix with the B-spline basis. Number of rows is equal to the
length of x
.
Additionally, the resulting matrix has attributes:
degree |
B-spline degree |
intercept |
logical indicating the presence of the intercept B-spline |
knots |
a numeric vector of knots |
knotsInner |
a numeric vector of innner knots |
knotsBound |
a numeric vector of boundary knots |
df |
the length of the B-spline basis (number of columns of the resulting object). |
tgrid |
a numeric vector which can be used on |
Xgrid |
a matrix with |
Author(s)
Arnošt Komárek arnost.komarek@mff.cuni.cz
See Also
bs
.
Examples
set.seed(20101126)
t <- runif(20, 0, 100)
oldPar <- par(mfrow=c(1, 2), bty="n")
Bs <- BsBasis(degree=3, ninner=3, knotsBound=c(0, 100), intercept=FALSE,
x=t, tgrid=0:100, plot=TRUE)
print(Bs)
Bs2 <- BsBasis(degree=3, ninner=3, knotsBound=c(0, 100), intercept=TRUE,
x=t, tgrid=0:100, plot=TRUE)
print(Bs2)
par(oldPar)
print(Bs)
print(Bs2)