Closed mbanco closed 5 years ago
@mbanco This runs find on my computer
trainSet <- beaver1[1:100, ]
testSet <- beaver1[-(1:100), ]
trainXreg <- data.frame(trainSet$activ, trainSet$time)
beaverhm <- hybridModel(ts(trainSet$temp, f = 6),
models = "ans",
a.args = list(xreg = trainXreg),
n.args = list(xreg = trainXreg),
s.args = list(xreg = trainXreg, method = "arima"))
Fitting the auto.arima model
Fitting the nnetar model
Fitting the stlm model
Which version of R and "forecastHybrid" are you running? Could you paste the output of sessionInfo()
and installed.packages()["forecastHybrid", ]
?
sessionInfo() R version 3.5.1 (2018-07-02) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale: [1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 LC_MONETARY=Spanish_Spain.1252 [4] LC_NUMERIC=C LC_TIME=Spanish_Spain.1252
attached base packages: [1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_0.12.19 urca_1.3-0 pillar_1.3.0 compiler_3.5.1 plyr_1.8.4 bindr_0.1.1
[7] iterators_1.0.10 tseries_0.10-45 tools_3.5.1 xts_0.11-1 nlme_3.1-137 tibble_1.4.2
[13] gtable_0.2.0 lattice_0.20-35 pkgconfig_2.0.2 rlang_0.3.0.1 foreach_1.4.4 rstudioapi_0.8
[19] curl_3.2 yaml_2.2.0 parallel_3.5.1 bindrcpp_0.2.2 dplyr_0.7.7 lmtest_0.9-36
[25] grid_3.5.1 nnet_7.3-12 tidyselect_0.2.5 glue_1.3.0 R6_2.3.0 ggplot2_3.1.0
[31] purrr_0.2.5 TTR_0.23-4 magrittr_1.5 codetools_0.2-15 scales_1.0.0 assertthat_0.2.0
[37] quantmod_0.4-13 timeDate_3043.102 colorspace_1.3-2 fracdiff_1.4-2 quadprog_1.5-5 doParallel_1.0.14
[43] lazyeval_0.2.1 munsell_0.5.0 crayon_1.3.4 zoo_1.8-4
installed.packages()["forecastHybrid", ] Package "forecastHybrid" LibPath "C:/R/library" Version "3.0.14" Priority NA Depends "R (>= 3.1.1), forecast (>= 8.1)," Imports "doParallel (>= 1.0.10), foreach (>= 1.4.3), ggplot2 (>=\n2.2.0), zoo (>= 1.7)" LinkingTo NA Suggests "GMDH, knitr, rmarkdown, roxygen2, testthat" Enhances NA License "GPL-3" License_is_FOSS NA License_restricts_use NA OS_type NA MD5sum NA NeedsCompilation "no" Built "3.5.1"
That all looks normal. Do the base models run correctly on your machine?
auto.arima(ts(trainSet$temp, f = 6), xreg = trainXreg)
and
nnetar(ts(trainSet$temp, f = 6), xreg = trainXreg)
and
stlm(ts(trainSet$temp, f = 6), xreg = trainXreg, method = "arima")
If all this works, can you try running hybridModel
on another machine? I've been able to run this fine on two machines without issue, so I'm not sure what it is.
I think that problem happens because I use the forecast version 8.5 package.
Thanks
@mbanco Thanks for reporting this. Indeed you're correct that something has changed in the yet-unreleased "forecast" 8.5 that requires the xreg to be a matrix instead of a data.frame. I've gone ahead and updated the vignette, documentation, and tests to reflect how "forecast" behaves, so now this should work:
trainSet <- beaver1[1:100, ]
testSet <- beaver1[-(1:100), ]
trainXreg <- as.matrix(data.frame(trainSet$activ, trainSet$time))
beaverhm <- hybridModel(ts(trainSet$temp, f = 6),
models = "aenst",
a.args = list(xreg = trainXreg),
n.args = list(xreg = trainXreg),
s.args = list(xreg = trainXreg, method = "arima"))
This work is in the matrix_xreg
branch, and I'll keep it there until the "forecast" releases and update. I hope to add a few more unit tests around this as well.
@dashaub Thanks, works fine!
Fixes in #87
There is an error when two or more regressors are used: