# diss.AR.PIC

##### Model-based Dissimilarity Measure Proposed by Piccolo (1990)

Computes the distance between two time series as the Euclidean distance between the truncated AR operators approximating their ARMA structures.

##### Usage

`diss.AR.PIC(x, y, order.x=NULL, order.y=NULL, 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.

- order.x
Specifies the ARIMA model to be fitted for the series x. When using

`diss`

wrapper, use`order`

argument instead. See details.- order.y
Specifies the ARIMA model to be fitted for the series y. When using

`diss`

wrapper, use`order`

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

##### Details

If `order.x`

or order.y are `NULL`

, their respective series will be fitted automatically using a AR model. If `permissive`

is `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.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`

.

If using `diss`

function with "AR.PIC" `method`

, the argument `order`

must be used instead of `order.x`

and `order.y`

. `orders`

is a matrix with one row per ARIMA, specified as in `arima`

. If `order`

is `NULL`

, automatic fitting imposing a AR model is performed.

##### Value

The computed distance.

##### References

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/.

##### See Also

##### Examples

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

*Documentation reproduced from package TSclust, version 1.2.4, License: GPL-2*