# Seasonal term not significant after differencing

I am working with a time series (weekly frequency), $$\{y_t\}$$. I have 250 points in total. The time series is not stationary according to KPSS test (it is stationary according to ADF) at 5%. In any case, an expert in the field told me that the data should have annual seasonality ($$\sim 50$$ lags), and indeed this is what the periodogram suggests.

So to confirm this intuition I fitted a model of deterministic seasonality, of the form $$y_t = A \cos(\omega t) + B \sin(\omega t) + \epsilon_ t$$ using statsmodels' SARIMAX (https://www.statsmodels.org/dev/generated/statsmodels.tsa.statespace.sarimax.SARIMAX.html) with the proper angular frequency and I got that $$A \ne 0$$ significantly (p-value $$= 0.01$$). So far so good, everything is consistent.

Now, in the future I will include other (non-stationary) variables, so I wanted to check what happens if I take 1st differences. By doing SARIMAX(0,1,0) with the cosine as exogenous variable I therefore expected to get the same value for $$A$$ as before (I find the SARIMAX documentation above a bit confusing in the sense that I believe that SARIMAX with $$d=1$$ does not fit an ARIMA model on the residue, but an ARMA model on the differenced residue- in particular, the exogenous variables do get differenced as well.) However, even though $$A$$ is does not change much after differencing (24 vs 22, the previous value), the p-value is now 0.39, so suddenly the seasonality term is not significant.

I cannot understand this result. How can a 1st difference remove the seasonal pattern? Or is it that the significance test for $$A$$ is not reliable in the differenced case? How could I proceed, any ideas?

Thank you very much.

• Over differencing can change the data structure, for example add an AR pattern that did not exist before. I have never read that it could influence seasonality. Commented Aug 13, 2020 at 17:24
• @user54285 exactly, the influence on seasonality is what I do not understand. In any case, I whink I will remove the seasonal part for the undifferenced series and then model the residue $u_t$ with a SARIMAX, namely, as $y_t = Acos(\omega t) + u_t$. I think (hope!) that this is ok. Commented Aug 14, 2020 at 10:20

Now, in the future I will include other (non-stationary) variables, so I wanted to check what happens if I take 1st differences.

First of all, the SARIMAX model requires that both the dependent and the independent variables to be stationary, so keep that in mind.

When you do a differentiation the seasonal coefficients can change, specially if the first differencing has a big effect on the series, although without looking at the data I'm not certain that this will be the case.

To continue I would try to make the tests in a SARIMAX in an already differentiated series by the first order (since you're using statsmodel's SARIMAX I assume that you're using python):

data[timeseries] = data[timeseries] - data[timeseries].shift(lag_differentiation)


Check what coefficients are given to you when using the series that has been previously differentiated. Other than that, if it were me, i'd try to check what the behavior is on a test sample, so make some validation windows and try to forecast with the model to see if it's using the seasonal component.

• I don't think I agree. ARIMA assumes stationarity but only after differenciation and up to deterministic trend. In fact, in python there is no need to differentiante the series prior to fit ARIMA because the package has a parameter "d" that performs the differentiation. You also claim that (1-lag) differentiation can change the seasonal components (55-lag), ok, can you provide an example? That's exactly what I cannot see intuitively. Thanks. Commented Aug 14, 2020 at 10:14

I think that I might have an answer to my own question. I ran a little experiment:

First I generated a synthetic process of the following form: $$y_t = 5 + 3 \cos(\omega t) + \epsilon_t$$

with $$T$$ points and frequency $$\omega$$. Then I fitted a SARIMAX(p,d,q) with $$(p,d,q)=(0,0,0)$$, with non-zero constant and exogenous variable $$X=\cos(\omega t)$$: Let's call this model SARIMAX$$_1(\omega, T)$$.

On the other hand, I fitted another SARIMAX(p,d,q) to the same data, but now with $$(p,d,q)=(0,1,0)$$ and without allowing for a constant (again $$X=\cos(\omega t)$$): This is model SARIMAX$$_2(\omega, T)$$.

I did the above for several values of $$\omega, T$$, and this is what I got:

• $$\omega = 30, T=100$$: p-values for SARIMAX$$_1(\omega, T)$$ are $$0$$ (both for $$X$$ and the intercept) and for SARIMAX$$_2(\omega, T)$$ the p-value of $$X$$ equals $$0.007$$

• $$\omega = 30, T=40$$: p-values for SARIMAX$$_1(\omega, T)$$ are $$0$$ (both for $$X$$ and the intercept) and for SARIMAX$$_2(\omega, T)$$ the p-value of $$X$$ equals $$0.023$$

• $$\omega = 30, T=20$$: p-values for SARIMAX$$_1(\omega, T)$$ are $$0$$ (both for $$X$$ and the intercept) and for SARIMAX$$_2(\omega, T)$$ the p-value of $$X$$ equals $$0.419$$

• $$\omega = 70, T=100$$: p-values for SARIMAX$$_1(\omega, T)$$ are $$0$$ (both for $$X$$ and the intercept) and for SARIMAX$$_2(\omega, T)$$ the p-value of $$X$$ equals $$0.289$$

• $$\omega = 20, T=100$$: p-values for SARIMAX$$_1(\omega, T)$$ are $$0$$ (both for $$X$$ and the intercept) and for SARIMAX$$_2(\omega, T)$$ the p-value of $$X$$ equals $$0.0$$

So what seems to be happening in the differenced case is that SARIMAX still finds the expected relation with the cosine but it struggles much more to establish significance as compared to the non-differenced case - the difficulty seems to be related to the number of cycles that the original series completes.

Does this make sense? Do you know why this could be the case?