AlbertoAlmuinha / garchmodels

The Tidymodels Extension for GARCH models

Home Page:https://albertoalmuinha.github.io/garchmodels/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problems in validating the arguments.

CarlosViniMSouza opened this issue · comments

During the tests that I did on my computer (following the tutorial provided in the repository), I had some problems, below I will put the code (and the result printed by the terminal after the execution of each block of code):

install.packages("garchmodels")
install.packages("timetk")
install.packages("tidymodels")
install.packages("tidyverse")
install.packages("devtools")
devtools::install_github("AlbertoAlmuinha/garchmodels")

library(garchmodels)
library(timetk)
library(tidymodels)
library(tidyverse)

-------------------------------------------------------------------------

rIBM

exit :

#> # A tibble: 3,523 x 2
#> date daily_returns
#>
#> 1 2007-01-03 0.000926
#> 2 2007-01-04 0.0107
#> 3 2007-01-05 -0.00905
#> 4 2007-01-08 0.0152
#> 5 2007-01-09 0.0118
#> 6 2007-01-10 -0.0118
#> 7 2007-01-11 -0.00243
#> 8 2007-01-12 0.00699
#> 9 2007-01-16 0.0149
#> 10 2007-01-17 -0.00793
#> # ... with 3,513 more rows

-------------------------------------------------------------------------

rIBM_extended <- rIBM %>%
future_frame(.length_out = 3, .bind_data = TRUE)

exit : .date_var is missing. Using: date

-------------------------------------------------------------------------

rIBM_train <- rIBM_extended %>% drop_na()
rIBM_future <- rIBM_extended %>% filter(is.na(daily_returns))

exit :

-------------------------------------------------------------------------

model_fit_garch <-garchmodels::garch_reg(mode = "regression",
arch_order = 1,
garch_order = 1,
ma_order = 0,
ar_order = 0) %>%
set_engine("rugarch", mean.model = list(include.mean = FALSE)) %>%
fit(daily_returns ~ date, data = rIBM_train)

exit : Error in loadNamespace(name) : there is no package called 'modeltime' Timing stopped at: 0.01 0 0.01

-------------------------------------------------------------------------

plot(model_fit_garch$fit$models$model_1, which = 2)
#>
#> please wait...calculating quantiles...

exit : Error in h(simpleError(msg, call)) : error in the evaluation of the argument 'x' in the selection of the method for the function 'plot': 'object' model_fit_garch 'not found'

-------------------------------------------------------------------------

predict(model_fit_garch, rIBM_future)

exit : Error in predict(model_fit_garch, rIBM_future) : 'object' model_fit_garch 'not found'

model_fit_garch <-garchmodels::garch_reg(mode = "regression",
arch_order = 1,
garch_order = 1,
ma_order = 2,
ar_order = 2) %>%
set_engine("rugarch") %>%
fit(daily_returns ~ date, data = rIBM_train)

exit : Error in loadNamespace(name) : there is no package called 'modeltime' Timing stopped at: 0 0 0

-------------------------------------------------------------------------

plot(model_fit_garch$fit$models$model_1, which = 2)

exit : Error in h(simpleError(msg, call)) : error in the evaluation of the argument 'x' in the selection of the method for the function 'plot': 'object' model_fit_garch 'not found'

-------------------------------------------------------------------------

plot(model_fit_garch$fit$models$model_1, which = 3)

Error in h(simpleError(msg, call)) : error in the evaluation of the argument 'x' in the selection of the method for the function 'plot': 'object' model_fit_garch 'not found'

-------------------------------------------------------------------------

predict(model_fit_garch, rIBM_future)

exit : Error in predict(model_fit_garch, rIBM_future) : object 'model_fit_garch' not found

-------------------------------------------------------------------------

there is an instruction or library that was not in the tutorial ? : Getting Started with Garchmodels
(I would like to apologize for my issue being too long, I don't know any other way to communicate the other that I found. 👋)

Hi @CarlosViniMSouza ,

Do you have the modeltime package installed? That seems to be the problem.

Try install.packages("modeltime") and let me know if it fixes the problem.

I just installed the modeltime package, and it worked! 👍
Thanks for help me ! 👋