Functional data analysis proceeds by selecting a finite basis set and
fitting data to it. The current
fda package supports fitting
via least squares penalized with lambda times the integral over the
(finite) support of the basis set of the squared deviations from a
linear differential operator.
The most commonly used basis in
fda is probably B-splines. For
periodic phenomena, Fourier bases are quite useful. A constant basis
is provided to facilitation arithmetic with functional data objects.
To restrict attention to solutions of certain differential equations,
it may be useful to use a corresponding basis set such as exponential,
monomial or power basis sets.
Power bases support the use of negative and fractional powers, while monomial bases are restricted only to nonnegative integer exponents.
The polygonal basis is essentially a B-spline of order 2, degree 1.
The following summarizes arguments used by some or all of the current
rangeval a vector of length 2 giving the lower and upper limits of the range of permissible values for the function argument.
bspline bases, this can be inferred from
polygonal bases, this can be inferred
from range(argvals). In all other cases, this defaults to 0:1.
nbasis an integer giving the number of basis functions.
This is not used for two of the
constant this is 1, so there is no need to specify it.
polygonal bases, it is length(argvals), and again there
is no need to specify it.
bspline bases, if
nbasis is not specified, it
defaults to (length(breaks) + norder - 2) if
nbasis defaults to 20 for
exponential bases, if
nbasis is not specified,
it defaults to length(ratevec) if
ratevec is provided.
ratevec defaults to 1,
nbasis = 1; in
ratevec will default to 0:1, so
nbasis will then
default to 2.
power bases, if
not specified, it defaults to length(exponents) if
exponents is provided. Otherwise,
to 2 for
power bases. (Temporary
fda_2.0.2, the default
power bases is 1. This will be increased to 2 in
In addition to
nbasis, all but
constant bases have one or two parameters unique to that
basis type or shared with one other:
norder = the order of the spline, which is one
more than the degree of the polynomials used. This defaults to
4, which gives cubic splines.
breaks = the locations of the break or join
points; also called
knots. This defaults to
seq(rangeval, rangeval, nbasis-norder+2).
argvals = the locations of the break or join
points; also called
knots. This defaults to
seq(rangeval, rangeval, nbasis).
period defaults to diff(rangeval).
fda_2.0.2, this defaulted to
fda_2.0.3, it will default to 0:1.
exponents. Default = 0:(nbasis-1). For
exponents must be distinct
nonnegative integers. For
power bases, they must be
distinct real numbers.
fda_2.1.0, the last 6 arguments for all the
create.basis functions will be as follows; some but not all
are available in the previous versions of
dropind a vector of integers specifiying the basis functions to be dropped, if any.
a matrix with two columns and a number of rows equal to the
number of quadrature points for numerical evaluation of the
penalty integral. The first column of
the quadrature points, and the second column the quadrature
weights. A minimum of 5 values are required for each inter-knot
interval, and that is often enough. For Simpson's rule, these
points are equally spaced, and the weights are proportional to
1, 4, 2, 4, ..., 2, 4, 1.
a list of matrices with one row for each row of
and one column for each basis function. The elements of the
list correspond to the basis functions and their derivatives
evaluated at the quadrature points contained in the first column
A list of lists, allocated by code such as vector("list",1).
This field is designed to avoid evaluation of a basis system
repeatedly at a set of argument values. Each list within the
vector corresponds to a specific set of argument values, and
must have at least two components, which may be tagged as you
wish. 'The first component in an element of the list vector
contains the argument values. The second component in an
element of the list vector contains a matrix of values of the
basis functions evaluated at the arguments in the first
component. The third and subsequent components, if present,
contain matrices of values their derivatives up to a maximum
derivative order. Whenever function getbasismatrix is called,
it checks the first list in each row to see, first, if the
number of argument values corresponds to the size of the first
dimension, and if this test succeeds, checks that all of the
argument values match. This takes time, of course, but is much
faster than re-evaluation of the basis system. Even this time
can be avoided by direct retrieval of the desired array. For
example, you might set up a vector of argument values called
"evalargs" along with a matrix of basis function values for
these argument values called "basismat". You might want too use
tags like "args" and "values", respectively for these. You
would then assign them to
basisvalues with code such as
basisobj\$basisvalues <- vector("list",1)
basisobj\$basisvalues[] <- list(args=evalargs, values=basismat)
names either a character vector of the same length as the number of basis functions or a simple stem used to construct such a vector.
bspline bases, this defaults to paste('bspl', norder,
'.', 1:nbreaks, sep=”).
For other bases, there are crudely similar defaults.
an optional list used by selected
plot functions to
axes. If this
axes argument is not
plot.Lfd will create axes via
do.call(x$axes[], x$axes[-1]). The primary example of
this is to create
CanadianWeather plots using
J. O. Ramsay and Spencer Graves
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.