# 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 algorithms. 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

1 | ```
computeRectangles(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 rectangles found by the algorithm as a *k \times 4* matrix of doubles.
Each row is of length 4, describing
one rectangle, *R_i =[llx,lly,urx,ury]*, where *(llx,lly)* is the lower left corner of the rectangle
and *(urx,ury)* is the upper right corner.

### Author(s)

Paul Fischer and Astrid Hilbert

### Examples

1 2 3 4 | ```
series <- c(1,2,1,2,1,2,5,6,5,6,5,6)
alpha <- 0.25
rects <- computeRectangles(series,alpha)
rects
``` |