knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.align = "center",
  fig.path = "man/figures/README-"
)

Overview

R code for the clustering and segmentation of time series (including with regime changes) by mixture of gaussian Hidden Markov Models (MixHMMs) and the EM algorithm, i.e functional data clustering and segmentation.

Installation

You can install the development version of mixHMM from GitHub with:

# install.packages("devtools")
devtools::install_github("fchamroukhi/mixHMM")

To build vignettes for examples of usage, type the command below instead:

# install.packages("devtools")
devtools::install_github("fchamroukhi/mixHMM", 
                         build_opts = c("--no-resave-data", "--no-manual"), 
                         build_vignettes = TRUE)

Use the following command to display vignettes:

browseVignettes("mixHMM")

Usage

library(mixHMM)
# Application to a toy data set
data("toydataset")
Y <- t(toydataset[,2:ncol(toydataset)])

K <- 3 # Number of clusters
R <- 3 # Number of regimes (HMM states)
variance_type <- "heteroskedastic" # "heteroskedastic" or "homoskedastic" model

ordered_states <- TRUE
n_tries <- 1
max_iter <- 1000
init_kmeans <- TRUE
threshold <- 1e-6
verbose <- TRUE

mixhmm <- emMixHMM(Y = Y, K, R, variance_type,
                   ordered_states, init_kmeans, n_tries, max_iter, threshold, 
                   verbose)

mixhmm$summary()

mixhmm$plot()


fchamroukhi/mixHMM documentation built on Aug. 8, 2019, 3:31 p.m.