Find change points efficiently in ARIMA(\(p\), \(d\), \(q\)) models
Source:R/fastcpd.R
detect_arima.Rddetect_arima() and fastcpd.arima() are
wrapper functions of detect() to find change points in
ARIMA(\(p\), \(d\), \(q\)) models.
Differencing is performed independently inside each candidate segment, so
no artificial difference is formed across a proposed change-point boundary.
Change-point indices refer to the original, undifferenced series. When
\(d = 0\), this is the same model as detect_arma().
The function is similar to detect()
except that the data is by default a one-column matrix or univariate vector
and thus a formula is not required here.
Arguments
- data
A numeric vector, a matrix, a data frame or a time series object.
- order
A vector of length three specifying the order of the ARIMA model.
- ...
Other arguments passed to
detect(), for example,segment_count. The ARIMA-specificinclude.meanoption is accepted here, defaults toFALSE, and must remainFALSE.
Value
A fastcpd object.
Examples
# \donttest{
small_increments <- rep(c(0.1, -0.1), 20)
large_increments <- rep(c(2, -2), length.out = 41)
x <- c(0, cumsum(c(small_increments, large_increments)))
result <- detect_arima(
x,
order = c(0, 1, 0)
)
summary(result)
#>
#> Call:
#> detect_arima(data = x, order = c(0, 1, 0))
#>
#> Change points:
#> 41
#>
#> Cost values:
#> -33.48908 86.34021
#>
#> Parameters:
#> segment 1 segment 2
#> 1 0.01 4
plot(result)
# }