powered by
Detects changepoints using the Cumulative Sum (CUSUM) statistic. Foundational method for detecting changes in mean.
cusum( data, type = "mean", threshold = 4, mode = "offline", mu0 = NULL, sigma = NULL, ... )
List with changepoints and statistics
Numeric vector
Type of change ("mean", "variance", "both")
Detection threshold (alarm when statistic exceeds this)
"offline" for retrospective or "online" for sequential
Target mean under null hypothesis (for online mode)
Known standard deviation (if NULL, estimated from data)
Additional arguments
data <- c(rnorm(50), rnorm(50, mean = 2)) result <- cusum(data)
Run the code above in your browser using DataLab