# Priors for Seasonal State Space Model

Hi,

I’m trying to fit a State Space Model with (stochastic) weekly seasonality and a linear local trend.
The transition equation for the hidden state is given by `theta_t=G @ theta_t-1 + w_t` with G specified as below and `w_t,i ~ N(0, sigma_w_i)` for i=1,2,3 and` w_t,i = 0` for i>3.

``````G = [1,  1,  0,  0,  0,  0,  0,  0],
[0,  1,  0,  0,  0,  0,  0,  0],
[0,  0, -1, -1, -1, -1, -1, -1],
[0,  0,  1,  0,  0,  0,  0,  0],
[0,  0,  0,  1,  0,  0,  0,  0],
[0,  0,  0,  0,  1,  0,  0,  0],
[0,  0,  0,  0,  0,  1,  0,  0],
[0,  0,  0,  0,  0,  0,  1,  0]
``````

I’ve used a `Gamma(1,0.5)` prior for all `sigma_w_i` i=1,…,8 but this often results in a non-psd covariance matrix.
What is the best way to specify a transition distribution for a `GaussianHMM`?
Should I use a different prior? Or is there a better way?

Kind regards
beta21

can you give more details? are you using hmc? variational inference? what are your goals? forecasting? inferring underlying parameters? something else?

My goals are filtering (extracting the seasonality) and forecasting. So fare I’ve used the ForecasterModel and therefore VI for inference.

in very broad terms, variational inference doesn’t always do a great job in inferring distributions over higher-level latent variables (hyperparameters, say); here the `sigma_w_i`. why not use point estimates for these parameters? is that not sufficient? if you have lots of data the posterior over these parameters might be pretty narrow anyway

Because I’m mainly interested in the uncertainty associated with the predictions. Adding a point estimate for the variance would also mean that I have to add another inference step. Since I want to model multiple time series (all with the same state space model ) this would add some overhead. Or is there a way to get point estimates with the ForecastModel class?

what does your code look like? you should just be able to change your `sample` statement over `sigma_w` into a `param` statement?