segment: Fit a piecewise constant curve: segmentation by dynamic
programming
Description
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).
Usage
segment(y, maxseg, maxk)
Arguments
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.