trenddecomp

Splits a time series into long-term trend, seasonal and remainder parts.

Category: Data Import and Analysis > Preprocessing Data

Syntax

LT = trenddecomp(A)

Long-term trend of the vector A.

[LT, ST, R] = trenddecomp(A)

Long-term trend, seasonal trend and the remainder.

Description

trenddecomp separates what changes slowly, what repeats with a period, and what is left over, so that each part can be studied on its own. The components add up to the original data. It is used on measurements with a daily or yearly cycle, such as temperature or sales.

The decomposition can use a method such as singular spectrum analysis, which finds the dominant oscillatory patterns in the series.

Input arguments

A
Numeric vector holding a regularly sampled series.

Output arguments

LT
Long-term trend.
ST
Seasonal (periodic) component.
R
Remainder: A - LT - ST.

Example

Calling it in MatLivre

x = (1:20) + sin(1:20);
try
  LT = trenddecomp(x);
  disp(size(LT))
catch err
  disp(err.message)
end
Output
trenddecomp is not supported in this version.

Notes

trenddecomp is not available in MatLivre yet: calling it reports 'trenddecomp is not supported in this version.' The example above shows that message. Use smoothdata or detrend for a simple trend estimate.

See also

smoothdata movmean detrend ischange