Modeling Multiple Correlations Using Multiple Copulas in the Same Model Code

@Corey.Plate
Take also a look at Vine copula examples in Stan - #3 by jmh530
The model simple_cvine_copula.stan works. There is also a linked a paper in more detail about the conditional copula.
What I see as a difference between the model above is that there is no difference calculation in the model above. See

// fit second level
// The general appraoch is to get each conditional CDF. This requires
// taking the derivative of the copula CDF when holding one variable
// constant. Things are simpler here because I’m using normal marginals
// and copulae, but this doesn’t hold generally. What I’m doing here
// is essentially regressing variables 2 and 3 on variable 1 and
// and dividing by the residual standard deviation. Since we have
// standardized the data above, it simplifies the calculations here
// and I don’t need to do the regression because the correlations are
// re-used from above. Works for normals, but not more generally.
Uinv_2nd_level[, 1] = (Uinv[, 2] - p12 * Uinv[, 1]) / sqrt(1 - square(p12));
Uinv_2nd_level[, 2] = (Uinv[, 3] - p13 * Uinv[, 1]) / sqrt(1 - square(p13));
Uinv_2nd_level[, 2] ~ normal_copula_vector(Uinv_2nd_level[, 1], p23_given_1);

2 Likes