I have estimated a univariate time series model, consisting of a random walk and an AR component. Now the goal is to make forecast about a couple of steps ahead as new data comes in, in an online fashion. so in R, using DLM package:

filter <- dlmFilter(training_data, model)
forecast <- dlmForecast(filter, 2)

Now the problem is that it seems every time a new data point comes in, I have to reconstruct the filter and then do the forecast, which is very slow. Also, I think, one of the promises of using DLM is that it does not need to store the whole dataset. Is there a way to update the filter as new data comes in without going through all the data?

  • 1
    $\begingroup$ What is slow? It might be prudent to reduce the training_data set. I suggest looking at dlmFilter documentation, if the package author did not write the code for your use case it might be that you will have to write implementation yourself. Oh and please note what package and which version you are using. R has many packages and function dlmFilter might be in several of them. $\endgroup$
    – mpiktas
    Jul 27, 2015 at 7:19
  • 1
    $\begingroup$ @mpiktas Thank you. I've added the package info. by slow I mean 4 5 seconds, but as data size gets bigger, then it will probably get worse $\endgroup$
    – Alex
    Jul 27, 2015 at 7:27


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.