Description Usage Arguments Value Author(s) Examples
Create a data.frame of components of the breakpointError that is easy to plot.
1 | errorComponents(guess.list, breaks, last.base)
|
guess.list |
List of integer vectors of guesses. |
breaks |
Integer vector of bases after which there is a break in the latent signal. |
last.base |
Integer scalar, the last base in the latent signal. |
Components of the breakpointError, described in a data.frame with columns type, error, segments.
Toby Dylan Hocking
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ## First define a latent signal and calculate its exact breakpoints.
seg.size <- 10000
means <- c(-3,0,3,0,2,-1,3)/3
mu <- do.call(c,lapply(means,rep,seg.size))
mu.break.after <- which(diff(mu)!=0)
## Choose some bases to sample, and pick them from a normal
## distribution.
base <- as.integer(seq(1,length(mu),l=500))
set.seed(1)
signal <- rnorm(length(base),mu[base],1)
## Segment that signal with cghseg, and quantify model fit using the
## breakpointError.
result <- run.cghseg(signal, base, maxSegments=15)
components <- errorComponents(result$breaks, mu.break.after, length(mu))
library(ggplot2)
p <- ggplot(components,aes(segments,error))+
geom_line(aes(size=type,colour=type,linetype=type))+
scale_linetype_manual(values=fp.fn.linetypes)+
scale_colour_manual(values=fp.fn.colors)+
scale_size_manual(values=fp.fn.sizes)
library(directlabels)
direct.label(p+guides(linetype="none",colour="none",size="none"),
dl.combine("first.qp","last.qp"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.