Skip to contents

Formula: same run-length recursion as bocpd with a Gamma-Poisson run model; predictive P(x|a,b) = Gamma(x+a)/(Gamma(a) x!) (b/(b+1))^a (1/(b+1))^x

Usage

Outbrkdet(counts, hazard = 0.01, a0 = 1, b0 = 1)

Arguments

counts

See Usage.

hazard

See Usage.

a0

See Usage.

b0

See Usage.

Value

List with cp_prob (P(r_t = 1)), reset_prob, run_length, max_cp_prob, alarm (indices with cp_prob > 0.5), n.

References

Adams and MacKay (2007), Bayesian Online Changepoint Detection, arXiv:0710.3742. Equations (2)-(5) for the recursion and the changepoint prior, Section 2.3 and Algorithm 1 for the conjugate-exponential update of the run-specific sufficient statistics. Verified against the paper.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Outbrkdet(V)
#> $cp_prob
#> [1] 0.9900000000 0.0083661972 0.0062750965 0.0043993096 0.0029708996
#> [6] 0.0019546643 0.0012551576 0.0007803583
#> 
#> $run_length
#> [1] 1 2 3 4 5 6 7 8
#> 
#> $max_cp_prob
#> [1] 0.99
#> 
#> $reset_prob
#> [1] 0.01
#> 
#> $alarm
#> [1] 0
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "Outbreak detection (Gamma-Poisson online changepoint)"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"