Solved – Sales forecasting with non-stationary data

arimaforecastingstationaritytime series

I would like to do sales prediction based on my sales data for a particular product for a year. I understand this is non-stationary data which needs to be converted into stationary data and modeled using auto.arima() to do forecasting for the next 30 days. I would appreciate if anyone can help me on this using R as I am new to this domain.

Date       Code    Sales      
 2015-01-01 65323     2 
 2015-01-02 65323     1 
 2015-01-03 65323     3 
 2015-01-04 65323     3 
 2015-01-05 65323     2 
 2015-10-05 65323     1 
 2015-10-06 65323     1 
 2015-10-11 65323     1 
 2015-10-14 65323     1 
 2015-10-17 65323     2 
 2015-10-18 65323     1 
 2015-10-21 65323     1 
 2015-10-24 65323     1 
 2015-10-25 65323     2 
 2015-10-26 65323     1 
 2015-10-28 65323     1 
 2015-10-31 65323     2 
 2015-11-02 65323     1 
 2015-11-03 65323     1 
 2015-11-05 65323     1 
 2015-11-06 65323     1 
 2015-11-07 65323     1 
 2015-11-10 65323     2 
 2015-11-14 65323     3 
 2015-11-16 65323     1 
 2015-11-17 65323     1 
 2015-11-18 65323     1 
 2015-11-22 65323     3 
 2015-11-23 65323     3 
 2015-11-26 65323     3 
 2015-11-27 65323     2 
 2015-11-29 65323     4

Best Answer

Try to re-edit data into a doable way. You can manually type them in CSV file. Once you do it, use R studio to read the data and do the following (you can even copy and paste):

data <-  ts(XXXX,start=c(2005,01,01),frequency=365) # creating a time series object where XXX is the name of CSV file

growth <- diff(log(data)) #the way to handle non-stationary data. difference of log implements growth rate of sales

library("forecast", lib.loc="/Library/Frameworks/R.framework/Versions/3.2/Resources/library") # instilling forecast package. If you have not got it, download it.

model <- auto.arima (growth) #that is your model

forecast(model,h=30) #this will do a simple 30 days forecast

Note this is growth rate of sales. to get predicted sales figure, you need convert back.