Forecasting in brms

Not sure how splines or GPs perform with respect to forecasting as compared to explicit time-series models to be honest (read: maybe I should change the warning message). At least getting forcasting done with them is straight forward. Here is an example:

df <- data.frame(y = rnorm(100), time = 1:100)
fit <- brm(y ~ s(time), df)
newdf <- data.frame(time = 1:110)
newdf <- cbind(newdf, fitted(fit, newdata = newdf))
names(newdf) <- make.names(names(newdf))
print(newdf)

ggplot(newdf, aes(time, Estimate)) +
  geom_smooth(aes(ymin = X2.5.ile, ymax = X97.5.ile),
              stat = "identity")
1 Like