#' @title Computes the dissimilarity.
#'
#' @description This is an approximate measure of the dissimilarity
#'
#'@keywords internal
dissim <- function(...) {
UseMethod("dissim")
}
#' @rdname dissim
dissim.HMM <- function(x, y1, y2) {
E <- sapply(y2, function(z)
if (!is.na(z)) emissions(x)[, z]
else rep(1, nstates(x)))
output <- apply(E * sstates(x, y1), 2, sum)
return(-sum(log(output)) / sum(!is.na(y2)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.