segment {tilingArray} | R Documentation |
The function fits a piecewise constant curve to one or multiple sequences of measurements, using a least squares cost function and an O(n) dynamic programming algorithm (see references).
segment(y, maxseg, maxk)
y |
Numeric matrix. Rows correspond to the
x -variable, columns to replicate measurements at the same
value of x . Breakpoints are fitted along the x -axis.
For example, the x -variable can be genomic coordinates or
time. The segmentation will be along the rows of y . |
maxseg |
integer of length 1, maximum number of segments (= 1 + maximum number of change points). |
maxk |
integer of length 1, maximum length of a single segment. |
The complexity of the algorithm is
length(x)*maxk
in memory and
length(x)*maxk*maxcp
in time.
An object of class segmentation
.
W. Huber huber@ebi.ac.uk
A statistical approach for CGH microarray data analysis. Franck Picard, Stephane Robin, Marc Lavielle, Christian Vaisse, Gilles Celeux, Jean-Jacques Daudin, Rapport de recherche No. 5139, Mars 2004, Institut National de Recherche en Informatique et en Automatique (INRIA), ISSN 0249-6399. The code of this function is based on the Matlab implementation presented at http://www.inapg.fr/ens_rech/mathinfo/recherche/mathematique/outil.html, but it has evolved.
x = rep( sin((0:4)/2*pi), each=3) + rnorm(3*5, sd=0.1) res = segment(x, maxseg=6, maxk=15)