-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbsplineS.Rd
75 lines (71 loc) · 2.3 KB
/
bsplineS.Rd
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
\name{bsplineS}
\alias{bsplineS}
\title{
B-spline Basis Function Values
}
\description{
Evaluates a set of B-spline basis functions, or a derivative of these
functions, at a set of arguments.
}
\usage{
bsplineS(x, breaks, norder=4, nderiv=0, returnMatrix=FALSE)
}
\arguments{
\item{x}{
A vector of argument values at which the B-spline basis functions
are to be evaluated.
}
\item{breaks}{
A strictly increasing set of break values defining the B-spline
basis. The argument values \code{x} should be within the interval
spanned by the break values.
}
\item{norder}{
The order of the B-spline basis functions. The order less one is
the degree of the piece-wise polynomials that make up any B-spline
function. The default is order 4, meaning piece-wise cubic.
}
\item{nderiv}{
A nonnegative integer specifying the order of derivative to be
evaluated. The derivative must not exceed the order. The default
derivative is 0, meaning that the basis functions themselves are
evaluated.
}
\item{returnMatrix}{
logical: If TRUE, a two-dimensional is returned using a
special class from the Matrix package.
}
}
\value{
a matrix of function values. The number of rows equals the number of
arguments, and the number of columns equals the number of basis
functions.
}
\references{
Ramsay, James O., Hooker, Giles, and Graves, Spencer (2009),
\emph{Functional data analysis with R and Matlab}, Springer, New
York.
Ramsay, James O., and Silverman, Bernard W. (2005), \emph{Functional
Data Analysis, 2nd ed.}, Springer, New York.
Ramsay, James O., and Silverman, Bernard W. (2002), \emph{Applied
Functional Data Analysis}, Springer, New York.
}
\examples{
# Minimal example: A B-spline of order 1 (i.e., a step function)
# with 0 interior knots:
bS <- bsplineS(seq(0, 1, .2), 0:1, 1, 0)
# check
\dontshow{stopifnot(}
all.equal(bS, matrix(1, 6))
\dontshow{)}
# set up break values at 0.0, 0.2,..., 0.8, 1.0.
breaks <- seq(0,1,0.2)
# set up a set of 11 argument values
x <- seq(0,1,0.1)
# the order willl be 4, and the number of basis functions
# is equal to the number of interior break values (4 here)
# plus the order, for a total here of 8.
norder <- 4
# compute the 11 by 8 matrix of basis function values
basismat <- bsplineS(x, breaks, norder)
}