TSclust (version 1.2.4)

diss.AR.LPC.CEPS: Dissimilarity Based on LPC Cepstral Coefficients

Description

Computes the dissimilarity between two time series in terms of their Linear Predicitive Coding (LPC) ARIMA processes.

Usage

diss.AR.LPC.CEPS(x, y, k = 50, order.x=NULL, order.y=NULL,
 seasonal.x=list(order=c(0, 0, 0), period=NA),
 seasonal.y=list(order=c(0, 0, 0), period=NA),
 permissive=TRUE)

Arguments

x

Numeric vector containing the first of the two time series.

y

Numeric vector containing the second of the two time series.

k

Number of cepstral coefficients to be considered.

order.x

Numeric matrix. Specifies the ARIMA models to be fitted for the series x. When using diss wrapper, use order argument instead. See details.

order.y

Numeric matrix. Specifies the ARIMA ARIMA models to be fitted for the series y. When using diss wrapper, use order argument instead. See details.

seasonal.x

A list of arima seasonal elements for series x. When using diss wrapper, use seasonal argument instead. See details.

seasonal.y

A list of arima seasonal elements for series x. When using diss wrapper, use seasonal argument instead. See details.

permissive

Specifies whether to force an AR order of 1 if no order is found. Ignored if neither order.x or order.y are NULL

Value

The computed distance.

Details

If order.x or order.y are NULL, their respective series will be fitted automatically using a AR model. order.x and order.y contain the three components of the ARIMA model: the AR order, the degree of differencing and the MA order, specified as in the function arima.

seasonal.x and seasonal.y are lists with two components: 'order' and 'period'. See seasonal parameter of arima, except that specification using a numeric vector of length 3 is not allowed.

If using diss function with "AR.LPC.CEPS" method, the argument order must be used instead of order.x and order.y. order is a matrix with one row per series, specified as in arima. If order is NULL, automatic fitting imposing a AR model is performed. The argument seasonal is used instead of seasonal.x and seasonal.y. seasonal is a list of elements, one per series in the same order that the series are input. Each element of seasonal must have the same format as the one in arima.

References

Kalpakis, K., Gada D. and Puttagunta, V. (2001) Distance measures for effective clustering of arima time-series. Proceedings 2001 IEEE International Conference on Data Mining, 273--280.

Montero, P and Vilar, J.A. (2014) TSclust: An R Package for Time Series Clustering. Journal of Statistical Software, 62(1), 1-43. http://www.jstatsoft.org/v62/i01/.

See Also

diss.AR.PIC, diss.AR.MAH, diss

Examples

Run this code
# NOT RUN {
## Create three sample time series
x <- arima.sim(model=list(ar=c(0.4,-0.1)), n =100, n.start=100)
y <- arima.sim(model=list(ar=c(0.9)), n =100, n.start=100)
z <- arima.sim(model=list(ar=c(0.5, 0.2)), n =100, n.start=100)
## Compute the distance and check for coherent results
diss.AR.LPC.CEPS(x, y, 25) #impose an AR automatically selected for both series
#impose an ARIMA(2,0,0) for series x and an AR automatically selected for z
diss.AR.LPC.CEPS(x, z, 25, order.x = c(2,0,0), order.y = NULL ) 
diss.AR.LPC.CEPS(y, z, 25)
#create a dist object for its use with clustering functions like pam or hclust

diss( rbind(x,y,z), METHOD="AR.LPC.CEPS", k=20, order=rbind(c(2,0,0), c(1,0,0), c(2,0,0)),
 seasonal=list( list(order=c(1,0,0), period=1), list(order=c(2,0,0), period=3),
  list(order=c(1,0,0), period=1)) )

# }

Run the code above in your browser using DataCamp Workspace