--- title: "A-quick-tour-of-mixHMM" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{A-quick-tour-of-mixHMM} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r setup, include=FALSE} library(knitr) knitr::opts_chunk$set( fig.align = "center", fig.height = 5.5, fig.width = 6, warning = FALSE, collapse = TRUE, dev.args = list(pointsize = 10), out.width = "90%", par = TRUE ) knit_hooks$set(par = function(before, options, envir) { if (before && options$fig.show != "none") par(family = "sans", mar = c(4.1,4.1,1.1,1.1), mgp = c(3,1,0), tcl = -0.5) }) ``` ```{r, message = FALSE, echo = FALSE} library(flamingos) ``` # Introduction **mixHMM**: Clustering and segmentation of heterogeneous curves/time series by mixture of gaussian Hidden Markov Models (MixHMMs) fitted by the EM/Baum-Welch algorithm. It was written in R Markdown, using the [knitr](https://cran.r-project.org/package=knitr) package for production. See `help(package="flamingos")` for further details and references provided by `citation("flamingos")`. # Load data ```{r} data("toydataset") Y <- t(toydataset[,2:ncol(toydataset)]) ``` # Set up mixHMM model parameters ```{r} K <- 3 # Number of clusters R <- 3 # Number of regimes (HMM states) variance_type <- "heteroskedastic" # "heteroskedastic" or "homoskedastic" model ``` # Set up EM parameters ```{r} ordered_states <- TRUE n_tries <- 1 max_iter <- 1000 init_kmeans <- TRUE threshold <- 1e-6 verbose <- TRUE ``` # Estimation ```{r, echo=TRUE} mixhmm <- emMixHMM(Y = Y, K, R, variance_type, ordered_states, init_kmeans, n_tries, max_iter, threshold, verbose) ``` # Summary ```{r} mixhmm$summary() ``` # Plots ```{r} mixhmm$plot() ```