Random Walk prior on Cholesky factors

Suppose I wanted to have a dynamic correlation matrix, where the evolution over time is smooth.

I want to do this by assigning a random walk prior on the cholesky factors.

As far as I understand, I can’t use the lkj prior for this, because even if I specify a smooth prior on the eta parameter in that distribution, that does not guarantee the factors will be smooth across time-points. So I end up assigning random walk priors to the cholesky factors via normal distribution.

If I simulate this sort of scenario in R for T = 365, and I get some sensible behaviour – as I increase the value of the sd in the random walk, the correlations get less smooth, and vice-versa.

I’m implementing this in Stan by:


transformed parameters {
...
    array[fte_N] matrix[choice_N,choice_N] L; // covariance matrix
    
// define covariance matrix on daily changes in support
    for(t in 1:fte_N) L[t] = diag_pre_multiply(delta_scale, L_Omega[t]);
...
}

model {
// covariance priors 

  // magnitude of daily change in cholesky factors
    sd_L_Omega ~ std_normal();

  // RW prior on cholesky factors for dynamic correlation matrix
    to_vector(L_Omega[1]) ~ std_normal();
    for(t in 2:fte_N) to_vector(L_Omega[t]) ~ normal(to_vector(L_Omega[t-1]),sd_L_Omega);
    ...
}

This seems to work, but it’s rather slow – I’m wondering if there is a more efficient way of specifying this model ? Are there any obvious reasons I should not be doing this ? (i.e. very ill-advised to use a normal prior on the cholesky factors) ? Thanks !

Stan lets you stack priors. So you can put an LKJ prior on a bunch of Cholesky factors and smooth them toward one another.

My question is whether you really want to smooth the Cholesky factors or whether you want to smooth the resulting correlation matrices. Given the factored form of a Cholesky factor, I don’t know how to control that so that, for example, all the correlations in off diagonal elements get the same smoothing. This is something I would ask @bgoodri (Ben Goodrich) about. For example, would it make more sense to put this prior on the unconstrained Cholesky factor (for correlation matrices it gets constrained so that rows are unit length and then the diagonals are log transformed).

You could also use a more natural positive-definite distribution. For instance,

Omega[n] ~ inv_wishart(Omega[n-1], eta);

where the degrees of freedom parameter would now control the “variance” of the time series. I’ve switched to modeling the whole covariance matrices, but it’d be even better to do this for inv_wishart with Cholesky factor parameter and variate (I believe @spinkney may have written about how to do that somewhere on the forums). In Stan, you can do this by declaring as correlation matrices rather than Cholesky factors thereof.

1 Like

Thanks Bob - the wishart approach seems to fit what I need best, but it’s computationally very expensive. I think the cholesky-wishart stuff from @spinkey is here: Wishart Cholesky parameterization · Issue #2705 · stan-dev/math · GitHub . Very cool - will try and report back in due time.