In the interest of learning about Copula's, I want to write some Matlab code which generates copula random variables (I realize there exists a toolbox for this, but I don't want to use that). As outlined in several sources, one method of generating Copula RV's is:
- Generate values U, T, independent random variables, uniform on [0,1]
- The conditional distribution of V given U=u is $$ c_u(v) = \frac{\partial C(u,v)}{\partial u} $$
- Given the pairs (u,t) from (1), take $v = c_u^{-1}(t)$
- $x = G^{-1}(u)$, $y = H^{-1}(v)$
I started to apply this to the FGM copula, but am having some difficulty. Here is what I have done so far: $$ C_\theta(u,v) = uv\left[1 + \theta(1-u)(1-v) \right]$$ $$ c_u(v) = \frac{\partial C_\theta(u,v)}{\partial u} = uv + \theta uv - \theta uv^2 -\theta u^2v + \theta u^2 v^2$$ The next step is to find the inverse, $c_u^{-1}(t)$, but analytically it is annoying to determine. I put it into WolframAlpha, and what I got was a piece-wise solution:
I'm not sure how to proceed with a piece-wise solution. Obviously, if $\theta=0$, then $c_u^{-1}(t) = v$. In the other situations, how do I disambiguate the value of $c_u^{-1}(t)$?
Thanks!