Dear all,
I have been working on identifying the correlation between two distributions using Frank copula, and in my code I identify the parameter theta_frank that can be both negative and positive. Then I put the jacobian on logit of the correlation coefficient Kendall tau via the following:
real Debye_1st_integral_ = ode_rk45(Debye_1st_function, [1e-6]', 1e-6, {1.0}, theta_frank)[1,1];
tau_Kendall = 1. - 4 / theta_frank + 4 * Debye_1st_integral_;
logit_tau_Kendall_raw = logit((tau_Kendall + 1) / 2);
jacobian += log(4.0) - 2 * log(abs(theta_frank)) + log(abs(1 + theta_frank / expm1(theta_frank) - 2 * theta_frank * Debye_1st_integral_)) - log1m(tau_Kendall) - log1p(tau_Kendall) + log(2);
Then I impose prior on
logit_tau_Kendall_raw ~ normal(0, 2);
Fitting the data, gave me a reasonable theta_frank around -13 and Kendall’s tau around -0.72.
However, initially I made a mistake in my code and I declared the variable log_theta_frank, then exponentiate it to theta_frank, making theta_frank being only positive. In this case I wrote:
theta_frank = exp(log_theta_frank);
jacobian += log(4.0 / theta_frank) + log(abs(1 + theta_frank / expm1(theta_frank) - 2 * theta_frank * Debye_1st_integral_)) - log1m(tau_Kendall) - log1p(tau_Kendall) + log(2);
Fitting the data still gave me Kendall’s tau around -0.72. It was surprising since Kendall’s tau should always be positive. But the posterior distribution for theta_frank was at 0.00001 (95% CrI: 0 to 0.00001). So the latter was kind of nonsense.
However, I wonder if imposing that prior on logit of transformed Kendall’s tau somehow made the contraints on theta_frank > 0 to be ignored. Am I right with this thought?
Another idea of mine was that the Debye_1st_integral was unstable around theta_frank zero, which made some erroneous calculations. However, the same value for the posterior mean of Kendall’s tau in both cases is suspicious.
Thank you for your help and time in advance!
Andrei
vector Debye_1st_function(real s, vector y, real theta) {
return [s / expm1(theta * s)]';
}
