break.ts {mining} | R Documentation |
Divide a time-series into homogenous segments.
break.ts(x,n=2,trace=T,same.var=T)
x |
a numerical vector or ts object |
n |
the desired number of segments |
trace |
If TRUE, shows a merging trace via
plot.hclust.trace |
same.var |
argument passed to ward |
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
library(ts) 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)