## trendrcma

Automatically estimate the nonmonotonic trend of a noisy time series

f=trendrcma(x) estimates the nonmonotonic trend of the noisy time series x using the smoothing algorithm AutRCMA presented in Section 7.1 of the book Călin Vamoş, Maria Crăciun, Automatic Trend Estimation, Springer 2012.

[f,pest]=trendrcma(x) in addition to the AutRCMA trend, it supplies the estimated parameters for the time series x, the AutRCMA trend and the residuals.

[f,pest,trend_acd]=trendrcma(x,1) by applying the ACD algorithm (function trendacd), it computes a trend composed only by the monotonic parts of the AutRCMA trend from which the unsignificant local extrema are removed and graphically represents the iterative process (see Section 7.2 of the book Călin Vamoş, Maria Crăciun, Automatic Trend Estimation, Springer 2012).

[...]=trendrcma(...,dn0) dn0 is the minimum distance between two extrema of the estimated trend in case when the characteristic time scale of the phenomenum is known (see Section 6.4 of the book Călin Vamoş, Maria Crăciun, Automatic Trend Estimation, Springer 2012).

The automatic form of the repeated central moving average (RCMA) is obtained by adjusting its parameters to the characteristics of the processed time series. Instead of the two parameters controlling the RCMA we introduce a single parameter equal to the minimum distance between two successive local extrema of the smoothed time series. Its optimum value is determined as a function of the estimated serial correlation of the noise and of the estimated ratio between the amplitudes of the trend variations and noise fluctuations. They are estimated by means of two original simple statistical methods.

The algorithm to build a partition of a given time scale (function local_extrema) is used to estimate the significant local extrema of the AutRCMA trend which limit the monotonic segments of the estimated trend. The monotony of the segments are measured by comparison with the monotonic component estimated with ACD algorithm (function trendacd). The probability that a local extremum of the estimated trend corresponds to a local extremum of the real trend can be determined.