| tsEvaTransformSeriesToStationaryTrendAndChangepts_ciPercentile {RtsEva} | R Documentation |
Transform Time Series to Stationary Trend and Change Points with Confidence Intervals
Description
This function takes a time series and transforms it into a stationary trend series with change points and confidence intervals.
Usage
tsEvaTransformSeriesToStationaryTrendAndChangepts_ciPercentile(
timeStamps,
series,
timeWindow,
percentile
)
Arguments
timeStamps |
A vector of time stamps corresponding to the observations in the series. |
series |
The time series data. |
timeWindow |
The size of the sliding window used for detrending the series. |
percentile |
The percentile value used for computing the running percentile of the stationary series. |
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 series with change points
changePointsThe detected change points
trendSeriesNonSeasonalThe trend series without the seasonal component
trendErrorThe error on the trend
stdDevSeriesThe standard deviation series
stdDevSeriesNonStepThe standard deviation series without the step change component
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
#go from six-hourly values to daily max
timeAndSeries <- max_daily_value(timeAndSeries)
timeStamps <- timeAndSeries[,1]
series <- timeAndSeries[,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_ciPercentile(timeStamps,
series, timeWindow, percentile)
plot(result$trendSeries)