Segment Data With Maximum Likelihood

Given a likelihood provided by the user, this package applies it to a given matrix dataset in order to find change points in the data that maximize the sum of the likelihoods of all the segments. This package provides a handful of algorithms with different time complexities and assumption compromises so the user is able to choose the best one for the problem at hand. The implementation of the segmentation algorithms in this package are based on the paper by Bruno M. de Castro, Florencia Leonardi (2018) . The Berlin weather sample dataset was provided by Deutscher Wetterdienst < https://dwd.de/>. You can find all the references in the Acknowledgments section of this package's repository via the URL below.


Travis-CI BuildStatus

Given a likelihood provided by the user, this package applies it to a given matrix dataset in order to find change points in the data that maximize the sum of the likelihoods of all the segments.

This package provides a handful of algorithms with different time complexities and assumption compromises so the user is able to choose the best one for the problem at hand.

Installation

You can install segmentr from GitHub using:

# install.packages("devtools")
devtools::install_github("thalesmello/segmentr", build_vignettes = TRUE)

Example

Sample code using the package to identify change points in the segments’ means:

require(segmentr)
#> Loading required package: segmentr
 
make_segment <- function(n, p) matrix(rbinom(100 * n, 1, p), nrow = 100)
data <- cbind(make_segment(5, 0.1), make_segment(10, 0.9), make_segment(2, 0.1))
mean_lik <- function(X) abs(mean(X) - 0.5) * ncol(X)^2
segment(data, likelihood = mean_lik, algorithm = "hieralg")
#> Segments (total of 3):
#> 
#> 1:5
#> 6:15
#> 16:17

For an in depth step-by-step, please check vignette("segmentr").

Acknowledgments

This package is part of a Master’s degree research thesis at IME-USP, with Florencia Leonardi as thesis adviser.

The algorithms in this package are based on a paper by Bruno M. de Castro and Florencia Leonardi.

The berlin sample dataset was provided by © Deutscher Wetterdienst and put together with the rdwd package by Berry Boessenkool. Check make_berlin.R for the script that builds the dataset.

News

segmentr 0.1.1

Minor changes to documentation to solve release issues.

  • Simplify equation in auto_penalize documentation
  • Adopt canonical CRAN URL in berlin documentation
  • Adopt correct format of DESCRIPTION and LICENSE

segmentr 0.1.0

First version of the package. Implements a handful of algorithms to help segment data according to a likelihood function.

  • Implements generic segment function which works as a proxy making it easy to switch algorithms
  • Includes berlin dataset build using the rdwd package. Execute make_berlin.R to build the dataset.
  • Include vignette('segmentr') teaching how to use the package.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("segmentr")

0.1.1 by Thales Mello, 2 months ago


https://github.com/thalesmello/segmentr


Browse source code at https://github.com/cran/segmentr


Authors: Thales Mello [aut, cre, cph] , Florencia Leonardi [aut, cph, ths] , Bruno M. de Castro [cph] , Deutscher Wetterdienst [cph]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports Rcpp, foreach, glue

Suggests testthat, doParallel, knitr, rmarkdown, tidyr, tibble, dplyr, lubridate, magrittr, rdwd

Linking to Rcpp


See at CRAN