Formula: with \(\bar x_T\) the running mean of the first \(T\)
observations, \(m_T = \sum_{t\le T}(x_t - \bar x_t - \delta)\),
\(M_T = \min_{t \le T} m_t\), \(PH_T = m_T - M_T\), and a change
is flagged at the first \(T\) with \(PH_T > \lambda\). The
mirrored form detects a decrease. \(\delta\) is the magnitude
below which a deviation is treated as noise; threshold trades
detection delay against false alarms.
References
Page (1954), Biometrika 41:100-115; Hinkley (1971), Biometrika 58:509-523. Both paywalled at JSTOR (HTTP 403); the running-mean form used here is the one standardised in Gama, Zliobaite, Bifet, Pechenizkiy and Bouchachia (2014), A survey on concept drift adaptation, ACM Computing Surveys 46(4):44, sec. 4.2.
Examples
Pagehink(x = c(1, 2, 3, 4, 5, 6, 7, 8), threshold = 0.5)
#> $statistic
#> [1] 13.965
#>
#> $detected
#> [1] TRUE
#>
#> $changepoint
#> [1] 3
#>
#> $ph
#> [1] 0.000 0.495 1.490 2.985 4.980 7.475 10.470 13.965
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "Page-Hinkley change detector"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
