I'm trying to create a forecast using autoarima with some data, but i always get a straight-line, can someone please help me? :) This is what i've got so far

datos <-read.csv("C:/Users/sarit/Documents/SÉPTIMO CUATRI/iieg/dator.csv",header=T)
montots<-ts(monto,frequency = 12,start = c(2007,1), end = c(2018,8))

So basically, with the autoarima function i get (0,1,0), and when i plot the forecast i get a straight line like this: enter image description here

my data looks like thisenter image description here

thank you


Note first of all that your plot does not come from a call to auto.arima(), but from one to arima(). There is a difference.

By supplying order=c(0,1,0) to arima(), you tell it to fit a model of the following type:

$$ y_t-y_{t-1} = \epsilon_t, $$


$$ y_t=y_{t-1} + \epsilon_t. $$

That is, you believe that the increments over the last observation follow a normal distribution, $\epsilon_t\sim N(0,\sigma^2)$.

For your point forecast, forecast() will use the expected value for $\epsilon_t$. Which is zero. So your next forecast is simply the last observation:

$$ \hat{y}_t=y_{t-1}. $$

And this is iterated. You end up with a flat line.

Try actually fitting using auto.arima(). However, your time series does not exhibit any obvious structure, like trend or seasonality. (Autoregressive or moving average behavior are harder to spot by eye.) In such a situation, a flat line may well be the best forecast: Is it unusual for the MEAN to outperform ARIMA?

You may be interested in the excellent free online book Forecasting: Principles and Practice (2nd ed.) by Athanasopoulos & Hyndman.

  • $\begingroup$ Thank you!! I was wondering, would you use another type of function for this kind of data? Because I tried using the auto.arima fitting but still doesn't work $\endgroup$ – sarah lopez Nov 26 '18 at 1:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.