Intuition behind different priors in this spline-like knot scheme for timevariant data

Your problem sounds like a nice candidate for a structural time series model. I’ve been working on a module for pymc_experimental, you can see an example of the API here. I should have a version merged in a couple more days, I just need to finish a few more details (one of which is exogenous regression blocks, which seems relevant to your problem).

The state space formulation is nice because it gives you a natural way to incorporate correlations between the evolution in the different components, by correlating the innovations to their respective hidden states. In you case you have a model that looks something like this:

\begin{align} x_t &= Tx_t + R\varepsilon_t & \varepsilon_t &\sim N(0, Q) & x_t &= \begin{bmatrix}\alpha_t \\ \gamma_t \\ c_t \\ \beta_t \end{bmatrix} \\ y_t &= \begin{bmatrix} Z & X_t \end{bmatrix} x_t \end{align}

Where \alpha_t is a vector of terms associated with the trend, \gamma_t with the seasonality, c_t with the cycle, and \beta_t are time-varying regression coefficients. T, Z, R, Q are matrices of coefficients, and X_t is a row of your exogenous data at time t.

Typically Q is diagonal, but you could easily consider off-diagonal terms correlating the innovations between \beta_t and \gamma_t, which would be equivalent to saying “when the strength of the seasonal effect changes, the strength of the regression coefficients should change too”. I think this is something like what you are after?

In general though, I think a model should be able to tease out the three scenarios you propose by looking at estimated correlations between parameters/innovations to parameters.

1 Like