# auto.arima does not recognize seasonal pattern

I have a daily weather data set, which has, unsurprisingly, very strong seasonal effect.

I adapted an ARIMA model to this data set using the function auto.arima from forecast package. To my surprise the function does not apply any seasonal operations- seasonal differencing, seasonal ar or ma components. Here is the model it estimated:

library(forecast)
data<-ts(data,frequency=365)
auto.arima(Berlin)

Series: data
ARIMA(3,0,1) with non-zero mean

Coefficients:
ar1      ar2     ar3      ma1  intercept
1.7722  -0.9166  0.1412  -0.8487   283.0378
s.e.  0.0260   0.0326  0.0177   0.0214     1.7990

sigma^2 estimated as 5.56:  log likelihood=-8313.74
AIC=16639.49   AICc=16639.51   BIC=16676.7


And also the forecasts using this model are not really satisfying. Here is the plot of the forecast:

Can anyone give me a hint what is wrong here?

• Can you post the code (or similar example) that you used to get the output? – rbatt Jul 25 '13 at 17:57
• Hello rbat, I posted the code I used. The raw data is saved under 'data'. I converted it to ts object first – DatamineR Jul 25 '13 at 18:04
• Your MA(1) coefficient (-.84) is suspiciously close to -1 the invertability limit suggesting ( to me ) that you have imposed a bad model specification on the unsuspecting data. Please provide a link to the actual raw data and I will try and help you using a more sophisticated approach than the one that you have current access to. It might shed light on your required solution. – IrishStat Jul 25 '13 at 19:21
• Thank you IrishStat for the offer! I am just confused why 'auto.arima' does not estimate here a seasonal model, although the seasonality is obvious. If I had to estimate a model here, I would probably remove the seasonality with the Fourier method or just seasonally (in this case with lag=365) difference the data. But shouldn't 'auto.arima' do the appropriate differencing? I tried to attach the data, but have found no possibility to do it. How can one insert the data in the question? – DatamineR Jul 25 '13 at 21:09
• If you wish you can send me an email. Attach an excel file with starting date info and I will post it to the group. Please look at my contact info to get my email address. – IrishStat Jul 25 '13 at 21:58

R will not fit an ARIMA model with seasonality greater than 350. See http://robjhyndman.com/hyndsight/longseasonality/ for a discussion of this issue. The solution is to use Fourier terms for the seasonality, and ARMA errors for the short-term dynamics.

The solution to your problem is as Rob points out is to combine deterministic effects (week of the year) and stochastic effects (ARIMA structure) while isolating unusual days and detecting the possible presence of one or more level shifts and/or one or more local time trends. AUTOBOX , the software used for the analysis was in part developed by me to automatically provide robust modeling for data sets like this.

I have placed your data at http://www.autobox.com/weather/weather.txt.

The acf of the original data is which lead to an automatic model selection of the form . The model statistics are with a residual plot of The plot of the forecasts for the next 60 days is presented here THe Actual/Fit/Forecast graph is shown here .

It might be interesting for others to follow Prof. Hyndaman's advice and to report their final model with disgnostic checks regarding residual diagnostics and parameter tests of significance.

I am personally uncomfortable with the suggestion about first performing a fourier analysis (possibly/probably impacted by anomalies) and then doing ARIMA on the residuals is unacceptable as it is not a simultaneous solution leading to 1 equation but rather a presumptive sequence. My equation use week-of-the-month and also included an AR(1) and remedies for the unusual data points.

All software has limitations and it is good to know them. Again I reiterate why doesn't somebody try to implement Rob's suggestions and show the complete results.