GetBestBreak: Find most likely change point in irregular time series

View source: R/GetBestBreak.R

GetBestBreakR Documentation

Find most likely change point in irregular time series

Description

Finds the single best change point according to the likelihood function. Used internally within WindowSweep.

Usage

GetBestBreak(x, t, range = 0.6, ...)

Arguments

x

vector of time series values.

t

vector of times of measurements associated with x.

range

of possible breaks. Default (0.6) runs approximately from 1/5 to 4/5 of the total length of the time series.

...

additional parameters to pass to GetDoubleL function.

Value

returns a single row (vector) with elements: breaks,tbreaks,mu1,sigma1,rho1,LL1,mu2,sigma2,rho2,LL2,LL. The breakpoint is calculated for a range of possible values of width range*l (where l is the length of the time series). The output of this function feeds WindowSweep.

Author(s)

Eliezer Gurarie

See Also

WindowSweep which uses it, and GetDoubleL for the likelihood estimation.

Examples

# An example with a single break:
x <- c(arima.sim(list(ar = 0.9), 20) + 10, arima.sim(list(ar = 0.1), 20)) 
t <- 1:length(x)
plot(t,x, type="l")
(bb <- GetBestBreak(x,t, tau=FALSE))
abline(v = bb[2], col=2)

bcpa documentation built on May 30, 2022, 5:07 p.m.