GithubHelp home page GithubHelp logo

Comments (3)

SomeoneSerge avatar SomeoneSerge commented on June 3, 2024

It seems, forecast.TSLM ain't even being run: error probably occurs somewhere in forecast.model which is defined I'm yet to learn where

from fabletools.

mitchelloharawild avatar mitchelloharawild commented on June 3, 2024

This is because you are using an exogenous regressor in your model (Const). When forecasting with exogenous regressors, it is not possible to make predictions without knowing future values of the regressors.

In this case, you would need to provide a tsibble to forecast() containing future time indices to be forecasted, along with the future values of Const.

I'm moving this to fablelite as an improvement to the error message.

For the example above:

library(fable)
library(tsibble)
library(tsibbledata)
library(lubridate)

# Adding a new measurable
aus_retail <-  aus_retail %>% mutate(Const=1)
future_retail <- new_data(aus_retail, n = 24) %>% mutate(Const=1)
aus_retail %>%
  filter(
    State %in% c("New South Wales", "Victoria"),
    Industry == "Department stores"
  ) %>% 
  model(
    lm = TSLM(Turnover~0+Const),
  ) %>%
  forecast(future_retail) %>% 
  autoplot(filter(aus_retail, year(Month) > 2010), level = NULL)

Created on 2019-03-21 by the reprex package (v0.2.1)

from fabletools.

mitchelloharawild avatar mitchelloharawild commented on June 3, 2024

Error is now more informative.

library(tsibble)
library(tsibbledata)
library(lubridate)
library(fable)

aus_retail <-  aus_retail %>% mutate(Const=1)
aus_retail %>%
  filter(
    State %in% c("New South Wales", "Victoria"),
    Industry == "Department stores"
  ) %>% 
  model(
    lm = TSLM(Turnover~0+Const),
  ) %>%
  forecast %>% 
  autoplot(filter(aus_retail, year(Month) > 2010), level = NULL)
#> Error: object 'Const' not found
#> Unable to compute required variables from provided `new_data`.
#> Does your model require extra variables to produce forecasts?

Created on 2019-03-26 by the reprex package (v0.2.1)

from fabletools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.