Minimises the penalised segmentation objective (Killick, Fearnhead and Eckley 2012, eq 1 with f(m) = m, eq 3) by the Optimal Partitioning recursion with PELT pruning (their Theorem 3.1, Algorithm 2; pruning constant K = 0 for log-likelihood costs). Cost "mean" is the Normal change-in-mean cost (sum of squared deviations from the segment mean, unit variance); "meanvar" is the Normal change in mean and variance, \(n_l (\log 2\pi + \log \hat\sigma^2 + 1)\).
Value
List with changepoints (1-based last index of each
segment except the final), n_changepoints,
objective, penalty, segment_means.
References
Killick, R., Fearnhead, P. and Eckley, I. A. (2012), Optimal detection of changepoints with a linear computational cost, Journal of the American Statistical Association 107(500), 1590-1598 (arXiv:1101.1438), equations 1-5, Algorithms 1-2.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Pelt(V)
#> $changepoints
#> [1] 2 4 6
#>
#> $n_changepoints
#> [1] 3
#>
#> $objective
#> [1] 8.238325
#>
#> $penalty
#> [1] 2.079442
#>
#> $segment_means
#> [1] 1.5 3.5 5.5 7.5
#>
#> $estimate
#> [1] 2 4 6
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "PELT (Killick-Fearnhead-Eckley 2012)"
#>
