0
$\begingroup$

I'm trying to use decomposition to forecast into the future. From my reading I understand that I can do this by adding a trend formula to a seasonality formula. I know that I can decompose a time series with this:

import statsmodels.api as sm
result = sm.tsa.seasonal_decompose(series.values, model='additive',freq=12)

trend = result.trend
seasonal = result.seasonal
residual = result.resid

The trend, seasonal and residual variables are arrays of numbers. I've searched google and the documentation for seasonal_decompose and haven't found a way to see/get access to the formulas used to calculate the numbers for trend and seasonal.

From my understanding, I need those formulas in order to be able to make projections. Do you know of a way to get those formulas from seasonal_decompose? Is there another function or method that works better for this?

$\endgroup$
2
  • 2
    $\begingroup$ Triple exponential smoothing (other name Holt-Winters method) does the same thing and is well described in internet. $\endgroup$
    – keiv.fly
    Dec 5, 2018 at 20:59
  • $\begingroup$ @keiv.fly Awesome, that is exactly what I needed. I just didn't know that that term existed. I see tons of content on how to use it. Thank you. $\endgroup$
    – Jarom
    Dec 5, 2018 at 21:35

1 Answer 1

1
$\begingroup$

I do not know how seasonal decompose works, but there is another very similar method that is well described.

Triple exponential smoothing (other name Holt-Winters method) internally makes a decomposition into trend, seasonal and residual components. But you should always check the decomposition. It always finds the seasonal component even if it does not exist.

Also the decomposition is actually sensitive to the underlying model. If the data is linear in logarithms and you do not apply a logarithm you will get a much less precise decomposition.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.