# Time Series Case Study [closed]

In time series, to forecast for 6 months, how much past data is sufficient ? I am having 13 years of data in file in which the first 3-4 years data is going down and then data is going up for the last 9 years?

"Sufficient" is a relative term.

I assume that you have monthly data. You can forecast out from very short series, even from a single observation (the forecast will then necessarily be a repetition of that observation). One would expect accuracy to increase as history length increases, although of course, accuracy is first of all more variable for short series.

Whether the accuracy from a short series is "sufficient" for your purposes, and whether the improvement from more data (or a deeper understanding of your series) is worth the added expense depends on what you plan on using the forecast for.

And of course, the relationship of "more data implies higher accuracy" is a bit tenuous. Below, I use a monthly series from the M3 competition and successively fit auto.arima() models to the last 1, 2, ... observations. I then plot the RMSE against the length of the history used. In general, the RMSE goes down. (It doesn't necessarily - just look at other series by changing the ii to any value between 1402 and 2829, the monthly series.) However, in between there are sharp spikes. I assume (but have not investigated) that these are lengths at which auto.arima() switches between seasonal and nonseasonal models. Shooting itself in the foot now and then.

R code:

library(forecast)
library(Mcomp)

which(sapply(M3,"[","period")=="MONTHLY")   # indices of MONTHLY series
ii <- 1407  # a MONTHLY series

history_length <- 1:length(M3[[ii]]\$x)

acc <- matrix(nrow=length(history_length),ncol=8)
rownames(acc) <- history_length
colnames(acc) <- colnames(accuracy(forecast(auto.arima(tail(M3[[ii]]$$x,1)),h=6),M3[[ii]]$$xx))

for ( hh in history_length ) {
acc[hh,] <- accuracy(forecast(auto.arima(tail(M3[[ii]]$$x,hh)),h=6),M3[[ii]]$$xx)[2,]
}

plot(history_length,acc[,"RMSE"],type="o",pch=19,xlab="History Length",ylab="RMSE")

• Thanks, but I am working on some assignment, and need the good accuracy model. I know increasing historical data beyond certain point doesn't make sense. But in general, to make model with good accuracy, ideally last 5 years or 7 years is sufficient?? – Sunil Raperia Sep 17 at 8:55
• As I wrote, "good" is relative and subjective. I personally would feel OK about at least three years of data. Assuming there are no demand drivers that need to be modeled. – S. Kolassa - Reinstate Monica Sep 17 at 9:17