How to calculate bivarient/multivarient gaussian copula for a given data?

5 次查看(过去 30 天)
load MCMC_M1
s1=MCMC_M1(:,1);
s2=MCMC_M1(:,2);
U(:,1)= s1;
U(:,2)= s2;
mean_s1 = mean(s1);
std_s1 = std(s1);
mean_s2 = mean(s2);
std_s2 = std(s2);
s11 = (s1-mean_s1)/std_s1;
s22 = (s2-mean_s2)/std_s2;
w1 = norminv(s11);
w2 = norminv(s22);
w = [w1 w2];
r = corr(U,'type','Kendall');
R = [sinpi(r(1,2)/2) 1;1 sinpi(r(2,1)/2)];
invR = inv(R);
I = eye(2);
After this, I need to calculate the Gaussian copula function using the data. The copula function is shown in the image.
Here, the main problem, I am facing is when I am calculating the norminv(s11), some of the values of w1 and w2 are NaN. How to deal with this problem. Please find the attached data used.
Please Let me know if any reference code is availvable to calculate m-gaussian copula in this regard.

回答(1 个)

Rangesh
Rangesh 2023-10-4
编辑:Rangesh 2023-10-25
Hello Sarath,
Based on my understanding, you are attempting to compute the bivariate Gaussian distribution using the Gaussian copula function. When using the "norminv" function, I have noticed that the inverse values of "s11" and "s22" are negative, resulting in "NaN" values since probabilities cannot be negative.
Furthermore, it is not necessary to calculate the inverse for the values of “s11” and “s22”, according to the definition, the vector w is essentially vector x after the transformation . By following this procedure, you can obtain the Gaussian Coupla.
For further understanding on Gaussian coupla, you can refer to the following link: https://en.wikipedia.org/wiki/Copula_%28probability_theory%29#Gaussian_copula
I hope this resolves your query.
Thanks,
Rangesh.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by