1
$\begingroup$

I'm wanting to use Statsmodel's SARIMAX model to predict sharemarket values into the future. This is part of a larger effort towards helping strictly non-profits and social-enterprise organisations.

Question: I'm having an issue (maybe conceptual) where when I introduce a 'deterministic polynomial trend', using Statsmodels' implementation, I can't see any effects on the subsequent prediction (I would have thought the prediction would shift upwards if I introduced a larger constant, for example). Am I missing something fundemental?

Typical code is below, but without source data (I can provide data if needed):

# SARIMA forecasting model
trendCoeffsList = [15000, 2.069764822521753, 0.0012385250036528476]
def forecast_sarima(data, order, sOrder):
    try:
        model = SARIMAX(data, trend=trendCoeffsList, order=order, seasonal_order=sOrder, 
                    enforce_stationarity=False, enforce_invertibility=False)
        print(model.trend) # coefficients exist within model
        model_fit = model.fit(disp=False)
        start = 1
        end = len(dataWhole) - dataRange
        predictData = model_fit.predict(start, end)
    except:
        predictData = False
    return predictData
$\endgroup$
2
  • $\begingroup$ Anything look funny in the model summary? $\endgroup$
    – Galen
    Sep 12, 2022 at 1:30
  • $\begingroup$ Thanks @Galen. On reflection, I'm thinking about this wrong. I'm thinking you specify an explicit polynomial model (via 'trend' argument) then SARIMAX constructs the seasonal component. But SARIMAX calculates both trend and seasonal components. Helps if I deduce things from the theory. Thanks anyhow. $\endgroup$ Sep 12, 2022 at 7:20

1 Answer 1

0
$\begingroup$

Answer: I've realised that Statsmodel's documentation is not clear about the trend argument. Specifically, the iterable for differing orders of polynomials (only including the highest term) is:

[0]       # degree = 0
[1]       # degree = 1
[0, 1]    # degree = 2
[0, 0, 1] # degree = 3
$\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.