Forecast daily data (5 working day) using ARIMA in R

r
time_series
rstudio

#1

Hi as I am working on a project to forecast qty for next 6 months as well as next 30 days, I have daily data from 03-Jan-17 till 1-may-18. excluding sat and sun. what will be the best approach to plot Time series? I have attached sample data. data link https://drive.google.com/open?id=11TGbDhDw_2W-Hdy-5FibcW_GIXgo7WOM

Date QTY
1/3/2017 22
1/4/2017 354
1/5/2017 316
1/6/2017 299
1/9/2017 367
1/10/2017 200
1/11/2017 855
1/12/2017 1869
1/13/2017 1595
1/16/2017 510

My approach
library(forecast)

library(dplyr)

library(rvest)

library(tseries)

library(ggplot2)

setwd(“C:\Users\vaibhav\Downloads\R”)

data<-read.csv(“data1.csv”)

salests<-ts(data[,2],frequency=365)

stationary
diff1<-diff(salests)

adf.test(diff1,alternative=“stationary”)

ggplot(data,aes(Date.Recd.Time,Lines)) + geom_line()

plot(diff1)

acf(diff1) #0,1

pacf(diff1)

auto.arima(diff1,seasonal = TRUE)

model1<-arima(diff1,order = c(1,0,3))

pred<-forecast(model1,30)

plot(pred)

checkresiduals(pred)


#2

Hi @nitish29, try adding diff1 to data dataframe and then plot it using ggplot. Refer the code below.

data$diff1 = diff1

ggplot(mydata) + geom_line(aes(Date.Recd.Time, diff1,group=1))

#3

Actually, I am facing the problem while converting my DF to TS, as I have 18 months data except for holidays and weekends. when I convert my DF to TS, the date column changes to some unknown String, I don’t know how to deal with this. can you help me with the code? Here is the data https://drive.google.com/open?id=11TGbDhDw_2W-Hdy-5FibcW_GIXgo7WOM