## 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.PIC(x, y, rbind( c(2,0,0), c(1,0,0)) ) #ARIMA(2,0,0) for x and ARIMA(1,0,0) for y
diss.AR.PIC(x, z, rbind( c(2,0,0), c(2,0,0)) )
# AR for y (automatically selected) and ARIMA(2,0,0) for z
diss.AR.PIC(y, z, rbind( c(NA,NA,NA), c(2,0,0)) )
#create a dist object for its use with clustering functions like pam or hclust
multidiss.AR.PIC( rbind(x,y,z), order=rbind(c(2,0,0), c(1,0,0), c(2,0,0)) )
Run the code above in your browser using DataLab