TSDistances: TSdist distance computation.

View source: R/ts_distances.R

TSDistancesR Documentation

TSdist distance computation.

Description

TSdist distance calculation between two time series.

Usage

TSDistances(x, y, tx, ty, distance, ...)

Arguments

x

Numeric vector or ts, zoo or xts object containing the first time series.

y

Numeric vector or ts, zoo or xts object containing the second time series.

tx

Optional temporal index of series x. Only necessary if x is a numeric vector and the sampling index is not constant.

ty

Optional temporal index of series y. Only necessary if y is a numeric vector and the sampling index is not constant.

distance

Distance measure to be used. It must be one of: "euclidean", "manhattan", "minkowski", "infnorm", "ccor", "sts", "dtw", "keogh.lb", "edr", "erp", "lcss", "fourier", "tquest", "dissim", "acf", "pacf", "ar.lpc.ceps", "ar.mah", "ar.mah.statistic", "ar.mah.pvalue", "ar.pic", "cdm", "cid", "cor", "cort", "int.per", "per", "mindist.sax", "ncd", "pred", "spec.glk", "spec.isd", "spec.llr", "pdc", "frechet","tam")

...

Additional parameters required by the distance method.

Details

The distance between the two time series x and y is calculated. x and y can be saved in a numeric vector or a ts, 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.

Value

d

The computed distance between the pair of time series.

Author(s)

Usue Mori, Alexander Mendiburu, Jose A. Lozano.

Examples


# The objects zoo.series1 and zoo.series2 are two 
# zoo objects that save two series of length 100. 

data(zoo.series1)
data(zoo.series2)

# For information on their generation and shape see 
# help page of example.series.

help(example.series)

# The distance calculation for these two series is done
# as follows:

TSDistances(zoo.series1, zoo.series2, distance="infnorm")
TSDistances(zoo.series1, zoo.series2, distance="cor", beta=3)
TSDistances(zoo.series1, zoo.series2, distance="dtw", sigma=20)




TSdist documentation built on Aug. 31, 2022, 5:09 p.m.