Doubt in state space representation $y$ is scalar observations and so C will be a 1x2 matrix. 

I want to represent the following model as a state space representation so as to estimate the hidden states from the noisy observations $y$ using Kalman filter. 

The  state space model :

x(t+1) = Ax(t) + w(t)

y(t) = Cx(t) + v(t)

w(t) = N(0,Q)

v(t) = N(0,R)


$w(t)$ is a pseudo-random binary signal that excites/ drives ; and $v(t) = N(0,\sigma^2_v)$ is the measurement noise.


The model is an FIR (MA) filter 


$$x(t) = h_1 \epsilon(t-1) + h_2 \epsilon(t-2) + \epsilon(t)$$
$$y(t) = x(t) + v(t)$$
$$ y(t) = h^T \epsilon(t) + v(t)$$

(In vector form)

where $\epsilon(t) = w(t)$.


The other model is an IIR (AR) filter 
$$x(t) = ax(t-1) + bx(t-2)+ w(t)$$


The state space representation:

$$x(t+1) = a^Tx(t) + w(t)$$

$$y(t) = h^Tx(t) + v(t)$$

How do I represent these as state space so as to apply Kalman Filter?

There are several ways to represent time series models. This is how I proceeded, but unsure because the output of the log-likelihood is a matrix of 2 by 2 with off diagonal elements being infinity and the diagonal elements are same positive values. So, the dimension and the value of log-likelihood is incorrect, I should get negative instead of positive values.


FIR :


Re-writing the above model as:

$$x(t+1) = h_1 \epsilon(t) + h_2 \epsilon(t-1) + \epsilon(t+1)$$
$$y(t) = Cx(t)+v(t)$$

State Space :

$ \left[ \begin{array}{c}
x(t+1)  \\
x(t)\\
 x(t-1) \end{array} \right] $ = $ \left[ \begin{array}{ccc}
1 &amp; h_1 &amp; h_2 \\
0 &amp; 1 &amp;  h_1 \\
0 &amp; 0 &amp; 1\end{array} \right] $  $\times$ $ \left[ \begin{array}{c}
e(t+1)\\
e(t) \\
e(t-1)\end{array} \right] $ 

$  y(t)$ = $\left[ \begin{array}{c}
1 \hskip 5 pt 0 \hskip 5 pt 0\end{array} \right] $ 
 $\times$ $ \left[ \begin{array}{c}
e(t+1)\\
e(t) \\
e(t-1)\end{array} \right] $ + $v(t)$


IIR (AR model)

$ \left[ \begin{array}{c}
x(t+1)  \\
x(t)  \end{array} \right] $ = $ \left[ \begin{array}{cc}
a &amp; b  \\
1 &amp; 0
\end{array} \right] $  $\times$ $ \left[ \begin{array}{c}
x(t)\\
x(t-1)\end{array} \right] $ + $\left[ \begin{array}{c}
1\\
0\end{array} \right] $ $\times$ $\left[ \begin{array}{c}
w(t+1)\\
w(t)\end{array} \right] $

$  y(t)$ = $\left[ \begin{array}{cc}
1 \hskip 5 pt 0\end{array} \right]$ $\times$ $ \left[ \begin{array}{c}
x(t)\\
x(t-1)\end{array} \right] $ + $v(t)$
Your FIR state space representation seems to be doing too much.

The way I would write it is to have the process noise is $\epsilon(t)$ as your input, and your state as two time-delayed copies of it:

$$x(t+1) = \left[ \begin{array}{c}
\epsilon(t+1)\\
\epsilon(t) \\
\epsilon(t-1) 
\end{array} \right] = \left[ \begin{array}{ccc}
0 &amp; 0 &amp; 0\\
1 &amp; 0 &amp; 0\\
0 &amp; 1 &amp; 0 
\end{array} \right] x(t) + \left[\begin{array}{c}
1\\
0\\
0
\end{array} \right] \epsilon(t + 1)
$$

then your output equation is just:
$$
y(t) = \left[ \begin{array}{ccc}
1 &amp; h_1 &amp; h_2 \end{array} \right] x(t) + v(t)
$$

Your IIR representation is too confused for me to make head or tail out of. Can you clarify that you have the right information there?

Other questions:


What is $w(t)$? It does not appear to take part in any of your equations?
What are the parameters for $u(t)$?