I would like some help to adapt this code for sampling from 2 dependent and uniformly distributed random variables to 3 dependent and uniformly distributed random variables in Matlab.
P=100;
%Draw P realisations from 2 random variables uniformly distributed on [0,1] and correlated
rho_uni_Pearson=0.1;
rho_uni_Spearman = rho_uni_Pearson;
rho_normal_Spearman = rho_uni_Spearman;
rho_normal_Pearson = 2*sin(rho_normal_Spearman*pi/6);
dep_biv1 = copularnd('gaussian',rho_normal_Pearson,P);
nu=5; %degrees of freedom
rho_t_Pearson = copulaparam('t', rho_uni_Pearson, nu, 'type', 'spearman');
dep_biv2 = copularnd('t', rho_t_Pearson, nu, P);
alpha=copulaparam('Frank', rho_uni_Pearson, 'type', 'spearman');
dep_biv3 = copularnd('Frank', alpha, P);
I have looked at here but I do not understand how to set the correlations. Also, is the more than 2 variables case possible for the Frank, Gumbel, or Clayton copulas?
Aucun commentaire:
Enregistrer un commentaire