# State space model parameter estimate

I'm working on one project trying to reconstruct a sequence of multivariate signal data from another sequence of multivariate signal data. That is let $\{S_t\}_{t=1}^n$ be the first sequence of signals, where each $S_t$ is a m-by-1 vector and $\{r_t\}_{t=1}^n$ be the second sequence of signals, where each $r_t$ is a n-by-1 vector, we are trying to estimate $\{S_t\}_{t=1}^n$ using $\{r_t\}_{t=1}^n$.
For now, I'm modeling this problem as $\begin{cases}S_t=\phi_1S_{t-1}+\cdots+\phi_pS_{t-p}+\epsilon_t\\ r_t=\psi_0S_t+\psi_1S_{t-1}+\cdots+\psi_{p-1}S_{t-p+1}+\eta_t \end{cases}$, where $\epsilon_t\sim N(0,\Sigma_\epsilon)$, and $\eta_t\sim N(0,\Sigma_\eta)$ and they are independent of each other. And all the $\phi_i$'s and $\psi_i$'s are matrices.
By letting $\xi_t=\begin{bmatrix}S_t\\ S_{t-1}\\\vdots\\S_{t-p+1} \end{bmatrix}=\begin{bmatrix}\phi_1&\cdots&\phi_{p-1}&\phi_p\\ I &\cdots&0&0\\ \vdots&\cdots &\vdots&\vdots\\ 0&\cdots &I&0\end{bmatrix}\begin{bmatrix}S_{t-1}\\S_{t-2}\\ \vdots\\ S_{t-p} \end{bmatrix}+\begin{bmatrix}\epsilon_t\\\epsilon_{t-1}\\\vdots\\\epsilon_{t-p+1} \end{bmatrix}$, I converted the first equation into $\xi_t=F\xi_{t-1}+\mathscr{E_t}$. And the second equation can be written as $r_t=G\xi_t+\eta_t$, where $G=\begin{bmatrix}\psi_0&\cdots&\psi_{p-1} \end{bmatrix}$. Combining these two equations, I got $\begin{cases}\xi_t=F\xi_{t-1}+\mathscr{E_t}\\ r_t=G\xi_t+\eta_t \end{cases}$. This resembles a Kalman filter where I treat $S_t$ as latent variables. However, I'm having trouble estimating these coefficients including the variance-covariance matrices of $\mathscr{E_t}$ and $\eta_t$.
My data set consists of two parts, where the first part (the training data set) I can actually observe both $r_t$'s and $S_t$'s while in the second part (the testing data set) I can only observe $r_t$'s. However, I think in the standard setting of a Kalman filter, we do not need to observe the actual values of the latent variables to estimate the coefficients. So how can I make use of this extra piece of information to estimate the coefficients better in the training data set and estimate $S_t$ using these estimated coefficients and new observed $r_t$'s to predict $S_t$'s in the testing data set.
Thank you!