Closed chaojieji closed 7 years ago
Without seeing the original TsData
and CbiCovariatesTrain
it is difficult to say for sure, but there are a couple of things I noticed.
xreg
data. The ets()
model does not, so passing it is producing Error in (function (y, s.window = 7, robust = FALSE, method = c("ets", : xreg arguments can only be used with ARIMA models
. This is an error produced by the "forecast" package from stlm()
confusingly. See this example
series <- ts(rnorm(nrow(mtcars)), f = 4)
ets(series, xreg = mtcars)
stlm(series, xreg = mtcars)
`tbats()` and `thetam()` also do not support this, so expect the same errors from them for doing this. `stlm(series, method = "arima", xreg = mtcars)` will work, so you'll also need to pass `method = "arima"` in your `s.args` list. Check out the readme files for each of the models from the "forecast" package to see which arguments can be passed in `a.args`, `e.args`, etc.
* Your `windowSize = 329` is huge. I assume your `tsData` is very long. If `length(tsData)` is much longer than this, that is fine, but if it is not cross validation will fail.
For the first point you mentioned, in practice, I used the parameter t.args = list(xreg = data.frame(CbiCovariatesTrain))
and no errors were occurred. Then, when I tried the s.args = list(method = "arima", xreg = data.frame(CbiCovariatesTrain))
, it worked pretty well. In conclusion, the e.args
- ets - is only the parameter that can't work with xreg.
Secondly, The reason why I set the windowSize to a hug size is that the tsData is filled with a large number of zero in the first half of the data. For another hand, I observed that if there are only zeros in one slide of window, nnetar (with xreg) and thetam won't work.
Thanks.
Best regards.
The documentation for tbats()
says that unmatched arguments are passed in ...
to auto.arima()
but that xreg
is specifically ignored, so although it doesn't throw an error, the xreg
won't actually be used by the tbats
model or impact the fit.
I have got it. Thanks.
While I used the newest version 0.3.0.1 of forecastHybrid, several problems occurred.
HybMapHybridModel <- hybridModel(TsData, models = "aenfst",weights = "cv.errors", errorMethod = "MAE", cvHorizon = frequency(TsData), windowSize = 329, horizonAverage = TRUE, parallel= TRUE, num.cores = 4L, a.args = list(xreg = data.frame(CbiCovariatesTrain)), t.args = list(xreg = data.frame(CbiCovariatesTrain)), n.args = list(xreg = data.frame(CbiCovariatesTrain)), e.args = list(xreg = data.frame(CbiCovariatesTrain)) )
I got error message:Error in etsmodel(y, errortype[i], trendtype[j], seasontype[k], damped[l], : unused argument (xreg = c(2005, 254853, 4812, 5625, 11677, 16070, 2, 15243, 15615, 23850, 22621, 18408, 19058, 19833, 22416, 27715, 29645, 27239, 27266, 30864, 43328, 38096, 38530, 37773,, 36931, 40972, 46519, 53048, 4775, 521886, 66234, 64730, 55380, 57376, 60140, 6029, 71557, 69670, 61632, 60321, 65707, 54539, 62923, 66338, 6557 66532, 68432, 79685, 82056, 77957, 67107, 69574, 76898, 67814, 88044, 95387, 95099, 66255, 66982, 87590, 89594,
HybMapHybridModel <- hybridModel(TsData, models = "aenfst",weights = "cv.errors", errorMethod = "MAE", cvHorizon = frequency(TsData), windowSize = 329, horizonAverage = TRUE, parallel= TRUE, num.cores = 4L, a.args = list(xreg = data.frame(CbiCovariatesTrain)), t.args = list(xreg = data.frame(CbiCovariatesTrain)), n.args = list(xreg = data.frame(CbiCovariatesTrain)), s.args = list(xreg = data.frame(CbiCovariatesTrain)) )
I got error message:Error in (function (y, s.window = 7, robust = FALSE, method = c("ets", : xreg arguments can only be used with ARIMA models
I have no idea about how to solve it. Thanks for any suggestions.