Define a Functional Basis Object
This is the constructor function for objects of the basisfd
class. Each function that sets up an object of this class must call
this function. This includes functions create.bspline.basis
,
create.constant.basis
, create.fourier.basis
, and so
forth that set up basis objects of a specific type. Ordinarily, user
of the functional data analysis software will not need to call this
function directly, but these notes are valuable to understanding what
the "slots" or "members" of the basisfd
class are.
basisfd(type, rangeval, nbasis, params, dropind=vector('list', 0), quadvals=vector('list', 0), values=vector("list", 0), basisvalues=vector('list', 0))
type |
a character string indicating the type of basis. Currently, there are eight possible types:
|
rangeval |
a vector of length 2 containing the lower and upper boundaries of the range over which the basis is defined |
nbasis |
the number of basis functions |
params |
a vector of parameter values defining the basis. If the basis is "fourier", this is a single number indicating the period. That is, the basis functions are periodic on the interval (0,PARAMS) or any translation of it. If the basis is "bspline", the values are interior points at which the piecewise polynomials join. Note that the number of basis functions NBASIS is equal to the order of the Bspline functions plus the number of interior knots, that is the length of PARAMS. This means that NBASIS must be at least 1 larger than the length of PARAMS. |
dropind |
a vector of integers specifiying the basis functions to be dropped, if any. For example, if it is required that a function be zero at the left boundary, this is achieved by dropping the first basis function, the only one that is nonzero at that point. |
quadvals |
a matrix with two columns and a number of rows equal to the number of argument values used to approximate an integral using Simpson's rule. The first column contains these argument values. A minimum of 5 values are required for each inter-knot interval, and that is often enough. These are equally spaced between two adjacent knots. The second column contains the weights used for Simpson's rule. These are proportional to 1, 4, 2, 4, ..., 2, 4, 1. |
values |
a list, with entries containing the values of the basis function
derivatives starting with 0 and going up to the highest derivative
needed. The values correspond to quadrature points in
|
basisvalues |
a list of lists. This is designed to avoid evaluation of a basis
system repeatedly at a set of argument values. Each sublist
corresponds to a specific set of argument values, and must have at
least two components, which may be named as you wish. The first
component in an element of the list vector contains the argument
values. The second component is a matrix of values of the basis
functions evaluated at the arguments in the first component.
Subsequent components, if present, are matrices of values their
derivatives up to a maximum derivative order. Whenever function
|
Previous versions of the 'fda' software used the name basis
for this class, and the code in Matlab still does. However, this
class name was already used elsewhere in the S languages, and there
was a potential for a clash that might produce mysterious and perhaps
disastrous consequences.
To check that an object is of this class, use function
is.basis
.
It is comparatively simple to add new basis types. The code in
the following functions needs to be estended to allow for the new
type: basisfd
,
getbasismatrix
and getbasispenalty
.
In addition, a new "create" function should be written for the
new type, as well as functions analogous to fourier
and
fourierpen
for evaluating basis functions for basis
penalty matrices.
The "create" function names are rather long, and users who mind all that typing might be advised to modify these to versions with shorter names, such as "splbas", "conbas", and etc. However, a principle of good programming practice is to keep the code readable, preferably by somebody other than the programmer.
Normally only developers of new basis types will actually need to use this function, so no examples are provided.
an object of class basisfd
, being a list with the following
components:
type |
type of basis |
rangeval |
acceptable range for the argument |
nbasis |
number of bases |
params |
a vector of parameter values defining the basis. |
dropind |
input argument dropind |
quadvals |
quadrature values ... |
values |
a list of basis functions and derivatives |
basisvalues |
input argument basisvalues |
Ramsay, James O., Hooker, Giles and Graves, Spencer (2009) Functional Data Analysis with R and Matlab, Springer, New York.
Ramsay, James O., and Silverman, Bernard W. (2006), Functional Data Analysis, 2nd ed., Springer, New York.
Ramsay, James O., and Silverman, Bernard W. (2002), Applied Functional Data Analysis, Springer, New York.
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.