Open ASLlohmann opened 3 years ago
Hi, I don't know if there is a problem but it seems that the cvfunction struggle to handle the xregargument if we choose an hybridModelas FUN
cv
xreg
hybridModel
FUN
y=ts(rnorm(100), start=c(1999,1), frequency=12) x=ts(rnorm(100), start=c(1999,1), frequency=12)
When I run this code:
cv.1=forecastHybrid::cvts(y, FUN=hybridModel, models="an", rolling = TRUE, windowSize = 84 ,a.args=list(xreg=cbind(x)), maxHorizon = 1)
I get this error message:
Error during wrapup: task 1 failed - "variable lengths differ (found for 'xregg')" Error: no more error handlers available (recursive errors?); invoking 'abort' restart
Any idea of the problem ?
Edit : I just found the solution to the problem.
cv = cvts(y, FUN = function(z, xreg = xreg), forecastHybrid::hybridModel(z,models = "an")}, xreg=as.matrix(x),rolling = TRUE, windowSize = 84, maxHorizon = 1, horizonAverage = FALSE)
This is quite tricky, probably it could be nice to add an example in the R/Rd files.
cvmodCustom=cvts(series, FUN=function(y, xreg=xreg){hybridModel(y, models="an")}, xreg=x)
Hi, I don't know if there is a problem but it seems that the
cv
function struggle to handle thexreg
argument if we choose anhybridModel
asFUN
When I run this code:
I get this error message:
Any idea of the problem ?
Edit : I just found the solution to the problem.
This is quite tricky, probably it could be nice to add an example in the R/Rd files.
Using custom model functions with xreg.
cvmodCustom=cvts(series, FUN=function(y, xreg=xreg){hybridModel(y, models="an")}, xreg=x)