TSDatabaseDistances {TSdist} | R Documentation |
TSdist distance matrix computation.
Description
TSdist distance matrix computation for time series databases.
Usage
TSDatabaseDistances(X, Y=NULL, distance, ...)
Arguments
X |
Time series database saved in a numeric matrix, a list, an |
Y |
Time series database saved in a numeric matrix, a list, an |
distance |
Distance measure to be used. It must be one of: |
f
... |
Additional parameters required by the chosen distance measure. |
Details
The distance matrix of a time series database is calculated by providing the pair-wise distances between the series that conform it. x
can be saved in a numeric matrix, a list or a mts
, zoo
or xts
object. The following distance methods are supported:
"euclidean": Euclidean distance.
EuclideanDistance
"manhattan": Manhattan distance.
ManhattanDistance
"minkowski": Minkowski distance.
MinkowskiDistance
"infnorm": Infinite norm distance.
InfNormDistance
"ccor": Distance based on the cross-correlation.
CCorDistance
"sts": Short time series distance.
STSDistance
"dtw": Dynamic Time Warping distance.
DTWDistance
. Uses the dtw package (seedtw
)."lb.keogh": LB_Keogh lower bound for the Dynamic Time Warping distance.
LBKeoghDistance
"edr": Edit distance for real sequences.
EDRDistance
"erp": Edit distance with real penalty.
ERPDistance
"lcss": Longest Common Subsequence Matching.
LCSSDistance
"fourier": Distance based on the Fourier Discrete Transform.
FourierDistance
"tquest": TQuest distance.
TquestDistance
"dissim": Dissim distance.
DissimDistance
"acf": Autocorrelation-based dissimilarity
ACFDistance
. Uses the TSclust package (seediss.ACF
)."pacf": Partial autocorrelation-based dissimilarity
PACFDistance
. Uses the TSclust package (seediss.PACF
)."ar.lpc.ceps": Dissimilarity based on LPC cepstral coefficients
ARLPCCepsDistance
. Uses the TSclust package (seediss.AR.LPC.CEPS
)."ar.mah": Model-based dissimilarity proposed by Maharaj (1996, 2000)
ARMahDistance
. Uses the TSclust package (seediss.AR.MAH
)."ar.pic": Model-based dissimilarity measure proposed by Piccolo (1990)
ARPicDistance
. Uses the TSclust package (seediss.AR.PIC
)."cdm": Compression-based dissimilarity measure
CDMDistance
. Uses the TSclust package (seediss.CDM
)."cid": Complexity-invariant distance measure
CIDDistance
. Uses the TSclust package (seediss.CID
)."cor": Dissimilarities based on Pearson's correlation
CorDistance
. Uses the TSclust package (seediss.COR
)."cort": Dissimilarity index which combines temporal correlation and raw value behaviors
CortDistance
. Uses the TSclust package (seediss.CORT
)."int.per": Integrated periodogram based dissimilarity
IntPerDistance
. Uses the TSclust package (seediss.INT.PER
)."per": Periodogram based dissimilarity
PerDistance
. Uses the TSclust package (seediss.PER
)."mindist.sax": Symbolic Aggregate Aproximation based dissimilarity
MindistSaxDistance
. Uses the TSclust package (seediss.MINDIST.SAX
)."ncd": Normalized compression based distance
NCDDistance
. Uses the TSclust package (seediss.NCD
)."pred": Dissimilarity measure cased on nonparametric forecasts
PredDistance
. Uses the TSclust package (seediss.PRED
)."spec.glk": Dissimilarity based on the generalized likelihood ratio test
SpecGLKDistance
. Uses the TSclust package (seediss.SPEC.GLK
)."spec.isd": Dissimilarity based on the integrated squared difference between the log-spectra
SpecISDDistance
. Uses the TSclust package (seediss.SPEC.ISD
)."spec.llr": General spectral dissimilarity measure using local-linear estimation of the log-spectra
SpecLLRDistance
. Uses the TSclust package (seediss.SPEC.LLR
)."pdc": Permutation Distribution Distance
PDCDistance
. Uses the pdc package (seepdcDist
)."frechet": Frechet distance
FrechetDistance
. Uses the longitudinalData package (seedistFrechet
)."tam": Time Aligment Measurement
TAMDistance
.
Some distance measures may require additional arguments. See the individual help pages (detailed above) for more information about each method. These parameters should be named in order to avoid mismatches.
Finally, for options dissim
, dissimapprox
and sts
, databases conformed of series with different sampling rates can be introduced as a list
of zoo
, xts
or ts
objects, where each element in the list is a time series with its own time index.
Value
D |
The computed distance matrix of the time series database. In some cases, such as ar.mahDistance or predDistance, some additional information is also provided. |
Author(s)
Usue Mori, Alexander Mendiburu, Jose A. Lozano.
Examples
# The object example.database is a numeric matrix that saves
# 6 ARIMA time series in a row-wise format. For more information
# see help page of example.databases:
help(example.database)
data(example.database)
# To calculate the distance matrix of this database:
TSDatabaseDistances(example.database, distance="manhattan")
TSDatabaseDistances(example.database, distance="edr", epsilon=0.2)
TSDatabaseDistances(example.database, distance="fourier", n=20)
# The object zoo.database is a zoo object that saves
# the same 6 ARIMA time series saved in example.database.
data(zoo.database)
# To calculate the distance matrix of this database:
TSDatabaseDistances(zoo.database, distance="manhattan")
TSDatabaseDistances(zoo.database, distance="edr", epsilon=0.2)
TSDatabaseDistances(zoo.database, distance="fourier", n=20)