Last data update: 2014.03.03

R: Structural break detection with rectangles
computeBreakPointsR Documentation

Structural break detection with rectangles

Description

Find structural breaks by fitting it rectangles to a time series. The algorithm is randomised; it uses a genetic algorithm. Therefore, the break point sequence found can be different in different executions of the method on the same data, especially when used on longer series of some thousand observations.

Usage

computeBreakPoints(series,alpha)

Arguments

series

The time series as a vector of doubles.

alpha

A double in the range [0.0;1.0]. Values close to 0 result in more breakpoints, values close to 1 in fewer. With no background knowledge, alpha = 0.25 is a good start value for experiments.

Value

The break points found as a vector of integers. The first entry always is 0 (the first index of the series) the last one is the length of the series (note, indexing starts with 0). The other entries are the indices of the internal break points.

Author(s)

Paul Fischer and Astrid Hilbert

Examples

series <- c(1,2,1,2,1,2,5,6,5,6,5,6)
alpha <- 0.25
breaks <- computeBreakPoints(series,alpha)
breaks

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(SBRect)
Loading required package: rJava
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/SBRect/computeBreakPoints.Rd_%03d_medium.png", width=480, height=480)
> ### Name: computeBreakPoints
> ### Title: Structural break detection with rectangles
> ### Aliases: computeBreakPoints
> ### Keywords: break points
> 
> ### ** Examples
> 
> series <- c(1,2,1,2,1,2,5,6,5,6,5,6)
> alpha <- 0.25
> breaks <- computeBreakPoints(series,alpha)
> breaks
[1]  0  6 12
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>