In his book, Algorithmic Trading: Winning Strategies and Their Rationale, Ernie Chan shows how to use a Kalman filter to improve the returns of a cointegrated portfolio. Recall that the state equation is: $$\beta_t=\alpha\cdot\beta_{t-1}+\omega_{t-1}$$ Here, $\alpha$ is the state transition matrix, $\beta_t$ is the state vector, and $\omega_t$ is the process noise vector.
In his Kalman filter code, Chan sets the state transition matrix, $\alpha$, to the identity matrix. However, I would argue that this is wrong. Recall that the state vector is used in the measurement equation: $$y_t=\beta_t\cdot x_t + \epsilon_t$$
For k cointegrating time series, the observation vector, $x_t$, the state vector, $\beta_t$, and the observable, $y_t$, are: $$x_t=(1,\;x_{2,t},\;x_{3,t},\;...\;,\;x_{k,t})$$ $$\beta_t=(\beta_{1,t},\;\beta_{2,t},\;\beta_{3,t},\;...\;,\;\beta_{k,t})$$ $$y_t = x_{1,t}$$
The state vector is related to the static weights ($w_1,w_2,...,w_k$) obtained from the Johansen procedure because these weights give a stationary time series, $y_{\text{port}}$: $$y_{\text{port}}=w_1\cdot x_1\:+\:w_2\cdot x_2\:+\:w_3\cdot x_3\:+\:...\:+\:w_k\cdot x_k$$ Solving for $y=x_1$, we get: $$x_1=(y_{\text{port}}\:-\:w_2\cdot x_2\:-\:w_3\cdot x_3\:-\:...\:-\:w_k\cdot x_k)\,/\,w_1$$ Therefore, from the measurement equation, the initial state vector at time $t$ must be: $$\beta_t=(y_{\text{port},t}/w_1,\;-w_2/w_1,\;-w_3/w_1,\;...\;,\;-w_k/w_1)$$ The first column of matrix $\beta$ is $y_{\text{port}}/w_1$, which is stationary because $y_{\text{port}}$ is stationary. Therefore, the state estimate for this component of $\beta$ at time $t$ is: $$\beta_{1,t}=\alpha_{11}\cdot\beta_{1,t-1}$$ where $\alpha_{11}$ must be less than 1 for the stationary case. This analysis indicates that the correct state transition matrix is not the identity matrix, but rather: $$\alpha=\left[ \begin{array}{cccc} \alpha_{11} & 0 & 0 & ... & 0\\ 0 & 1 & 0 & ... & 0\\ 0 & 0 & 1 & ... & 0\\ \vdots & \vdots & \vdots & \ddots & \vdots\\ 0 & 0 & 0 & ... & 1 \end{array} \right]$$ In other words, the state transition matrix is the identity matrix, except for the (1,1) element, which must be less than 1 (for stationarity).
How do we calculate $\alpha_{11}$? Right-multiply both sides of the state equation by $\beta_{t-1}^T$, take the expectation value, and solve for $\alpha_{11}$:
$$\alpha_{11}=\frac{\sum_{t=2}^n\beta_{1,t}\cdot\beta_{1,t-1}^T}{\sum_{t=2}^n \beta_{1,t-1}\cdot\beta_{1,t-1}^T}$$
I’m currently trading with a cointegrated triplet of ETFs that give a stationary portfolio, $y_{\text{port}}$. When I apply a unit root test (which measures stationarity) to $y_{\text{port}}$, I get the following p-values using a state transition matrix in the Kalman filter with different values for the (1,1) element of the state transition matrix, $\alpha$:
\begin{array}{|c|c|} \hline \alpha_{11} & p\\ \hline 1 & 0.00086\\ \hline 0.93 & 0.00058\\ \hline 0.007 & 3\times10^{-13}\\ \hline \end{array}
Smaller values of p suggest greater likelihood of stationarity. All of these p-values indicate stationarity, but the modified transition matrix ($\alpha_{11}=0.93$) gives better results than the identity matrix ($\alpha_{11}=1$). In the last example ($\alpha_{11}=0.007$), I iterated the Kalman filter calculation 1000 times, each time recalculating $\alpha_{11}$, as well as the process noise covariance matrix, the observation noise variance, the initial state vector, and the initial state covariance matrix, with each iteration (a procedure known as "adaptive tuning" of the Kalman filter). This gave very high stationarity for the $y_{\text{port}}$ array. (This is also reflected in higher returns in backtesting of the trading algorithm.)
I haven't seen this analysis in the literature on Kalman filter in financial time series. Can anyone find fault with it?