Skip to content

VARIMA, logs of variables and measures of forecast accuracy for the training dat #438

@newsagent

Description

@newsagent

Using a data set from the book, I run the following VARIMA model.

 library(fpp3)
 google_stock <- gafa_stock |>  filter(Symbol == "GOOG", year(Date) >= 2015) |>  mutate(day = row_number()) |>
  update_tsibble(index = day, regular = TRUE)

google_2015 <- google_stock |> filter(year(Date) == 2015)
fit<- google_2015 |>  model(VARIMA(vars(log(Open), log(High)) ))  

I get this warning when I am trying to get the measures of forecast accuracy for the training data set (google_2015).

fit %>% forecast:: accuracy()
Error in `mutate()`:
ℹ In argument: `fit = map(fit, accuracy, measures = measures, ...)`.
Caused by error in `gather()`:
! Can't select columns that don't exist.
✖ Column `Open` doesn't exist.
Run `rlang::last_trace()` to see where the error occurred.

Without the transformation of the variables I can easily get these measures for the training data set

fit2<- google_2015 |>  model(VARIMA(vars(Open, High) ))  
fit2 %>% forecast:: accuracy()

# A tibble: 2 × 12
  Symbol .model   .response .type       ME  RMSE   MAE     MPE  MAPE  MASE RMSSE
  <chr>  <chr>    <fct>     <chr>    <dbl> <dbl> <dbl>   <dbl> <dbl> <dbl> <dbl>
1 GOOG   VARIMA(… Open      Trai…  0.00876  9.48  4.94 -0.0176 0.805 0.698 0.788
2 GOOG   VARIMA(… High      Trai… -0.00235 10.4   6.09 -0.0271 0.994 0.988 0.962

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions