Auto-Arima creates a straight line help
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty{ margin-bottom:0;
}
up vote
2
down vote
favorite
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
install.packages("forecast")
install.packages("scales")
library(forecast)
datos <-read.csv("C:/Users/sarit/Documents/SÉPTIMO CUATRI/iieg/dator.csv",header=T)
monto=datos$monto.XVI
montots<-ts(monto)
montots<-ts(monto,frequency = 12,start = c(2007,1), end = c(2018,8))
montots
plot(montots)
auto.arima(montots)
fit=arima(montots,order=c(0,1,0))
a=forecast(fit,h=5)
plot(forecast(fit,h=5))
So basically, with the autoarima function i get (0,1,0), and when i plot the forecast i get a straight line like this:
my data looks like this
thank you
r time-series forecasting arima prediction
add a comment |
up vote
2
down vote
favorite
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
install.packages("forecast")
install.packages("scales")
library(forecast)
datos <-read.csv("C:/Users/sarit/Documents/SÉPTIMO CUATRI/iieg/dator.csv",header=T)
monto=datos$monto.XVI
montots<-ts(monto)
montots<-ts(monto,frequency = 12,start = c(2007,1), end = c(2018,8))
montots
plot(montots)
auto.arima(montots)
fit=arima(montots,order=c(0,1,0))
a=forecast(fit,h=5)
plot(forecast(fit,h=5))
So basically, with the autoarima function i get (0,1,0), and when i plot the forecast i get a straight line like this:
my data looks like this
thank you
r time-series forecasting arima prediction
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
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
install.packages("forecast")
install.packages("scales")
library(forecast)
datos <-read.csv("C:/Users/sarit/Documents/SÉPTIMO CUATRI/iieg/dator.csv",header=T)
monto=datos$monto.XVI
montots<-ts(monto)
montots<-ts(monto,frequency = 12,start = c(2007,1), end = c(2018,8))
montots
plot(montots)
auto.arima(montots)
fit=arima(montots,order=c(0,1,0))
a=forecast(fit,h=5)
plot(forecast(fit,h=5))
So basically, with the autoarima function i get (0,1,0), and when i plot the forecast i get a straight line like this:
my data looks like this
thank you
r time-series forecasting arima prediction
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
install.packages("forecast")
install.packages("scales")
library(forecast)
datos <-read.csv("C:/Users/sarit/Documents/SÉPTIMO CUATRI/iieg/dator.csv",header=T)
monto=datos$monto.XVI
montots<-ts(monto)
montots<-ts(monto,frequency = 12,start = c(2007,1), end = c(2018,8))
montots
plot(montots)
auto.arima(montots)
fit=arima(montots,order=c(0,1,0))
a=forecast(fit,h=5)
plot(forecast(fit,h=5))
So basically, with the autoarima function i get (0,1,0), and when i plot the forecast i get a straight line like this:
my data looks like this
thank you
r time-series forecasting arima prediction
r time-series forecasting arima prediction
asked Nov 19 at 6:37
sarah lopez
132
132
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
6
down vote
accepted
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, $$
or
$$ y_t=y_{t-1} + epsilon_t. $$
That is, you believe that the increments over the last observation follow a normal distribution, $epsilon_tsim 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.
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
– sarah lopez
Nov 26 at 1:17
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
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, $$
or
$$ y_t=y_{t-1} + epsilon_t. $$
That is, you believe that the increments over the last observation follow a normal distribution, $epsilon_tsim 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.
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
– sarah lopez
Nov 26 at 1:17
add a comment |
up vote
6
down vote
accepted
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, $$
or
$$ y_t=y_{t-1} + epsilon_t. $$
That is, you believe that the increments over the last observation follow a normal distribution, $epsilon_tsim 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.
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
– sarah lopez
Nov 26 at 1:17
add a comment |
up vote
6
down vote
accepted
up vote
6
down vote
accepted
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, $$
or
$$ y_t=y_{t-1} + epsilon_t. $$
That is, you believe that the increments over the last observation follow a normal distribution, $epsilon_tsim 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.
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, $$
or
$$ y_t=y_{t-1} + epsilon_t. $$
That is, you believe that the increments over the last observation follow a normal distribution, $epsilon_tsim 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.
answered Nov 19 at 7:08
Stephan Kolassa
43.3k690157
43.3k690157
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
– sarah lopez
Nov 26 at 1:17
add a comment |
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
– sarah lopez
Nov 26 at 1:17
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
– sarah lopez
Nov 26 at 1:17
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
– sarah lopez
Nov 26 at 1:17
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f377723%2fauto-arima-creates-a-straight-line-help%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown