# Daily forecasting using ARIMA in R

I am new to time series modeling in R. I have sales data of one year and three months only. I am trying to do sales forecasting at the day level or max at the week level. Following is the step I intend to follow

1. Convert it into time series object using ts(data\$qty, frequency= ??). Here I am very confused about frequency. I can see in data that there is some seasonality like sales is picking up in May, June, July and then again in festival seasons. I guess I cannot use 365 as I have only one year data. Please suggest what should be the frequency
2. Decompose the time series. Subtract the seasonality and trend from the actual time series model
3. Fit ARIMA to get a prediction
4. Again add seasonality and trend to output the final forecast

Please provide feedback on this if its correct approach or not or if there is any other better way to handle it.

• Trust me when I say this. If you're going to analyze seasonality and time series in general you need > 2 observations per time unit ( may it be days, weeks or months). – Dr. Mike Jul 17 '13 at 12:18
• This is true Dr. Mike, but if you only have 1 year and 3 months you will have to use it...we recommend 3 years for daily so you can get a read on holidays as there would have been a weekend and a weekday read. – Tom Reilly Jul 17 '13 at 12:29
• Thanks Dr. Mike .. I understand now the error in my approach . what do you suugest should be the best approach – pankaj jha Jul 17 '13 at 19:29

No need to subtract any seasonality.

I would recommend using a regression model with NO ARIMA component. Bring in 6 day of the week dummy variables, 11 month of the year variables, holiday variables while searching for outliers, level shifts, trend. Removing variables ("stepdown") that are not necessary and bringing ("stepup") in dummies for the outliers I listed.

We recommend using 3 years of data in order for holidays to exist on weekends and weekdays so that you can get an overall read on the lead and lag relationships. You can also search for day of the month dummy variables, but this is typically only necessary for CASH demand type problems. You can find the need to specify a week of the month dummy for special cases as well.

You can build a pivot table in Excel to compare the coefficients in the model to the % of the total for the day of the week and month of the year to get a "poor man's model" to confirm that the coefficients make sense.

• Thanks Tom for replying. I understand it is difficult to handle seasonality with one year data. I am trying the regression approach suggested by you and will share the result. Also I was trying to fit arima simply. I was informed by my clients that they are getting good result from moving average only . So I thought ARIMA will for sure improve on that. Any Comment on this approach – pankaj jha Jul 17 '13 at 19:25
• We agree that it is difficult with such a short dataset, but these are the cards you were dealt. ARIMA lag 7 could be used, but if you consider forecasting accuracy from many origins you might see disaster around holidays. Post your data and state the starting date and country where the data resides and we can take a look. – Tom Reilly Jul 18 '13 at 11:39
• You can also post your model and results to dropbox.com – Tom Reilly Jul 18 '13 at 11:53
• Thanks Tom , I am trying the regression approach as it will help the client to visualize the seasonality in a better way(by coefficient of different months and days of week as well). But one small question how to handle yearly growth . As the business is new I can see there is decent growth in volume of business from last year. I have included the monthly dummy variables, days of week , holidays and even daily promotional offers. But still results is not coming in the desirable variance. Any help would be greatly appreciated – pankaj jha Jul 19 '13 at 13:03
• Tom, When you recommended "a regression model with NO ARIMA" do you mean using a simple multi-variate linear regression model by creating those dummy variables for week/month? – jjreddick Nov 21 '14 at 18:15