Hi, I would like some advice on a persistent error using forecast::autolayer()
. The error is:
Error: Invalid input: date_trans works with object class Date only...
This error happens with a rmarkdown script with the following set up
MyDeleteItems<-ls()
rm(list=MyDeleteItems)
knitr::opts_knit$set(root.dir='~/Dropbox/Teaching/TSFE/FIN7028')
knitr::opts_chunk$set(echo = FALSE,cache=TRUE,warning = FALSE, message = FALSE)
library(fpp2)
library(knitr)
library(kableExtra)
library(tidyr)
library(dplyr)
load("data/fin7028_dat.RData")
all<-ls()
keep<-c('vix_ts','r2000r_m_ts',"indices_m","ftse_m_ts","next_m_tr_ts","next_m_tr")
rm(list=setdiff(all,keep))
The code that throws the error is
fit1 <- auto.arima(ftse_m_ts, d=0, xreg=trend)
fit2 <- auto.arima(ftse_m_ts,d=1)
fc1 <- forecast(fit1, xreg=length(ftse_m_ts) + 1:10)
fc2 <- forecast(fit2, h=10)
autoplot(ftse_m_ts) +
autolayer(fc2)
autolayer(fc1)
I have tried to unload ggfortify
using unloadNamespace("ggfortify")
as I have read that this package does not play nice with forecast
but still get the above error.
Any help or guidance is much appreciated.
Here is my session info
R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.5
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] kableExtra_1.1.0 knitr_1.27 fpp2_2.3 expsmooth_2.3 fma_2.4
[6] forecast_8.11 fable_0.1.2 feasts_0.1.2 fabletools_0.1.2 tsibbledata_0.1.0
[11] tsibble_0.8.6 ggplot2_3.2.1 lubridate_1.7.4 tidyr_1.0.2 dplyr_0.8.3
[16] tibble_2.1.3 fpp3_0.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 lattice_0.20-38 zoo_1.8-7 assertthat_0.2.1 digest_0.6.23
[6] lmtest_0.9-37 R6_2.4.1 evaluate_0.14 highr_0.8 httr_1.4.1
[11] pillar_1.4.3 rlang_0.4.3 lazyeval_0.2.2 curl_4.3 rstudioapi_0.10
[16] fracdiff_1.5-1 TTR_0.23-6 rmarkdown_2.1 labeling_0.3 webshot_0.5.2
[21] readr_1.3.1 stringr_1.4.0 munsell_0.5.0 anytime_0.3.7 compiler_3.6.0
[26] xfun_0.12 pkgconfig_2.0.3 urca_1.3-0 htmltools_0.4.0 nnet_7.3-12
[31] tidyselect_0.2.5 gridExtra_2.3 quadprog_1.5-8 viridisLite_0.3.0 fansi_0.4.1
[36] crayon_1.3.4 withr_2.1.2 grid_3.6.0 nlme_3.1-143 gtable_0.3.0
[41] lifecycle_0.1.0 magrittr_1.5 scales_1.1.0 quantmod_0.4-15 cli_2.0.1
[46] stringi_1.4.5 farver_2.0.3 tseries_0.10-47 timeDate_3043.102 ggfortify_0.4.8
[51] xml2_1.2.2 ellipsis_0.3.0 xts_0.12-0 generics_0.0.2 vctrs_0.2.2
[56] tools_3.6.0 glue_1.3.1 purrr_0.3.3 hms_0.5.3 parallel_3.6.0
[61] yaml_2.2.0 colorspace_1.4-1 rvest_0.3.5
Thanks
Barry