| tsEvaChangepts {RtsEva} | R Documentation |
Change point detection in time series
Description
This function applies the PELT method for change point detection in a time series. It returns the mean and variance of the series segments between change points.
Usage
tsEvaChangepts(series, timeWindow, timeStamps)
Arguments
series |
A numeric vector representing the time series. |
timeWindow |
An integer specifying the minimum length of segments. |
timeStamps |
A vector of timestamps corresponding to the series data points. |
Value
A list containing:
trendA numeric vector of the same length as series, with each segment between change points filled with its mean value
varianceA numeric vector of the same length as series, with each segment between change points filled with its variance
changepointsA vector of timestamps at which change points were detected
Examples
timeAndSeries <- ArdecheStMartin
timeStamps <- ArdecheStMartin[,1]
series <- ArdecheStMartin[,2]
timeWindow <- 30*365 # 30 years
result <- tsEvaChangepts(series, timeWindow, timeStamps)
plot(timeAndSeries, type = "l")
lines(timeStamps,result$trend,col=2)
points(timeStamps[result$changepoints], result$trend[result$changepoints], col = "red")
[Package RtsEva version 1.0.0 Index]