4.3. La métho<strong>de</strong> <strong>de</strong>s distributions conditionnellesFinalement, nous obtenonsC −1 (u; u 1 ) = { u 2 : C 2|1 (u 1 , u 2 ; θ) = u }= − 1 θ ln (1 +Co<strong>de</strong> GAUSS 4.4 – Simulation <strong>de</strong> la copule Frank –/***> rndCopulaFrank***/u ( e −θ − 1 ) ).u + (1 − u) e −θu1proc (2) = rndCopulaFrank(theta,ns);local v,u1,u2;v = rnduCopula(ns,2);u1 = v[.,1] .* ones(rows(theta),cols(theta));u2 = -ln(1 + v[.,2].*(exp(-theta)-1)./(v[.,2] + (1-v[.,2]).*exp(-theta.*u1) ))./theta;retp(u1,u2);endp;Dans <strong>de</strong> nombreux cas, il n’est pas possible d’obtenir une formule analytique <strong>de</strong> C −1 (u; u 1 ) (voir[15, Joe (1987), pages 146 et 147]). Dans ce cas, nous pouvons résoudre l’équation C 2|1 (u 1 , u 2 ; θ) =u par une métho<strong>de</strong> numérique. La procédure suivante rndCopula2 est construite à partir d’unebisection classique. Lorsque la distribution conditionnelle C 2|1 (u 1 , u 2 ; θ) n’est pas spéci<strong>fi</strong>ée, celle-ciest obtenue par une métho<strong>de</strong> <strong>de</strong> gradient numérique.Co<strong>de</strong> GAUSS 4.5 – Simulation d’une copule bivariée par la métho<strong>de</strong> <strong>de</strong>s distributions conditionnelles–/***> rndCopula2***/proc (2) = rndCopula2(cdfCopula,cndCopula,ns);local v,u1,u2;_CopulaFunction = cdfCopula|cndCopula;v = rnduCopula(ns,2);_Copula_v = v;u1 = v[.,1];u2 = rndCopulaFindZero(&_rndCopula2,0+__macheps,1-__macheps);retp(u1,u2);endp;proc _rndCopula2(u2);local cdfCopula,cndCopula,u,w;cdfCopula = _CopulaFunction[1];cndCopula = _CopulaFunction[2];if cndCopula /= 0;local cndCopula:proc;u = cndCopula(_Copula_v[.,1],u2);else;{u,w} = gradp2D(cdfCopula,_Copula_v[.,1],u2);endif;retp( u - _Copula_v[.,2] );endp;52
4.3. La métho<strong>de</strong> <strong>de</strong>s distributions conditionnellesproc rndCopulaFindZero(f,a,b);local f:proc;local ya,yb,Nobs,c,yc,indx1,indx2;local indx,s,diff,const;ya = f(a); yb = f(b);Nobs = rows(ya);a = a .* ones(Nobs,1);b = b .* ones(Nobs,1);indx = (ya .< 0) .and (yb .> 0);if sumc(indx) == 0;retp(miss(zeros(Nobs,1),0));endif;if sumc(indx) == Nobs;do while maxc(abs(a-b)) > _rndCopulaFindZero_Tol;c = (a+b)/2;yc = f(c);indx1 = yc. _rndCopulaFindZero_Tol;c = (a+b)/2;c[s] = const;yc = f(c);indx1 = yc.