Description Usage Arguments Value Author(s) Examples
Calculate the components of the exact breakpoint error. We assume there is a latent piecewise constant signal defined on 1,...,last.base.
1 | errorDetails(guess, breaks, last.base)
|
guess |
Integer vector of bases after which you estimate a break occured. |
breaks |
Integer vector of bases after which there are breaks in the latent signal. |
last.base |
Integer scalar, the last base of the latent signal to model. |
A list with components used to calculate the breakpoint error.
Toby Dylan Hocking
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## 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)
str(errorDetails(result$breaks[[4]], mu.break.after, length(mu)))
str(errorDetails(result$breaks[[10]], mu.break.after, length(mu)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.