Skip to content

Clustering, density estimation, and anomaly detection · Mixture and density models · UCL047 · Model

Gaussian copula density model

Separate marginal distributions from multivariate dependence. It allows non-Gaussian feature marginals while representing dependence through latent correlated Gaussian variables.

Partly runs in CodeSplash Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

A CodeSplash method covers part of this entry; some options or variants aren't built yet.

Do it in CodeSplash Run it on your own data, in Python or R.

Availability
Partly runs in CodeSplash
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
Verified in Python and R through synth.copula. The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Separate marginal distributions from multivariate dependence. It allows non-Gaussian feature marginals while representing dependence through latent correlated Gaussian variables.

Question / hypotheses

Which probability model adequately explains the reference distribution and its latent heterogeneity? This entry defines an estimation or optimization objective, not an intrinsic null/alternative hypothesis test.

Architecture / computational structure

Marginal CDF transforms, inverse-normal scores, and a correlation matrix.

Assumptions

Empirical ranks require endpoint handling before inverse-normal transformation. Discrete features need specialized treatment; plugging tied empirical CDFs into the continuous density formula is not an exact discrete likelihood. Gaussian copulas also lack asymptotic tail dependence except degenerate cases.

Formula / computational definition

Set uj=Fj(xj)u_j=F_j(x_j) and zj=Φ−1(uj)z_j=\Phi^{-1}(u_j). For continuous marginals, f(x)=∣R∣−1/2exp⁡[−12zT(R−1−I)z]∏jfj(xj)f(x)=|R|^{-1/2}\exp[-\tfrac12z^T(R^{-1}-I)z]\prod_j f_j(x_j), where RR is a correlation matrix and Fj,fjF_j,f_j are marginal CDFs and densities. The bracketed factor is the copula density.

Parameters and notation

Learned or fitted quantities: Marginal distribution parameters and a valid latent correlation matrix. User-set hyperparameters/design choices: Fit marginal families or smooth estimates and a positive-definite RR. Tune these against the stated objective and stability/validation criteria; do not select settings on the final evaluation set.

Fitting, fine-tuning, and adaptation

Refit likelihood or posterior parameters on the new reference population; neural fine-tuning does not apply to this classical model. Warm starts can reduce computation but should be compared with fresh initialization. Recheck predictive fit and regularization after a domain shift.

How to use and calibrate

Assess marginal fit and dependence fit separately, using rank correlation, joint-tail checks, and held-out likelihood where the full density is defined.

Example application

Model non-Gaussian marginals with a latent Gaussian dependence structure. Define the reference population, measurement units, and success criterion before fitting; investigate whether discovered groups or alerts reflect the intended phenomenon.

Interpretation / pitfalls

Watch out

The reported result is conditional on the representation and objective. A stable partition can reflect nuisance structure such as batch, collection site, or missingness. Confirm the interpretation in original variables and an independent sample.

Python and R code examples

R copula supplies Gaussian copula construction and fitting. Python can implement the displayed latent-Gaussian transform with SciPy and estimate a regularized correlation matrix. A copula score without marginal densities is not the full data density.

Component: Gaussian copula log density given continuous marginal CDF values. Python: executed successfully; R: not executed (Rscript unavailable). These small fixtures establish the arithmetic operation, not full-method accuracy or reproduction of paper results.

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — Gaussian copula log density given continuous marginal CDF values. · needs numpy, scipy

import numpy as np
from scipy.stats import norm
u=np.array([.2,.7]); z=norm.ppf(u); R=np.array([[1.,.4],[.4,1.]])
result=-.5*np.linalg.slogdet(R)[1]-.5*z@(np.linalg.inv(R)-np.eye(2))@z
print(result)
R

Component demo, not a trained model — Gaussian copula log density given continuous marginal CDF values.

u=c(.2,.7); z=qnorm(u); R=rbind(c(1,.4),c(.4,1))
result=-.5*as.numeric(determinant(R,logarithm=TRUE)$modulus)-.5*as.numeric(t(z)%*%(solve(R)-diag(2))%*%z)
print(result)

Sources

From the CodeSplash reference, entry UCL047.