# How to include seasonality in auto arima with regressors in R?

My forecasting variable(monthly sales) is seasonal and wanted to include seasonality in the auto Arima function with regressors.

The distribution of monthly sales data is shown below:

I have used the below code:

#Creating a time-series object
FA = ts(na.omit(usFaceAvg[yrAndMo < endForTsTrain & yrAndMo >= startForTsTrain,]$faceAvg), frequency=12,) #Fitting an Arima model with regressor and for a seasonal time series usFaceAvgArima <- auto.arima(FA, trace = F, ic = c("bic"), xreg = tempUsSumOfFaceCountryTrainRegressor, seasonal = TRUE) #Forecasting usFaceAvgArima.forecast <- data.table(timeHorizon[yrAndMo >= endForTsTrain], usFaceAvgForecast = forecast(usFaceAvgArima, 12, xreg = tempUsSumOfFaceCountryTestRegressor)$mean)


Is this correct? Should I create dummy binary variables for seasonality and use them as regressors?

I tried to use without considering seasonality (Seasonal = FALSE & not specifying the frequency in ts()), but the forecast remained the same.

How can I successfully include the prevailing seasonality in the monthly sales data?

Any inputs will be appreciated.

The residual, ACF and PACF plots for usFaceAvgArima residuals are as shown below: [![ACF Plot of residuals][3]][3] [![PACF plot of residuals][4]][4]

• In forecast::auto.arima, setting the argument seasonal to TRUE does not necessarily result in a seasonal model; it allows the model search to include such models as candidates. One reason why the chosen model does not include seasonality could be that the regressor you use sufficiently explains the seasonality, and there is none left to model. Another could be that seasonality is not really present, or is of a nature that can't be easily captured by a seasonal ARIMA model. It might be helpful to post your data. – Chris Haug Jul 28 '17 at 19:38
• @ChrisHaug - Thank youvery much! I appreciate it! I have plotted the seasonal plot using stl() and plot() function. Seasonality is very evident in the plot. Do you think still there could no sesonality? Unfortunately, I am not authorized to share the data. – Vicky007 Jul 28 '17 at 19:53
• Take a look at residuals(usFaceAvgArima). Does it look seasonal? If you do pacf and acf plots of those residuals, is there anything going on at 12 lags? – Chris Haug Jul 28 '17 at 20:02
• @ChrisHaug - I have posted the graphs, it did not let me post more than 2. In the ACF and PACF plots of the residuals, all the points are within the significance boundaries and free of auto correlation. – Vicky007 Jul 28 '17 at 21:05
• If the ACF/PACF plots of the residuals for the model which includes tempUsSumOfFaceCountryTrainRegressor as a regressor but no seasonal ARIMA component do not show any significant lags, then there is no remaining seasonality to model, so auto.arima probably will not include any. It means that the seasonality of both your time series and the regressor are similar enough as to explain it entirely. – Chris Haug Jul 29 '17 at 3:25