plot.segmentation {tilingArray}R Documentation

Plot result of segmentation algorithm

Description

This function visualizes the result of findSegments. The user can choose whether he wants to specify the number of segments or let be determined by the function (see details).

Usage

  ## S3 method for class 'segmentation':
  plot(x, nSegments = NULL, bcol = NULL, from=NULL, to=NULL, ...)

Arguments

x object of class "segmentation"
nSegments number of segments in the data; if NULL, it is determined within the function (see details)
bcol color(s) to use for segment borders; if NULL they are taken to be the colors 2:nSegments
from numeric, index of data point to start plot at; default NULL means take the first one
to numeric, index of last data point to plot; default NULL means take all up to the last one
... further graphical parameters passed on to plot.default

Details

If nSegments is not specified, it is taken to be that number, at which the Residual Sum of Squares shows the largest decrease from the previous one. (The RSS decreases steadily, so absolute minimum is reached when nSegments equals the number of observations. This can only be done if confidence intervals have been computed for at least one of the segmentations, using the function confint.segmentation.

Value

If result is assigned, returns a list containing

breakp the breakpoints of the chosen or computed segmentation
confInt the confidence intervals of those breakpoints

Author(s)

Joern Toedling toedling@ebi.ac.uk

See Also

findSegments, confint.segmentation

Examples

  dat <- c(rnorm(10,0,1),rnorm(20,2,1), rnorm(5,0.5,0.5),
           rnorm(10,1,1), rnorm(20,2,1))

  if (require("strucchange")){
    segres <- findSegments(dat, maxcp=10, maxk=15, verbose=TRUE)
    segres <- confint(segres, 3:6)
    plot(segres)
  } else {
    segres <- findSegments(dat, maxcp=10, maxk=15, verbose=TRUE) 
    plot(segres, 5)
  }

[Package tilingArray version 1.2.0 Index]