Search code examples
rtime-seriespredictionarimaforecast

small Time Series Analysis


I need to make a prediction for the next 2 years. However, I have a very small amount of Data. Data:

   structure(list(BelegDat = structure(c(16801, 16832, 16861, 16892, 
    16922, 16953, 16983, 17014, 17045, 17075, 17106, 17136, 17167, 
    17198, 17226, 17257, 17287, 17318, 17348, 17379, 17410, 17440, 
    17471, 17501, 17532, 17563, 17591, 17622, 17652, 17683, 17713, 
    17744, 17775, 17805, 17836, 17866, 17897, 17928, 17956, 17987, 
    18017, 18048, 18078, 18109, 18140, 18170, 18201, 18231), class = "Date"), 
        Value = c(37, 28, 37, 47, 37, 28, 37, 37, 19, 37, 37, 28, 
        40, 30, 40, 50, 40, 30, 40, 40, 20, 40, 40, 30, 30, 40, 30, 
        30, 40, 30, 30, 50, 30, 50, 20, 20, 60, 20, 60, 40, 20, 10, 
        40, 20, 20, 10, 44, 33)), row.names = c(NA, -48L), class = "data.frame")

I am using ARIMA:

myts <- ts(df_ready[,2], start=c(2016,01), end=c(2019,12), frequency = 12)

fit <- auto.arima(myts)

pred <- forecast(fit, 24) # next 2 years (24 Months)
plot(pred)

My output: Output

Could you, please, show me my mistake / suggest some other way how this prediction can be done?

Thank you in advance!


Solution

  • There is an argument in auto.arima called D. We need to set it to 1 in order to force arima to use a seasonal model. In this case,

    m1 <- ts(df$Value, start = min(df$BelegDat), frequency = 12)
    autoplot(forecast(auto.arima(m1, D = 1), 24)) 
    

    which gives,

    enter image description here