# How to get the formulas used by seasonal_decompose for Trend and Seasonality

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?

• Triple exponential smoothing (other name Holt-Winters method) does the same thing and is well described in internet. – keiv.fly Dec 5 '18 at 20:59
• @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. – Jarom Dec 5 '18 at 21:35

## 1 Answer

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.