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 Hidden Logistic Processes (MixRHLP) and the EM algorithm; i.e functional data clustering and segmentation.

Installation

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

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

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

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

Use the following command to display vignettes:

browseVignettes("mixRHLP")

Usage

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

K <- 3 # Number of clusters
R <- 3 # Number of regimes (polynomial regression components)
p <- 1 # Degree of the polynomials
q <- 1 # Order of the logistic regression (by default 1 for contiguous segmentation)
variance_type <- "heteroskedastic" # "heteroskedastic" or "homoskedastic" model

n_tries <- 1
max_iter <- 1000
threshold <- 1e-5
verbose <- TRUE
verbose_IRLS <- FALSE
init_kmeans <- TRUE

mixrhlp <- emMixRHLP(X = x, Y = Y, K, R, p, q, variance_type, init_kmeans, 
                     n_tries, max_iter, threshold, verbose, verbose_IRLS)

mixrhlp$summary()

mixrhlp$plot()


fchamroukhi/mixRHLP documentation built on Sept. 23, 2019, 4:19 a.m.