break.ts | R Documentation |
Divide a time-series into homogenous segments.
break.ts(x, n = 2, trace = T, same.var = T, ...)
x |
a numerical vector or |
n |
the desired number of segments |
trace |
If TRUE, shows a merging trace via
|
same.var |
argument passed to |
Calls ward
with sortx=F
to cluster the series into
segments. Only the marginal distribution of data is used; temporal
smoothness, for example, is ignored.
A vector of time breaks. The breaks are also plotted visually via
plot.segments.ts
.
Tom Minka
plot.segments.ts
, plot_breaks
data(LakeHuron) # single major change break.ts(LakeHuron,2) # merging trace suggests n=6 is also interesting: break.ts(LakeHuron,6) # interesting oscillation data(treering) break.ts(treering[1:500],9,same=T) break.ts(treering[1:100],7,same=T) # interesting multiscale structure x <- c(rnorm(100),rnorm(300)*3,rnorm(200)*2) b <- break.ts(x,3,same=F) plot(x,type="l") plot_breaks(b)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.