How to define time-varying state_intercept (Ct) in pymc-extras SSM?

You’re on the right track, you just need to first create a matrix of zeros for the intercept term, then allocate the values you what where you want them. For example:

intercept = pt.zeros((None, 3))
intercept = intercept[:, 0].set(Bf)
intercept = intercept[:, 1].set(Bs)
self.ssm['state_intercept', :, :] intercept

Whenever you have something time varying, the time shape is going to be None, which is pytensor’s way of saying ā€œunknown until compile timeā€

This conversation might be helpful