Class GaussianCopula
java.lang.Object
com.quantfinlib.risk.GaussianCopula
Gaussian and Student-t copula samplers — dependence separated from
marginals, which is the entire point of copula modeling: "these five
factors co-move like THIS" (the copula) is a different statement from
"each factor's own distribution looks like THAT" (the marginals), and
gluing arbitrary marginals to a chosen dependence structure is how
joint risk scenarios get built.
Both samplers emit correlated UNIFORMS — feed them through your
marginals' inverse CDFs. The Gaussian copula has NO tail dependence:
joint extremes are asymptotically independent, the property famously
blamed for pre-2008 CDO models. The Student-t copula with few degrees
of freedom has strong SYMMETRIC tail dependence — extremes cluster —
and converges to the Gaussian as df → ∞; the tests pin both
behaviors. Correlation matrices are Cholesky-factored at construction
(must be positive-definite — a borderline matrix fails loudly here,
not as NaN samples later). Research lane; deterministic per seed via
the caller-owned Random.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintvoidOne Gaussian-copula draw:out[i]are correlated uniforms in (0, 1).voidOne Student-t-copula draw withdfdegrees of freedom: the same correlated Gaussians divided by a shared √(χ²/df) — the SHARED shock is what creates tail dependence (one bad draw drags every factor's tail together).
-
Constructor Details
-
GaussianCopula
public GaussianCopula(double[][] correlation) - Parameters:
correlation- symmetric positive-definite correlation matrix
-
-
Method Details
-
sample
One Gaussian-copula draw:out[i]are correlated uniforms in (0, 1). Arrays are caller-owned;scratchmust be a second array of the same length (kept separate so the sampler allocates nothing per draw). -
sampleT
One Student-t-copula draw withdfdegrees of freedom: the same correlated Gaussians divided by a shared √(χ²/df) — the SHARED shock is what creates tail dependence (one bad draw drags every factor's tail together). Uniforms come from the EXACT t-CDF (MathUtils.tCdf(double, double)); a moment-matched normal approximation here would distort exactly the tail quantiles this sampler exists to model (at df = 3 it puts ~37% excess mass below the 1% level). -
dimension
public int dimension()
-