Learn R Programming

TSdist (version 1.0)

tsDatabaseDistances: TSdist distance matrix computation.

Description

TSdist distance matrix computation for time series databases.

Usage

tsDatabaseDistances(x, method, diag=FALSE, upper=FALSE, ...)

Arguments

x
Time series database saved in a numeric matrix, a list, an mts object, a zoo object or xts object.
method
Distance measure to be used. It must be one of: "euclidean", "manhattan", "minkowski", "infinitenorm", "pearsoncorrelation", "crosscorrelation", "sts", "dtw"<
diag
logical value indicating if the diagonal of the distance matrix is to be printed.
upper
logical value indicating if the upper triangle of the distance matrix is to be printed.
...
Additional parameters required by the chosen distance measure.

Value

  • DThe computed distance matrix of the time series database.

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:

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 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, method="manhattan")
tsDatabaseDistances(example.database, method="edr", epsilon=0.2)
tsDatabaseDistances(example.database, method="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, method="manhattan")
tsDatabaseDistances(zoo.database, method="edr", epsilon=0.2)
tsDatabaseDistances(zoo.database, method="fourier", n=20)

Run the code above in your browser using DataLab