I am trying to forecast predict new observations of interest rates given new data using the DLM modeling framework.

Essentially, my problem is this:

I have a training set (a set of data i want to fit my model to) and a test set (new predictor data, i wish to use to run through the trained model to predict new values of interest rates)

train<-1:(n-20); test<-(n-19):(n-4); 

I have created a training and test set:


Below would be what im using for the independent variables



mod<-dlmModReg(x,addInt=FALSE, dV =1,dW = rep(.60, 11),
          m0 = rep(0, length(dW)),
          C0 = 1e+07 * diag(nrow = length(dW)))


At this stage i want to use the old mod, throw in new data from my testing set:


How do i produce new yt's given my new xt's?

There is the predict() function for lm. Is there an analogous function or way to do this with dlm?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.