Learn R Programming

RegimeChange (version 0.1.1)

plot.regime_result: Plot Regime Change Detection Results

Description

Create visualizations of changepoint detection results.

Usage

# S3 method for regime_result
plot(
  x,
  type = c("data", "segments", "posterior", "diagnostic", "runlength"),
  show_ci = TRUE,
  show_segments = TRUE,
  title = NULL,
  ...
)

Value

A ggplot2 object

Arguments

x

A regime_result object

type

Type of plot:

  • "data": Data with changepoints marked (default)

  • "segments": Data colored by segment

  • "posterior": Posterior probability of change (Bayesian methods)

  • "diagnostic": Diagnostic statistics

  • "runlength": Run length distribution (BOCPD)

show_ci

Show confidence intervals if available

show_segments

Color segments differently

title

Plot title

...

Additional arguments passed to ggplot

Examples

Run this code
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