Local-level state-space model (source code)

= Local-level state-space model
{title2=$X_t=S_t+v_t,\quad S_t=S_{t-1}+w_t$}

The latent state follows a <random walk>, while observations add <independent> measurement noise. If the two noises have <variances> $W,V$, the differences have <autocovariances> $W+2V$ at lag zero, $-V$ at lag one, and zero at larger lags. For $V,W>0$, write $q=(W+2V+\sqrt{W^2+4WV})/2$ and $\vartheta=-V/q$. The differenced process is an invertible <moving-average model> with coefficient $\vartheta$ and innovation <variance> $q$. Its level has a unit root.