Over a million developers have joined DZone.

The R Language and Flat Forecasts

DZone's Guide to

The R Language and Flat Forecasts

· Big Data Zone ·
Free Resource

Hortonworks Sandbox for HDP and HDF is your chance to get started on learning, developing, testing and trying out new features. Each download comes preconfigured with interactive tutorials, sample data and developments from the Apache community.

About once a week some­one will tell me there is a bug in my fore­cast pack­age for R because it gives fore­casts that are the same for all future hori­zons. To save answer­ing the same ques­tion repeat­edly, here is my response.

A point fore­cast is (usu­ally) the mean of the dis­tri­b­u­tion of a future obser­va­tion in the time series, con­di­tional on the past obser­va­tions of the time series. It is pos­si­ble, even likely in some cir­cum­stances, that the future obser­va­tions will have the same mean and then the fore­cast func­tion is flat.

  • A ran­dom walk model will return a flat fore­cast func­tion (equal to the last observed value of the series).
  • An ETS(A,N,N) model will return a flat fore­cast function.
  • An iid model will return a flat fore­cast func­tion (equal to the mean of the observed data).

This is not a bug. It is telling you some­thing about the time series — namely that there is no trend, no sea­son­al­ity, and insuf­fi­cient tem­po­ral dynam­ics to allow the future obser­va­tions to have dif­fer­ent con­di­tional means.

I dis­cussed this once with another con­sul­tant and he told me that he some­times adds some ran­dom noise to his fore­casts, just to stop his clients ques­tion­ing the flat fore­cast func­tions. Unfor­tu­nately, that increases the fore­cast error, but he thought it was bet­ter to give them what they wanted rather than what was best!



Hortonworks Community Connection (HCC) is an online collaboration destination for developers, DevOps, customers and partners to get answers to questions, collaborate on technical articles and share code examples from GitHub.  Join the discussion.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}