| create.basis {fda} | R Documentation |
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, polynomial, or power basis sets.
Monomial and polynomial bases are similar. As noted in the table
below, create.monomial.basis has an argument exponents
absent from create.polynomial.basis, which has an argument
ctr absent from create.monomial.basis.
Power bases support the use of negative and fractional powers, while monomial bases are restricted only to nonnegative integer exponents.
The polygonal basis is essentialy a B-spline of order 2, degree 1.
The following summarizes arguments used by some or all of the current
create.basis functions:
For bspline bases, this can be inferred from
range(breaks). For polygonal bases, this can be inferred
from range(argvals). In all other cases, this defaults to 0:1.
This is not used for two of the create.basis functions:
For constant this is 1, so there is no need to specify it.
For polygonal bases, it is length(argvals), and again there
is no need to specify it.
For bspline bases, if nbasis is not specified, it
defaults to (length(breaks) + norder - 2) if breaks is
provided. Otherwise, nbasis defaults to 20 for
bspline bases.
For exponential bases, if nbasis is not specified,
it defaults to length(ratevec) if ratevec is provided.
Otherwise, in fda_2.0.2, ratevec defaults to 1,
which makes nbasis = 1; in fda_2.0.4,
ratevec will default to 0:1, so nbasis will then
default to 2.
For monomial and power bases, if nbasis is
not specified, it defaults to length(exponents) if
exponents is provided. Otherwise, nbasis defaults
to 2 for monomial and power bases. (Temporary
exception: In fda_2.0.2, the default nbasis for
power bases is 1. This will be increased to 2 in
fda_2.0.4.)
For polynomial bases, nbasis defaults to 2.
In addition to rangeval and 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.
Argument breaks = the locations of the break or join
points; also called knots. This defaults to
seq(rangeval[1], rangeval[2], nbasis-norder+2).
argvals = the locations of the break or join
points; also called knots. This defaults to
seq(rangeval[1], rangeval[2], nbasis).
period defaults to diff(rangeval).
ratevec. In fda_2.0.2, this defaulted to
1. In fda_2.0.3, it will default to 0:1.
exponents. Default = 0:(nbasis-1). For
monomial bases, exponents must be distinct
nonnegative integers. For power bases, they must be
distinct real numbers.
ctr must be a single number used to shift the
argument prior to computing its powers. Default =
mean(rangeval).
Beginning with 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 fda:
quadvals contains
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.
quadvals
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
of quadvals.
basisvalues with code such as
the following:
basisobj$basisvalues <- vector("list",1)
basisobj$basisvalues[[1]] <- list(args=evalargs, values=basismat)
For bspline bases, this defaults to paste('bspl', norder,
'.', 1:nbreaks, sep='').
For other bases, there are crudely similar defaults.
plot functions to
create custom axes. If this axes argument is not
NULL, functions plot.basisfd, plot.fd,
plot.fdSmooth plotfit.fd, plotfit.fdSmooth,
and plot.Lfd will create axes via
do.call(x$axes[[1]], x$axes[-1]). The primary example of
this is to create CanadianWeather plots using
list("axesIntervals")
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.
create.bspline.basis
create.constant.basis
create.exponential.basis
create.fourier.basis
create.monomial.basis
create.polygonal.basis
create.polynomial.basis
create.power.basis