Description Usage Arguments Details Value Author(s) References See Also Examples

Computes the dissimilarity based on the sizes of the compressed time series.

1 |

`x` |
Numeric vector containing the first of the two time series. |

`y` |
Numeric vector containing the second of the two time series. |

`type` |
Character string, the type of compression. May be abbreviated to a single letter, defaults to the first of the alternatives. |

The compression based dissimilarity is calculated:

* d(x,y) = C(xy) / ( C(x) + C(y) ) *

where *C(x)*, *C(y)* are the sizes in bytes of the compressed series *x* and *y*.
*C(xy)* is the size in bytes of the series *x* and *y* concatenated. The algorithm used for compressing the series is chosen with `type`

.
`type`

can be "gzip", "bzip2" or "xz", see `memCompress`

. "min" selects the best separately for `x`

, `y`

and the concatenation.
Since the compression methods are character-based, a symbolic representation can be used, see details for an example using SAX as the symbolic representation.
The series are transformed to a text representation prior to compression using `as.character`

, so small numeric differences may produce significantly different text representations.
While this dissimilarity is asymptotically symmetric, for short series the differences between `diss.CDM(x,y)`

and `diss.CDM(y,x)`

may be noticeable.

The computed dissimilarity.

Pablo Montero Manso, José Antonio Vilar.

Keogh, E., Lonardi, S., & Ratanamahatana, C. A. (2004). Towards parameter-free data mining. Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining (pp. 206-215).

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

`memCompress`

, `diss`

, `diss.NCD`

, `PAA`

, `convert.to.SAX.symbol`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ```
n = 50
x <- rnorm(n) #generate sample series, white noise and a wiener process
y <- cumsum(rnorm(n))
diss.CDM(x, y)
z <- rnorm(n)
w <- cumsum(rnorm(n))
series = rbind(x, y, z, w)
diss(series, "CDM", type="bzip2")
################################################################
#####symbolic representation prior to compression, using SAX####
####simpler symbolization, such as round() could also be used###
################################################################
#normalization function, required for SAX
z.normalize = function(x) {
(x - mean(x)) / sd(x)
}
sx <- convert.to.SAX.symbol( z.normalize(x), alpha=4 )
sy <- convert.to.SAX.symbol( z.normalize(y), alpha=4 )
sz <- convert.to.SAX.symbol( z.normalize(z), alpha=4 )
sw <- convert.to.SAX.symbol( z.normalize(w), alpha=4 )
diss(rbind(sx, sy, sz, sw), "CDM", type="bzip2")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.