# Time series data with seasonality using VAR?

I have two time series: 1) Which only contains historical data for production 2006-2011 on a monthly basis. 2) Which contains both historical and projected flow data 2006-2057 on a monthly basis.

I would like to use VAR to use the flow data as a predictor for the production. My problem is that the data is seasonal and I don't know how to handle VAR with seasonality? If I use SARMA I will not be able (to my understanding) to use the flow measurement as a predictor for the production.

VAR models are routinely used with seasonal data, e.g. in macroeconomics where most of the time series (such as GDP or unemployment) are seasonal. Seasonality is handled either (1) outside of the model (by seasonally adjusting the series before fitting a VAR model) or (2) within the model (by including seasonal dummy variables, for example).

For (1), seasonal decomposition can be performed by function stl, decompose (as mentioned in another answer by @GD_N) or by fitting a univariate SARIMA model or an ARIMA model with seasonal dummies or Fourier terms - but there are other options, too.

For (2), seasonal dummies can be included as exogenous regressors or via the optional argument season in the vars::VAR function in R (scroll down in the package manual for details).

• Could you please enlarge on (1) vs (2)? Two stage estimation like (1) always felt like a hack to me, but makes sense if seasonality isn't the main interest (just a known source of signal you want to get rid of) and is too complex to be handled directly by your model. Incidentally, I asked about this a while ago and yours is a perfect and natural example stats.stackexchange.com/questions/246390/… – mugen Dec 31 '16 at 18:45
• @mugen, I see that I was the only one who upvoted that question and marked as a favourite :) I don't know a general answer. I think that seasonal terms are orthogonal to any regressors in population by definition (think what seasonal terms do), while in finite samples this is approximately so. When a subset of regressors is orthogonal to the remaining subset, the effect of the former can be removed by regressing the dependent variable on just them and subtracting the fitted values without loss of efficiency. That is a nice feature of orthogonal regressors for a regression with i.i.d. errors. – Richard Hardy Jan 1 '17 at 9:19
• @mugen, However, this breaks down when errors are not i.i.d., as is often the case in time series. Then it is hard to tell what the effect is. But AFAIK, (1) against (2) is not clear cut in practice. E.g. in macroeconomics it is very common to do (1), but in some simpler systems (2) could work better. I don't know really. – Richard Hardy Jan 1 '17 at 9:20

Let me explain you in steps on removing seasonality:

1. Detect the trend: first find if the time series is additive or multiplicative
2. Detrend the time series: this will expose seasonality.
3. Average seasonality: from the detrend time series, it’s easy to compute the average seasonality. We add the seasonality together and divide by the number of seasonality.

If you are using R, there are two functions, decompose and stl, which help you do the above said. Often, the decomposition is used to removes the seasonal effect from a time series. It provided a cleaner way to understand the trend.

• Note 1: you can use the autocorrelation function to identify the seasonality (weekly, monthly, quarterly, half-yearly or yearly)
• Note 2: SARMA handles seasonality, read on it too.
• Thank you @GD_N for your answer. As I have a predictor I would like to use it and therefore I think using VAR is the way to go. As for SARMA it only considers on parameter, which is not what I would optimally want to do. For the de-seasoning my data I was considering using 12 dummies (one for each month) to remove the seasonality but still using VAR with one predictor. Would that be a feasible approach or is decomposing the data set the only way to go with seasonality? – N_Moksnes Dec 28 '16 at 9:58
• can you share me your data and your objective ? that will help me! – GD_N Dec 28 '16 at 10:22
• the objective is to forecast the production by using both the historical production and the predictor eg. (with two lags, two seasons represented as dummies) prod=c1*prod(-1)+c2*prod(-2)+c3*flow(-1)+c4*flow(-2)+c5*Dummy1+c6*Dummy2 . My question is if that is a good approach as I have seasonality or if I should take some other measures (like your proposal of decompose)? – N_Moksnes Dec 28 '16 at 11:51