Learn R Programming

TSdist (version 3.3)

TSDistances: 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", "wav", "int.per", "per", "mindist.sax", "ncd", "pred", "spec.glk", "spec.isd", "spec.llr", "pdc", "frechet")
...
Additional parameters required by the distance method.

Value

d
The computed distance between the pair of time series.

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:

Some distance measures may require additional arguments. See the individual help pages (detailed above) for more information about each method.

Examples

Run this code

# 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)



Run the code above in your browser using DataLab