Kalman Filter for a Latent Mean-Reverting Signal
A trading signal is modeled as a latent mean $m_t$ following a random walk:
$m_t = m_{t-1} + u_t, \quad u_t \sim N(0, q)$
Observed returns are noisy observations of this mean:
$y_t = m_t + \epsilon_t, \quad \epsilon_t \sim N(0, r)$
where $u_t$ and $\epsilon_t$ are independent.
1. Write this state-space model in matrix form.
2. Derive the Kalman filter prediction and update recursions for the state estimate $\hat{m}_{t|t-1}$, the filtered estimate $\hat{m}_{t|t}$, and their associated variances $P_{t|t-1}$ and $P_{t|t}$.
3. Explain how you would estimate the parameters $(q, r)$ from data using maximum likelihood via the innovation sequence, and how you would validate the filter out-of-sample.
Open the full interactive solver, hints, and worked solution →