metric.DTW {fda.usc} | R Documentation |
DTW: Dynamic time warping
Description
Computes distances time warping for functional data
Usage
metric.DTW(fdata1, fdata2 = NULL, p = 2, w = min(ncol(fdata1), ncol(fdata2)))
metric.WDTW(
fdata1,
fdata2 = NULL,
p = 2,
w = min(ncol(fdata1), ncol(fdata2)),
wmax = 1,
g = 0.05
)
metric.TWED(fdata1, fdata2 = NULL, p = 2, lambda = 1, nu = 0.05)
Arguments
fdata1 |
Functional data 1 or curve 1. If |
fdata2 |
Functional data 2 or curve 2. If |
p |
Lp norm, by default it uses |
w |
Vector of weights with length |
wmax |
|
g |
|
lambda |
|
nu |
|
Details
Three optins:
DTW: Dynamic time warping
WDTW: Weight Dynamic time warping
TWED: twed
Value
DTW matrix
Author(s)
Manuel Febrero-Bande, Manuel Oviedo de la Fuente manuel.oviedo@udc.es
References
Jeong, Y. S., Jeong, M. K., & Omitaomu, O. A. (2011). Weighted dynamic time warping for time series classification. Pattern Recognition, 44(9), 2231-2240
See Also
See also semimetric.basis
and semimetric.NPFDA
Examples
## Not run:
data(tecator)
metric.DTW(tecator$absorp.fdata[1:4,])
ab=tecator[[1]]
D1=fda.usc:::DTW(ab$data[1,],ab$data[2,],p=2)
aa1=fda.usc:::findPath(D1$D)
D2=fda.usc:::DTW(ab$data[1,],ab$data[2,],p=2,w=5)
aa2=fda.usc:::findPath(D2$D)
D3=fda.usc:::WDTW(ab$data[1,],ab$data[2,],p=2,g=0.05)
aa3=fda.usc:::findPath(D3$D)
D4=fda.usc:::TWED(ab$data[1,],ab$data[2,],p=2,lambda=0,nu=0)
aa4=fda.usc:::findPath(D4$D)
par(mfrow=c(2,2))
plot(c(ab[1:2]))
segments(ab$argvals[aa1[,1]],ab[1]$data[aa1[,1]],ab$argvals[aa1[,2]],ab[2]$data[aa1[,2]])
plot(c(ab[1:2]))
segments(ab$argvals[aa2[,1]],ab[1]$data[aa2[,1]],ab$argvals[aa2[,2]],ab[2]$data[aa2[,2]],col=2)
plot(c(ab[1:2]))
segments(ab$argvals[aa3[,1]],ab[1]$data[aa3[,1]],ab$argvals[aa3[,2]],ab[2]$data[aa3[,2]],col=3)
plot(c(ab[1:2]))
segments(ab$argvals[aa4[,1]],ab[1]$data[aa4[,1]],ab$argvals[aa4[,2]],ab[2]$data[aa4[,2]],col=4)
## End(Not run)