tidyverts / fabletools

General fable features useful for extension packages
http://fabletools.tidyverts.org/
89 stars 31 forks source link

Error in `wrap_arima()`: When calling refit #390

Open atrevidoantonio opened 5 months ago

atrevidoantonio commented 5 months ago

Hello,

I am experiencing an issue when calling refit on a test dataframe object. I've called this multiple times in the past and never experienced this issue and am unsure how to proceed to correct the error. This is the error that is printed when I call refit on my test tsibble,

Error in `mutate()`:
ℹ In argument: `arima = (function (object, ...) ...`.
Caused by error in `wrap_arima()`:
! wrong length for 'fixed'

Here's my code,

library(tidyverse)
library(dplyr)
library(ggplot2)
library(extrafont)
library(ggh4x)
library(ggpubr)
library(tsibble)
library(fable)
library(fabletools)
library(feasts)

market_df <- read_csv("./market_data.csv")

market_ts <-
  market_df |>
  as_tsibble(index = date,
             key = c(market, state, census_region, region, sb_region))
train <- filter(market_ts, date <= "2023-05-25")
test <- filter(market_ts, date > "2023-05-25")

linear_fits <- train |>
  model(
    tslm = TSLM(appointment_value ~ national_tv + local_tv + youtube + radio + meta + search + liposuction + season() + trend()),
    tslm_lipo = TSLM(appointment_value ~ national_tv + local_tv + youtube + radio + meta + search + liposuction + season_week + season_year),
    arima = ARIMA(appointment_value ~ national_tv + local_tv + youtube + radio + meta + search + liposuction, stepwise = FALSE)
  )

linear_fits |>
 refit(test)
  accuracy()