copulaFitGaussian

First introduced in version 3.00.6

Syntax

copulaFitGaussian(X)

Details

Fits a Gaussian Copula to data in the (0, 1) space and estimates the linear correlation matrix.

Gaussian Copula is suitable for modeling symmetric linear dependence and does not capture tail dependence.

Parameters

X is a non-empty two-dimensional numeric matrix or table with dimensions n×p (p = 2), specifying the input data.

  • All elements must be finite and strictly within the open interval (0, 1), and no column can be constant or nearly constant.
  • n denotes the number of samples, and p denotes the number of variables. The input data should satisfy n > p.

Returns

Returns a dictionary with the following key-value pairs:

  • rho: A matrix indicating the estimated p×p linear correlation matrix.
  • logLikelihood: A DOUBLE scalar indicating the log-likelihood of the Gaussian Copula model.

Examples

Note: The outputs in the following examples are for illustration only. Actual results may vary.

Example 1. Generate two-dimensional positively correlated data with a true correlation of 0.7, fit a Gaussian Copula, and verify whether the estimated correlation is close to the true value.

n = 1000
x1 = norm(0, 1, n)
x2 = 0.7 * x1 + sqrt(1 - 0.49) * norm(0, 1, n)
u1 = (rank(x1) + 1) \ (n + 1.0)
u2 = (rank(x2) + 1) \ (n + 1.0)
X = matrix(u1, u2)

res = copulaFitGaussian(X)
res.logLikelihood
// Output: 326.382767
res.rho
#0 #1
1 0.692384
0.692384 1

Example 2. Generate negatively correlated data with a true correlation of −0.5 and fit a Gaussian Copula to verify its estimation of negative dependence.

n = 1000
x1 = norm(0, 1, n)
x2 = -0.5 * x1 + sqrt(1 - 0.25) * norm(0, 1, n)
u1 = (rank(x1) + 1) \ (n + 1.0)
u2 = (rank(x2) + 1) \ (n + 1.0)
Xneg = matrix(u1, u2)
resNeg = copulaFitGaussian(Xneg)
resNeg.logLikelihood
// Output: 171.85922
resNeg.rho
#0 #1
1 -0.539325
-0.539325 1

Example 3. Simulate daily returns of two stocks, convert them to pseudo-observations, and fit a Gaussian Copula using a table as input to serve as a baseline model for portfolio risk modeling.

// Simulate daily returns of two stocks and transform them into pseudo-observations in (0, 1)
n = 1000
retA = norm(0.0005, 0.02, n)
retB = 0.6 * retA + sqrt(1 - 0.36) * norm(0.0003, 0.015, n)
uA = (rank(retA) + 1) \ (n + 1.0)
uB = (rank(retB) + 1) \ (n + 1.0)

// Construct a table as input
stockReturns = table(uA as stockA, uB as stockB)
res = copulaFitGaussian(stockReturns)
res.logLikelihood
// Output: 295.109231
res.rho
#0 #1
1 0.667678
0.667678 1

Related functions: copulaFitStudent, copulaFitClayton, copulaFitFrank, copulaFitGumbel, copulaRandGaussian, copulaPdfGaussian, copulaCdfGaussian