Trying to create a table for quantiles of the sum of two dependent random variables using built-in copula distributions (Clayton, Frank, Gumbel) with Beta marginals. Tried NProbability and FindRoot with various methods — not fast enough.
An example of the copula-marginal combinations I need to explore is the following:
nProbClayton[t_?NumericQ, c_?NumericQ] :=
NProbability[ x + y <= t, {x, y} \[Distributed]
CopulaDistribution[{"Clayton", c}, {BetaDistribution[8, 2],
BetaDistribution[8, 2]}]]
For a single evaluation of the numeric probability using
nProbClayton[1.9, 1/10] // Timing // Quiet
I get
{4.914, 0.939718}
on a Vista 64bit Core2 Duo T9600 2.80GHz machine (MMA 8.0.4)
To get a quantile of the sum, using
FindRoot[nProbClayton[q, 1/10] == 1/100, {q, 1, 0, 2}// Timing // Quiet
with various methods
( `Method -> Automatic`, `Method -> "Brent"`, `Method -> "Secant"` )
takes about a minute to find a single quantile: Timings are
{48.781, {q -> 0.918646}}
{50.045, {q -> 0.918646}}
{65.396, {q -> 0.918646}}
For other copula-marginal combinations timings are marginally better.
Need: any tricks/methods to improve timings.
The CDF of a Clayton-Pareto copula with parameter
ccan be calculated according toThen,
cdf[c][t1,t2]is the probability thatx<=t1andy<=t2. This means that you can calculate the probability thatx+y<=taccording toThe timings I get on my machine are
Note that I get a different value for the probability from the one in the original post. However, running
nProbClayton[1.9,0.1]produces a warning about slow convergence which could mean that the result in the original post is off. Also, if I changex+y<=ttox+y>tin the original definition ofnProbClaytonand calculate1-nProbClayton[1.9,0.1]I get0.939825(without warnings) which is the same result as above.For the quantile of the sum I get
Again, I get a different result from the one in the original post but similar to before, changing
x+y<=ttox+y>tand calculatingFindRoot[nProbClayton[q, 1/10] == 1-1/100, {q, 1, 0, 2}]returns the same value forqas above.