| 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:
runningStatsMulteplicityThe running statistics multiplicity.
stationarySeriesThe transformed stationary series.
trendSeriesThe trend series.
trendonlySeriesThe trend series without the stationary component.
ChpointsSeries2The trend component of the change points.
changePointsThe detected change points.
trendSeriesNonSeasonalThe trend series without the seasonal component.
trendErrorThe error on the trend.
stdDevSeriesThe slowly varying standard deviation series.
stdDevSeriesNonStepThe slowly varying standard deviation series without step changes.
stdDevErrorThe error on the standard deviation.
timeStampsThe time stamps.
nonStatSeriesThe original non-stationary series.
statSer3MomThe running mean of the third moment of the stationary series.
statSer4MomThe 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)