powered by
Create visualizations of changepoint detection results.
# S3 method for regime_result plot( x, type = c("data", "segments", "posterior", "diagnostic", "runlength"), show_ci = TRUE, show_segments = TRUE, title = NULL, ... )
A ggplot2 object
A regime_result object
Type of plot:
"data": Data with changepoints marked (default)
"data"
"segments": Data colored by segment
"segments"
"posterior": Posterior probability of change (Bayesian methods)
"posterior"
"diagnostic": Diagnostic statistics
"diagnostic"
"runlength": Run length distribution (BOCPD)
"runlength"
Show confidence intervals if available
Color segments differently
Plot title
Additional arguments passed to ggplot
data <- c(rnorm(100), rnorm(100, mean = 2)) result <- detect_regimes(data) plot(result) plot(result, type = "segments")
Run the code above in your browser using DataLab