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
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
series <- c(1,2,1,2,1,2,5,6,5,6,5,6)
alpha <- 0.25
rects <- computeRectangles(series,alpha)
rects
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/computeRectangels.Rd_%03d_medium.png", width=480, height=480)
> ### Name: computeRectangles
> ### Title: Structural break detection with rectangles
> ### Aliases: computeRectangles
> ### Keywords: break points
>
> ### ** Examples
>
> series <- c(1,2,1,2,1,2,5,6,5,6,5,6)
> alpha <- 0.25
> rects <- computeRectangles(series,alpha)
> rects
[,1] [,2] [,3] [,4]
[1,] 0 1 5 2
[2,] 6 5 11 6
>
>
>
>
>
> dev.off()
null device
1
>