View source: R/database_distances.R
TSDatabaseDistances | R Documentation |
TSdist distance matrix computation for time series databases.
TSDatabaseDistances(X, Y=NULL, distance, ...)
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. |
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 (see dtw
).
"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 (see diss.ACF
).
"pacf": Partial autocorrelation-based dissimilarity PACFDistance
. Uses the TSclust package (see diss.PACF
).
"ar.lpc.ceps": Dissimilarity based on LPC cepstral coefficients ARLPCCepsDistance
. Uses the TSclust package (see diss.AR.LPC.CEPS
).
"ar.mah": Model-based dissimilarity proposed by Maharaj (1996, 2000) ARMahDistance
. Uses the TSclust package (see diss.AR.MAH
).
"ar.pic": Model-based dissimilarity measure proposed by Piccolo (1990) ARPicDistance
. Uses the TSclust package (see diss.AR.PIC
).
"cdm": Compression-based dissimilarity measure CDMDistance
. Uses the TSclust package (see diss.CDM
).
"cid": Complexity-invariant distance measure CIDDistance
. Uses the TSclust package (see diss.CID
).
"cor": Dissimilarities based on Pearson's correlation CorDistance
. Uses the TSclust package (see diss.COR
).
"cort": Dissimilarity index which combines temporal correlation and raw value
behaviors CortDistance
. Uses the TSclust package (see diss.CORT
).
"int.per": Integrated periodogram based dissimilarity IntPerDistance
. Uses the TSclust package (see diss.INT.PER
).
"per": Periodogram based dissimilarity PerDistance
. Uses the TSclust package (see diss.PER
).
"mindist.sax": Symbolic Aggregate Aproximation based dissimilarity MindistSaxDistance
. Uses the TSclust package (see diss.MINDIST.SAX
).
"ncd": Normalized compression based distance NCDDistance
. Uses the TSclust package (see diss.NCD
).
"pred": Dissimilarity measure cased on nonparametric forecasts PredDistance
. Uses the TSclust package (see diss.PRED
).
"spec.glk": Dissimilarity based on the generalized likelihood ratio test SpecGLKDistance
. Uses the TSclust package (see diss.SPEC.GLK
).
"spec.isd": Dissimilarity based on the integrated squared difference between the log-spectra SpecISDDistance
. Uses the TSclust package (see diss.SPEC.ISD
).
"spec.llr": General spectral dissimilarity measure using local-linear estimation of the log-spectra SpecLLRDistance
. Uses the TSclust package (see diss.SPEC.LLR
).
"pdc": Permutation Distribution Distance PDCDistance
. Uses the pdc package (see pdcDist
).
"frechet": Frechet distance FrechetDistance
. Uses the longitudinalData package (see distFrechet
).
"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.
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. |
Usue Mori, Alexander Mendiburu, Jose A. Lozano.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.