www.gusucode.com > stats 源码程序 matlab案例代码 > stats/ComputeGaussianCopulaRankCorrelationExample.m

    %% Compute the Gaussian Copula Rank Correlation
%
%%
% Compute the rank correlation for a Gaussian copula with the specified 
% linear correlation parameter |rho|.

% Copyright 2015 The MathWorks, Inc.

rho = -.7071;
tau = copulastat('gaussian',rho)

%%
% Use the copula to generate dependent random values from a beta
% distribution that has parameters a and b equal to 2.
rng default  % For reproducibility
u = copularnd('gaussian',rho,100);
b = betainv(u,2,2);

%%
% Verify that the sample has a rank correlation approximately equal to |tau|.
tau_sample = corr(b,'type','k')