-1

I conduct time series by day for SALES. I have dataset with data by day. (format 01.11.2015-29.11.2015). Here the example:

dput
DAY        STORE    ART     SALES
01.11.2015  1534    343533  62.5000
01.11.2015  25039   20490   686.4480
01.11.2015  1612    295206  185.0000
01.11.2015  1053    16406274    32.5000
01.11.2015  1612    49495   143.1196
01.11.2015  961 15309949    50.9000

How to do forecast for all shops and ART ot once, how to split my analysis on two factor?

#
library('ggplot2')
library('forecast')
library('tseries')


mydat=read.csv("C:/Users/synthex/Downloads/sales.csv", sep=";",dec=",")
View(mydat)
str(mydat)


count_ts = ts(mydat[, c('SALES')])
View(count_ts)

mydat$clean_cnt = tsclean(count_ts)



mydat$cnt_ma = ma(mydat$clean_cnt, order=7) # using the clean count with no outliers
mydat$cnt_ma30 = ma(mydat$clean_cnt, order=30)

count_ma = ts(na.omit(mydat$cnt_ma), frequency=30) 
decomp = stl(count_ma, s.window="periodic")
deseasonal_cnt <- seasadj(decomp)
plot(decomp) 


adf.test(count_ma, alternative = "stationary") 



auto.arima(deseasonal_cnt, seasonal=FALSE)


fit<-auto.arima(deseasonal_cnt, seasonal=FALSE)

tsdisplay(residuals(fit), lag.max=45, main='(1,1,0) Model Residuals')



fit2 = arima(deseasonal_cnt, order=c(1,1,7))


fcast <- forecast(fit2, h=1)
psysky
  • 3,037
  • 5
  • 28
  • 64

2 Answers2

1

D.Joe,

You are not specifying your start argument right. If you check at ?ts, this is what it says in the documentation about the aforementioned argument.

start:
the time of the first observation. Either a single number or a vector of two integers, which specify a natural time unit and a (1-based) number of samples into the time unit. See the examples for the use of the second form.

If you want to start in a particular day, this is not the way to do it. You can take a look at how to do manage this particular scenario here

starting a daily time series in R

Anyways, Holt Winters is not the best option to work with daily data. Is there any particular reason why you are using this method? You can find some ways of working with daily data here.

R: Holt-Winters with daily data (forecast package)

Neoromanzer
  • 434
  • 2
  • 15
  • i edited my question ,after watch starting a daily time series in R, but the forecact was strange (( Can you help me? – psysky Nov 01 '17 at 19:01
  • here the data .csv https://www.sendspace.com/file/m5wa4q it;s 30 days 01-11-2015 to 29-11-2015, i must predict 30-11-2015 sales , nearly 830 000 obs – psysky Nov 01 '17 at 19:18
  • Thank you. I tried, and all is ok) but what i need ,to do forecast for all shops and and ART ot once, how to split my analysis on two factor/ i edited my post) – psysky Nov 02 '17 at 12:02
0

Would it be fair to assume that your data is actually aggregated by ART by STORE and you want to find forecast for all ART categories for all STORES by a single methodology? If it is the case I believe what you need is the functionality of hts package in R. It will give forecast for all ART and STORE at the same time and also offers plotting functionality. What you need is to supply the "grouping matrix" of the ART under STORE along with the TOTAL SALES assumption. Without knowing group structure it is not possible to provide example code.

raa
  • 11
  • 4