I fit a model with regressors using the mbsts function (using the long data format), but get the following error message when use the predict method:
fitted$has.regression
[1] TRUE
preds <- predict(fitted, newdata=future_incr,
-
timestamps = length(max(dat2$ds) + 1:nrow(future_incr))
-
Error in .ExtractPredictors(object, newdata, na.action = na.action) :
Cannot extract predictors for a model with no regression component.
traceback()
5: stop(paste0("Cannot extract predictors for a model with no ",
"regression component."))
4: .ExtractPredictors(object, newdata, na.action = na.action)
3: .FormatMultivariatePredictionData(object, newdata, horizon, na.action,
timestamps)
2: predict.mbsts(fitted, newdata = future_incr, timestamps = length(max(dat2$ds) +
1:nrow(future_incr)))
1: predict(fitted, newdata = future_incr, timestamps = length(max(dat2$ds) +
1:nrow(future_incr)))
Looking through the code, it looks like the .ExtractPredictors function expect the model to have a coefficients attribute (line 570 in predict.bsts.R ), but my mbsts object's coefficients are in an attribute named 'regression.coefficients'.
Not ruling out user error, but I wanted to bring this to your attention in case this is a bug. Thanks for all you've put into the package, I've been using it for a while and gotten some great results out of it.
I fit a model with regressors using the mbsts function (using the long data format), but get the following error message when use the predict method:
Error in .ExtractPredictors(object, newdata, na.action = na.action) :
Cannot extract predictors for a model with no regression component.
Looking through the code, it looks like the .ExtractPredictors function expect the model to have a coefficients attribute (line 570 in predict.bsts.R ), but my mbsts object's coefficients are in an attribute named 'regression.coefficients'.
Not ruling out user error, but I wanted to bring this to your attention in case this is a bug. Thanks for all you've put into the package, I've been using it for a while and gotten some great results out of it.