Description Usage Arguments Value References See Also Examples
A function is said to be aligned or registered with a target function if its
salient features, such as peaks, valleys and crossings of fixed thresholds,
occur at about the same argument values as those of the target.
Function plotreg.fd
plots for each curve that is registered (1)
the unregistered curve (blue dashed line), (2) the target curve (red dashed
line) and (3) the registered curve (blue solid line). It also plots within
the same graphics window the warping function $h(t)$ along with a dashed
diagonal line as a comparison.
1 | plotreg.fd(reglist)
|
reglist |
a named list that is output by a call to function |
a series of plots, each containing two side-by-side panels. Clicking on the R Graphics window advances to the next plot.
Ramsay, James O., and Silverman, Bernard W. (2005), 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.
smooth.monotone
,
smooth.morph
register.fd
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 | # register and plot the angular acceleration of the gait data
gaittime <- as.numeric(dimnames(gait)[[1]])*20
gaitrange <- c(0,20)
# set up a fourier basis object
gaitbasis <- create.fourier.basis(gaitrange, nbasis=21)
# set up a functional parameter object penalizing harmonic acceleration
harmaccelLfd <- vec2Lfd(c(0, (2*pi/20)^2, 0), rangeval=gaitrange)
gaitfdPar <- fdPar(gaitbasis, harmaccelLfd, 1e-2)
# smooth the data
gaitfd <- smooth.basis(gaittime, gait, gaitfdPar)$fd
# compute the angular acceleration functional data object
D2gaitfd <- deriv.fd(gaitfd,2)
names(D2gaitfd$fdnames)[[3]] <- "Angular acceleration"
D2gaitfd$fdnames[[3]] <- c("Hip", "Knee")
# compute the mean angular acceleration functional data object
D2gaitmeanfd <- mean.fd(D2gaitfd)
names(D2gaitmeanfd$fdnames)[[3]] <- "Mean angular acceleration"
D2gaitmeanfd$fdnames[[3]] <- c("Hip", "Knee")
# register the functions for the first 10 boys
# argument periodic = TRUE causes register.fd to estimate a horizontal shift
# for each curve, which is a possibility when the data are periodic
nBoys <- 2 # use only 2 boys to save test time.
# set up the basis for the warping functions
nwbasis <- 7
wbasis <- create.bspline.basis(gaitrange,nwbasis,3)
Warpfd <- fd(matrix(0,nwbasis,nBoys),wbasis)
WarpfdPar <- fdPar(Warpfd)
# carry out the continuous registration
gaitreglist <- register.fd(D2gaitmeanfd, D2gaitfd[1:nBoys], WarpfdPar,
iterlim=4, periodic=TRUE)
# set iterlim=4 to reduce the compute time;
# this argument may not be needed in many applications.
# plot the results
plotreg.fd(gaitreglist)
# display horizonal shift values
print(round(gaitreglist$shift,1))
|
Loading required package: splines
Loading required package: Matrix
Attaching package: 'fda'
The following object is masked from 'package:graphics':
matplot
------- Curve 1 --------
Iter. Criterion Grad Length
0 1.3232 2.1911
1 1.2428 0.8337
2 1.1464 1.6862
3 0.961 0.8819
4 0.6983 0.2283
------- Curve 2 --------
Iter. Criterion Grad Length
0 1.7598 5.0698
1 1.4926 0.8933
2 1.4759 0.5794
3 1.3195 0.8225
4 1.3106 0.2128
reps 1 reps 2
0.4 0.0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.