Description Usage Arguments Details Value Source See Also Examples
criterion. By aligned is meant that the shape of each curve is matched as closely as possible to that of the target by means of a smooth increasing transformation of the argument, or a warping function.
1 2 | register.fd(y0fd=NULL, yfd=NULL, WfdParobj=c(Lfdobj=2, lambda=1),
conv=1e-04, iterlim=20, dbglev=1, periodic=FALSE, crit=2)
|
y0fd |
a functional data object defining the target for registration. If Alternatively, if Otherwise, y0fd must be a univariate functional data object taken as
the target to which |
yfd |
a multivariate functional data object defining the functions to be
registered to target |
WfdParobj |
a functional parameter object for a single function. This is used as the initial value in the estimation of a function $W(t)$ that defines the warping function $h(t)$ that registers a particular curve. The object also contains information on a roughness penalty and smoothing parameter to control the roughness of $h(t)$. The basis used for this object must be a B-spline basis. If a constant basis is desired, then use create.bspline.basis(wrange,1,1). Alternatively, this can be a vector or a list with components named
The default |
conv |
a criterion for convergence of the iterations. |
iterlim |
a limit on the number of iterations. |
dbglev |
either 0, 1, or 2. This controls the amount information printed out on each iteration, with 0 implying no output, 1 intermediate output level, and 2 full output. (If this is run with output buffering such as used with S-Plus, it may be necessary to turn off the output buffering to actually get the progress reports before the completion of computations.) |
periodic |
a logical variable: if |
crit |
an integer that is either 1 or 2 that indicates the nature of the continuous registration criterion that is used. If 1, the criterion is least squares, and if 2, the criterion is the minimum eigenvalue of a cross-product matrix. In general, criterion 2 is to be preferred. |
The warping function that smoothly and monotonely transforms the
argument is defined by Wfd
is the same as that defines the
monotone smoothing function in for function smooth.monotone.
See the help file for that function for further details.
a named list of length 4 containing the following components:
regfd |
A functional data object containing the registered functions. |
warpfd |
A functional data object containing the warping functions $h(t)$. |
Wfd |
A functional data object containing the functions $h W(t)$ that define the warping functions $h(t)$. |
shift |
If the functions are periodic, this is a vector of time shifts. |
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, ch. 6 & 7.
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 76 77 78 | #See the analyses of the growth data for examples.
##
## 1. Simplest call
##
# Specify smoothing weight
lambda.gr2.3 <- .03
# Specify what to smooth, namely the rate of change of curvature
Lfdobj.growth <- 2
# Establish a B-spline basis
nage <- length(growth$age)
norder.growth <- 6
nbasis.growth <- nage + norder.growth - 2
rng.growth <- range(growth$age)
# 1 18
wbasis.growth <- create.bspline.basis(rangeval=rng.growth,
nbasis=nbasis.growth, norder=norder.growth,
breaks=growth$age)
# Smooth consistent with the analysis of these data
# in afda-ch06.R, and register to individual smooths:
cvec0.growth <- matrix(0,nbasis.growth,1)
Wfd0.growth <- fd(cvec0.growth, wbasis.growth)
growfdPar2.3 <- fdPar(Wfd0.growth, Lfdobj.growth, lambda.gr2.3)
# Create a functional data object for all the boys
hgtmfd.all <- with(growth, smooth.basis(age, hgtm, growfdPar2.3))
nBoys <- 2
# nBoys <- dim(growth[["hgtm"]])[2]
# register.fd takes time, so use only 2 curves as an illustration
# to minimize compute time in this example;
#Alternative to subsetting later is to subset now:
#hgtmfd.all<-with(growth,smooth.basis(age, hgtm[,1:nBoys],growfdPar2.3))
# Register the growth velocity rather than the
# growth curves directly
smBv <- deriv(hgtmfd.all$fd, 1)
# This takes time, so limit the number of curves registered to nBoys
## Not run:
smB.reg.0 <- register.fd(smBv[1:nBoys])
smB.reg.1 <- register.fd(smBv[1:nBoys],WfdParobj=c(Lfdobj=Lfdobj.growth, lambda=lambda.gr2.3))
##
## 2. Call providing the target
##
smBv.mean <- deriv(mean(hgtmfd.all$fd[1:nBoys]), 1)
smB.reg.2a <- register.fd(smBv.mean, smBv[1:nBoys],
WfdParobj=c(Lfdobj=Lfdobj.growth, lambda=lambda.gr2.3))
smBv.mean <- mean(smBv[1:nBoys])
smB.reg.2 <- register.fd(smBv.mean, smBv[1:nBoys],
WfdParobj=c(Lfdobj=Lfdobj.growth, lambda=lambda.gr2.3))
all.equal(smB.reg.1, smB.reg.2)
##
## 3. Call using WfdParobj
##
# Create a dummy functional data object
# to hold the functional data objects for the
# time warping function
# ... start with a zero matrix (nbasis.growth, nBoys)
smBc0 <- matrix(0, nbasis.growth, nBoys)
# ... convert to a functional data object
smBwfd0 <- fd(smBc0, wbasis.growth)
# ... convert to a functional parameter object
smB.wfdPar <- fdPar(smBwfd0, Lfdobj.growth, lambda.gr2.3)
smB.reg.3<- register.fd(smBv[1:nBoys], WfdParobj=smB.wfdPar)
all.equal(smB.reg.1, smB.reg.3)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.