Skip to content

Trend Strength

trend_strength

Computes the strength of a trend within the time-series.
Low value: A value close to zero means there are few/none indicators of a trend in the time series.
High value: A value close to one means there are strong signs of the series containing a trend.

png

Parameters Table
Parameter Type Default Description
period int 1 Frequency of the time series (e.g. 12 for monthly)
seasonal int 7 Length of the seasonal smoother (must be odd).
robust bool False Flag for robust fitting.
Calculation
  1. STL Decomposition: The time series (Yt) is decomposed into trend (Tt), seasonal (St), and remainder (Rt) components, such that Yt=Tt+St+Rt (for additive decomposition). This is done iteratively:

    • An initial trend is estimated (using a moving average).

    • The series is detrended (Yt−Tt).

    • The seasonal component is estimated by averaging the detrended series over each seasonal period and then smoothing these seasonal sub-series (using Loess).

    • The seasonal component is removed from the original series to get a seasonally adjusted series (Yt−St).

    • A new trend component Tt is estimated by smoothing the seasonally adjusted series (using Loess).

    • These steps are repeated a few times for robustness.

  2. Deseasonalized Series: The deseasonalized series is calculated as Dt=Yt−St=Tt+Rt.

  3. Variances:

    • The variance of the remainder component is calculated: Var(Rt).

    • The variance of the deseasonalized series is calculated: Var(Dt).

  4. Strength Calculation: Trend strength is computed as: strength=max(0,1−Var(Dt)Var(Rt)). The result is capped between 0 and 1 and returned.

Practical Usefulness Examples

Retail Sales: A business analyst can use trend strength to assess if an observed increase in monthly sales is a statistically significant upward movement or just part of normal random fluctuations. A strong trend might justify increased inventory orders, while a weak trend might suggest caution.

Stock Market Analysis: An investor could use trend strength to determine if a stock price is in a strong, reliable uptrend or downtrend, influencing buy/sell decisions, rather than reacting to short-term volatility.