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$...