Auto-Arima creates a straight line help












2












$begingroup$


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:
enter image description here



my data looks like thisenter image description here



thank you










share|cite|improve this question









$endgroup$

















    2












    $begingroup$


    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:
    enter image description here



    my data looks like thisenter image description here



    thank you










    share|cite|improve this question









    $endgroup$















      2












      2








      2


      1



      $begingroup$


      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:
      enter image description here



      my data looks like thisenter image description here



      thank you










      share|cite|improve this question









      $endgroup$




      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:
      enter image description here



      my data looks like thisenter image description here



      thank you







      r time-series forecasting arima prediction






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Nov 19 '18 at 6:37









      sarah lopezsarah lopez

      1312




      1312






















          1 Answer
          1






          active

          oldest

          votes


















          6












          $begingroup$

          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.






          share|cite|improve this answer









          $endgroup$













          • $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





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "65"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          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

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          6












          $begingroup$

          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.






          share|cite|improve this answer









          $endgroup$













          • $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
















          6












          $begingroup$

          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.






          share|cite|improve this answer









          $endgroup$













          • $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














          6












          6








          6





          $begingroup$

          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.






          share|cite|improve this answer









          $endgroup$



          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.







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Nov 19 '18 at 7:08









          Stephan KolassaStephan Kolassa

          45k693163




          45k693163












          • $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


















          • $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
















          $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




          $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


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Cross Validated!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          How to pass form data using jquery Ajax to insert data in database?

          National Museum of Racing and Hall of Fame

          Guess what letter conforming each word