Computes the distance between two time series as the Euclidean distance between the truncated AR operators approximating their ARMA structures.
Numeric vector containing the first of the two time series.
Numeric vector containing the second of the two time series.
Specifies the ARIMA model to be fitted for the series x. When using
Specifies the ARIMA model to be fitted for the series y. When using
Specifies whether to force an AR order of 1 if no order is found. Ignored if neither order.x or order.y are NULL
order.x or order.y are
NULL, their respective series will be fitted automatically using a AR model. If
TRUE and no AR order is found automatically, an AR order of 1 will be imposed, if this case fails, then no order can be found and the function produces an error.
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
diss function with "AR.PIC"
method, the argument
order must be used instead of
orders is a matrix with one row per ARIMA, specified as in
NULL, automatic fitting imposing a AR model is performed.
The computed distance.
Pablo Montero Manso, José Antonio Vilar.
Piccolo, D. (1990) A distance measure for classifying arima models. J. Time Series Anal., 11(2), 153–164.
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/.
1 2 3 4 5 6 7 8 9 10 11 12
## 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 #ARIMA(2,0,0) for x and ARIMA(1,0,0) for y diss.AR.PIC( x, y, order.x = c(2,0,0), order.y = c(1,0,0) ) diss.AR.PIC( x, z, order.x = c(2,0,0), order.y = c(2,0,0) ) # AR for y (automatically selected) and ARIMA(2,0,0) for z diss.AR.PIC( y, z, order.x=NULL, order.y=c(2,0,0) ) #create a dist object for its use with clustering functions like pam or hclust diss( rbind(x,y,z), METHOD="AR.PIC", order=rbind(c(2,0,0), c(1,0,0), c(2,0,0)) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.