tsEvaTransformSeriesToStationaryTrendAndChangepts {RtsEva} | R Documentation |
Transform Time Series to Stationary Trend and Change Points
Description
This function takes a time series and transforms it into a stationary trend series by removing the trend component and detecting change points. It computes the slowly varying standard deviation and normalizes the stationary series before detecting step changes. It also calculates the error on the trend and standard deviation.
Usage
tsEvaTransformSeriesToStationaryTrendAndChangepts(
timeStamps,
series,
timeWindow
)
Arguments
timeStamps |
A vector of time stamps corresponding to the data points in the series. |
series |
The original time series data. |
timeWindow |
The size of the time window used for detrending. |
Value
A list containing the following elements:
runningStatsMulteplicity
The running statistics multiplicity.
stationarySeries
The transformed stationary series.
trendSeries
The trend series.
trendonlySeries
The trend series without the stationary component.
ChpointsSeries2
The trend component of the change points.
changePoints
The detected change points.
trendSeriesNonSeasonal
The trend series without the seasonal component.
trendError
The error on the trend.
stdDevSeries
The slowly varying standard deviation series.
stdDevSeriesNonStep
The slowly varying standard deviation series without step changes.
stdDevError
The error on the standard deviation.
timeStamps
The time stamps.
nonStatSeries
The original non-stationary series.
statSer3Mom
The running mean of the third moment of the stationary series.
statSer4Mom
The running mean of the fourth moment of the stationary series.
Examples
timeAndSeries <- ArdecheStMartin
timeStamps <- ArdecheStMartin[,1]
series <- ArdecheStMartin[,2]
#select only the 5 latest years
yrs <- as.integer(format(timeStamps, "%Y"))
tokeep <- which(yrs>=2015)
timeStamps <- timeStamps[tokeep]
series <- series[tokeep]
timeWindow <- 365 # 1 year
percentile <- 90
result <- tsEvaTransformSeriesToStationaryTrendAndChangepts(timeStamps,
series, timeWindow)
plot(result$trendSeries)