# Predict Seasonal Variations

I am developing an application related to pharmaceutical industry. Certain items are sold in significantly higher quantities during specific periods of the year. For example, here in my country, Mebendazole is more in demand during the school vacations.

I am in the process of automatically predicting the reorder quantities of items for a pharmaceutical logistics application.

1. I want to analyse the past data, for example, during the last five years and to know whether there is a significant increase or decrease in the demand during, for example, the next two weeks than the average.

2. If it is significant, I want to calculate the percentage above or below the current years average to decide on reorder quantity.

What are the statistical methods available to achieve these two tasks?

• It sounds to me like you want to build some form of time series model. There are various kinds that can take seasonal and calendar-type effects into account. You might consider structural models, ARIMA models with regressors, and so on. The online forecasting book by Hyndman and Athana­sopou­los is one place to start learning about the kinds of models that may help. Commented Oct 20, 2014 at 23:12
• Many forecasting methods predict from preceding curve. Here why not simply plot average of previous years data of orders against week_number of the year which will graphically predict reorders in coming weeks.
– rnso
Commented Oct 21, 2014 at 2:53
• Can not plot as there about 4000 items. For each item, it is necessary to automatically calculate the orders. Commented Oct 21, 2014 at 15:43

You should use ARIMA models along with some X variables (ARMAX Models) reflecting your knowledge/guess/hypothesis regarding the effects of specific weeks in the year. Intervention detection can be useful to empirically detect the significant weeks perhaps around certain Holidays/Events. You can then use Excel to manipulate these forecasts.

Here average orders per week are known from previous years. Hence one could just predict using those values:

> ddf
week_num order
1         1    10
2         2    20
3         3    15
4         4    10
5         5     5
6         6     5
7         7    10
8         8    15
9         9    20
10       10    10

myfn = function(cur_week_num,cur_order){
a = ddf$order[ddf$week_num==cur_week_num]
next_week_num = ifelse((cur_week_num+1)>10, 1, (cur_week_num+1) )
b = ddf$order[ddf$week_num==next_week_num]
return(cur_order * b/a)
}


If in current 2nd week there are 10 orders, one can predict for next week:

> myfn(2,10)
[1] 7.5