Yes, I think you are right. The prior variance should grow at rate \sqrt{t}, but you can see from the prior plot I posted above that the variance is constant. As you suggest, when I remove the features dimension, the variances grows as expected. I wonder if the wrong index is being used to take the cumulative sum?
When I do the GRW “by hand”, I get the right result, both in the prior and the posterior:
coords = {"time": np.arange(T), "features": np.arange(F)}
hmm = pm.Model(coords=coords)
with hmm:
x_obs = pm.MutableData("x_obs", x, dims=("time", 'features'))
# Standard deviation of the transition and emission distributions
i_sd_z = pm.HalfNormal(name="i_sd_z", sigma=1)
i_sd_x = pm.HalfNormal(name="i_sd_x", sigma=1)
# Transition distribution of latent variable Z
i_z_0 = pm.Normal('i_z_0', sigma=1, dims=['features'])
i_z_t= pm.Normal('i_z_t', sigma=i_sd_z, dims=['time', 'features'])
i_z = pm.Deterministic('i_z', pm.math.concatenate([i_z_0[None], i_z_t], axis=0).cumsum(axis=0)[1:], dims=['time', 'features'])
# Emission distribution of the observed variable X
i_x = pm.Normal(name="i_x", mu=i_z, sigma=i_sd_x, observed=x_obs)
idata = pm.sample_prior_predictive()
My guess is that the prior issue I pointed about above is totally irrelevant, and that there is something else going on in the random walk wrapper. @ricardoV94 ?