I am trying to use a Kalman Filter to estimate parameters, using PyKalman, I am having a problem with the transition matrix estimate. It always returns 1.0. See this trivial example:
from pykalman import KalmanFilter
N = 1000
a = 0.05
sims = []
v = 1
for t in range(N):
v *= a
sims.append(v)
kf = KalmanFilter(n_dim_obs=1, n_dim_state=1,
em_vars=['transition_matrices'],
initial_state_mean=[1],
transition_covariance=[0.0],
transition_offsets=[0],
initial_state_covariance=[0.0],
observation_matrices=[1],
observation_covariance=[0],
observation_offsets=[0])
emres = kf.em(sims, n_iter=10)
print "alpha: {}".format(emres.transition_matrices[0, 0])
>>> alpha: 1.0
The observations are identical to the latent state variable, as indicated with the observation matrix, and the noise covariances are all 0. Likewise, the state variable is simply mulplied by alpha each iteration, yet the model fits 1.0 for alpha. What could be going on here? I was able to fit the covariances in other examples, only the transition matrix cannot be fit.