helske / KFAS

KFAS: R Package for Exponential Family State Space Models
64 stars 17 forks source link

How to predict more time series #64

Closed sue-shine closed 3 years ago

sue-shine commented 3 years ago

Hi,I have studied your article named KFAS: Exponential Family State Space Models in R. In part Illustration, using the data until 2007, and make predictions for the years 2008–2013. The data has four series, but I want to predict more series like two more time series so how do I adjust the code.

pred <- predict(fit$model,

  • newdata = SSModel(ts(matrix(NA, 6, 4), start = 2008) ~ -1 +
  • SSMcustom(Z = fit$model$Z, T = fit$model$T, R = fit$model$R,
  • Q = fit$model$Q), u = 1, distribution = "poisson"),
  • interval = "confidence", nsim = 10000) Thank you very much for your time!
helske commented 3 years ago

The newdata argument should have essentially same structure as the original data, the observations just mark how many time points you want to predict into the future. Please check the documentation on ?predict.SSModel.

Please note that Github issues are meant for bug fixes and feature requests. On how to use the package, please ask help on stackoverflow.