Predict future values using Arma

3.5k Views Asked by At

I have a sales data for 51 points. I want to predict the say 10 more future values. It is a sales data and hence seasonal but the data points are very few for predicting seasonality. When I used time series it maybe tried to fit and gave "103" as the results for all the next prediction. I thought using ARMA would help but after fitting to ARMA and using forecast() I still got the same output. I am new to trending and forecasting and do not know if there are different methods other than regression may be to predict future values. Kindly help.

Data:

Product    23  22  21  31  29  13  15  20  15  26  11  24  14  18  15  21  25  23  27  30  19  18  20  13  23  40  14  15  20  14  9   22  14  24  26  22  23  16  24  19  14  10  17  12  11  15  9   24  17  22  28

The code I used:

library("tseries")
arma<-arma(Product)
final<-forecast(arma,10)
2

There are 2 best solutions below

0
On

Fitting an ARIMA-model to your data, results in a ARIMA(0,0,0), which means that the fitted values depend on 0 previous observations and 0 previous fitting error. This again means that the best predictor the ARIMA-model can make (based on this data) is a constant. It will, for every observation, regardless of previous observations, predict the same value.

library(forecast)
df <- c(23,  22,  21,  31,  29,  13,  15,  20,  15,  26,  11,  24, 14,  18,  15,  21, 
    25,  23 , 27,  30,  19,  18 , 20 , 13 , 23 , 40  ,14 , 15 , 20  ,14 , 9  , 22  ,
    14 , 24  ,26  ,22 , 23 , 16 , 24 , 19  ,14 , 10  ,17 , 12,  11,  15 , 9  , 24 , 1,
    7,  22,  28)


 # auto.arima() selects the ARIMA(r, s, q) model with the highest AIC-score:
 (auto.arima(df))
 # Series: ts 
 # ARIMA(0,0,0) with non-zero mean 

 #Coefficients:
 #    intercept   19.0000
 #    s.e.        0.9642

 # sigma^2 estimated as 49.29:  log likelihood=-174.62
 # AIC=353.25   AICc=353.49   BIC=357.15

 forecast.Arima(object = auto.arima(df), h = 10)
 #    Point    Forecast    Lo 80    Hi 80    Lo 95    Hi 95
 #    53             19 10.00226 27.99774 5.239138 32.76086
 #    54             19 10.00226 27.99774 5.239138 32.76086
 #    55             19 10.00226 27.99774 5.239138 32.76086
 #    56             19 10.00226 27.99774 5.239138 32.76086
 #    57             19 10.00226 27.99774 5.239138 32.76086
 #    58             19 10.00226 27.99774 5.239138 32.76086
 #    59             19 10.00226 27.99774 5.239138 32.76086
 #    60             19 10.00226 27.99774 5.239138 32.76086
 #    61             19 10.00226 27.99774 5.239138 32.76086
 #    62             19 10.00226 27.99774 5.239138 32.76086
4
On

Your question is missing some details, like the order of the ARMA model you want to fit and the code you used. Considering that 103 is way larger than any of the values you have given us, I'd suspect that there is an error in your code.
Here's an implementation for ARMA(1,1) that should work:

data<-strsplit("23  22  21  31  29  13  15  20  15  26  11  24  14  18  15  21  25  23  27  30  19  18  20  13  23  40  14  15  20  14  9   22  14  24  26  22  23  16  24  19  14  10  17  12  11  15  9   24  17  22  28",split="  ")
data<-as.numeric(data[[1]])
mod<-arima(data,order=c(1,0,1))
pred<-predict(mod,n.ahead=10)
pred
plot(c(data,pred$pred),type="l")

EDIT: Ken is right, btw, an ARMA model doesn't seem that useful for your data and the predictions will mostly be given by the intercept term.