Trying to replicate Didier Marti's method using Kalman filter to estimate historical time-varying beta, but it seems consistently way off from the actual beta.

My code is here (Kalman filter starts at line 75)

https://pastebin.com/LVk547cy

Am I right that for a state vector of [alpha; beta] the transition matrix should just be [1, 0; 0 ,1] and observation matrix will be [1, rm-rfr]?