State Space Model Form for Equations I have a set of equations which I have to write in state space model form but unfortunately I'm having a bit of difficulty doing so. They are given as:
$y_{t} = x_{t} + z_{t}$
$x_{t} = x_{t-1} + w_{t}$
$ w_{t} = \kappa \beta_{t} + \epsilon_{t}$
$z_{t} = \Phi z_{t-1} + \psi \alpha_{t} + \tau_{t}$
where $y_{t}$ is the observed value, $\alpha_{t}$ and $\beta_{t}$ are known values, and $\epsilon_{t}$ and $\tau_{t}$ are the error terms and we must have $\text{Cov}(\epsilon,\tau) = 0$ (I believe variances are unknown).
Basically, I have to estimate the values $\kappa$, $\beta$, $\Phi$, $\alpha$, $\sigma (z_{t})$ and $\sigma (w_{t})$
To do this I'd like to change it into a state space model form but these four equations seem quite a bit more difficult to change compared to the examples online which show it for AR/MA/ARMA processes, and since I'd also like to put the model into R to use a Kalman filter over I want to try and make sure everything is properly formatted since the packages tend to vary in how they want matrices formatted, so if anyone can help me out with it I'd appreciate it, thanks in advance.
 A: The thing that's perhaps tricky here is the fact that there is no measurement error. Conditional on the unobserved states $x_t$ and $z_t$, the measurement equation is deterministic. 
Anyway, I would start by substituting the third equation into the second. Then you have:
\begin{align}
y_t &= x_t + z_t\\
x_t &= x_{t-1} + \kappa\beta_t+\epsilon_t\\
z_t &= \Phi z_{t-1}+\psi\alpha_t+\tau_t,
\end{align}
which makes it easier to see how to proceed. From here it's just housekeeping. Define the following
\begin{align}
\mathbf{s}_t &= \begin{bmatrix}x_t & z_t\end{bmatrix}'\\
\boldsymbol{\mu}_t &= \begin{bmatrix}\beta_t & \alpha_t\end{bmatrix}'\\
\boldsymbol{\nu}_t &= \begin{bmatrix}\epsilon_t & \tau_t\end{bmatrix}'.
\end{align}
With these, you can rewrite the system as 
\begin{align}
y_t&=\begin{bmatrix}1 & 1\end{bmatrix}\mathbf{s}_t\\
\mathbf{s}_t &=\begin{bmatrix}1 & 0 \\ 0 & \Phi\end{bmatrix}\mathbf{s}_{t-1} + \begin{bmatrix}\kappa & 0\\0&\psi\end{bmatrix}\boldsymbol{\mu}_t+\boldsymbol{\nu}_t.
\end{align}
This is a linear system with no errors in the measurement equation (you could think of $y_t$ as having an error term with 0 variance if you like), and the state transition equation has a known time-varying intercept (since you said you know $\beta_t$ and $\alpha_t$).
