Skip to content

Refitted model with reconcile() cannot be forecasted #251

@jy-r

Description

@jy-r

After the model is refitted with refit() on new data, it seems to lose attributes method and sparse which causes error in forecast.lst_mint_mdl here . The problem appears to be in refit.mdl_df, where the attributes are lost.

library(tsibble)
library(fabletools)
library(fable)
lung_deaths_agg <- 	as_tsibble(cbind(mdeaths, fdeaths)) %>%
  aggregate_key(key, value = sum(value))

fit <- lung_deaths_agg %>%
  model(lm = TSLM(value ~ trend() + season())) %>%
  reconcile(lm = min_trace(lm)) 

fit_refit <- fit %>% refit(lung_deaths_agg)

fit %>% forecast()
fit_refit %>% forecast()
Error: Problem with `mutate()` input `lm`.
✖ argument is of length zero
ℹ Input `lm` is `(function (object, ...) ...`.
Run `rlang::last_error()` to see where the error occurred.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions