Regi Mathew
Regi Mathew

Reputation: 2873

Statsmodels seasonal decomposition - Trend not a straight line

This query refers to decomposition of classic Airline passengers data into Trend, Seasonal and Residual. We expect linear trend to be a straight line. However, the result is not so. I wonder what is the logic behind extraction of Trend. Can you please throw some light?

from statsmodels.tsa.seasonal import seasonal_decompose
result = seasonal_decompose(airline['Thousands of Passengers'], model='additive')  
result.plot();

enter image description here

Upvotes: 0

Views: 1777

Answers (1)

Michael Grogan
Michael Grogan

Reputation: 1016

Two things to clarify:

1) Not all trends are linear

2) Even linear trends can be subject to some variation depending on the time series in question.

For instance, let's consider the trend for maximum air temperature in Dublin, Ireland over a number of years (modelled using statsmodels):

weather

In this example, you can see that the trend both ascends and descends - given that air temperature is subject to changing seasons we would expect this.

In terms of the airline dataset, we can see that the trend is being observed over a number of years. Even when the observed, seasonal and residual components have been extracted, the trend itself will be subject to shifts over time.

Upvotes: 2

Related Questions