I'm working on a forecasting model. The standard form for it is:


where $f_t$ is a vector of factors obtained from Principal Component Analysis that follows some VAR(p) dynamics. I have no problem with the PCA or the VAR estimation in my dataset, but I struggle with getting the Kalman filter right. I am trying to use R's dlm function, but the standard model specification there is:


I am aware that the dlm function should allow me to specify any dynamic I want for the factors to follow, as already mentioned in an answer on CV here, but I can't work out how to do that - do I create a block matrix with $A_1, ..., A_p$ blocks on the diagonal? If so, how do I then estimate the variance-covariance matrix (call it $E$) using the residuals from my VAR? How can I make the dimensions work? It seems to me that $E$ can only be a $k\times k$, where $k\times1$ is the dimension of $f_t$...


1 Answer 1


Package dlm provides the function dlmModARMA, which creates a state space representation of a specific univariate or multivariate ARMA model. What you get using this function is a model in which your observations are exactly the f_t. If you want a factor model, then you have to redefine the observation matrix F and the observation variance V.

Best, Giovanni


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.