copulaPdfGaussian
First introduced in version 3.00.6
Syntax
copulaPdfGaussian(rho, X)
Details
Calculates the probability density of a Gaussian copula at the specified evaluation points.
A Gaussian copula uses a correlation matrix to characterize the symmetric dependence structure between variables. It does not capture tail dependence and is commonly used as a baseline model in risk modeling or dependence-structure comparisons. copulaPdfGaussian is suitable for calculating densities for a set of pseudo-observations in the (0, 1) space after the correlation parameters have been determined. The results can be used for likelihood evaluation, model comparison, or two-dimensional density visualization.
Parameters
rho is a scalar or matrix that specifies the linear correlation parameters.
- When X is two-dimensional data, rho can be a DOUBLE scalar that specifies the correlation coefficient between the two variables. The value must be in the range
(-1, 1). - rho can also be a 2×2 correlation matrix.
X is a non-empty two-dimensional numeric matrix or table with dimensions n×p (p = 2), specifying the set of evaluation points for which densities are computed. Here, n is the number of evaluation points, that is, the number of rows in X; p is the number of variables, that is, the number of columns in X.
- All elements must be finite numbers.
- Rows whose elements are all in the open interval
(0, 1)are evaluated using the Gaussian copula density formula. - Rows with any element u on the boundary of or outside the interval (
u <= 0oru >= 1) return 0. - When X is a table, each column represents a variable, and the column order defines the variable order.
Returns
A DOUBLE vector with the same length as the number of rows in X. The i-th element of the returned vector is the copula probability density for the i-th row of X.
Examples
Example 1. Calculate the probability density of a two-dimensional Gaussian copula with correlation coefficient 0.5 at the central point [0.5, 0.5].
X = matrix([0.5], [0.5])
y = copulaPdfGaussian(0.5, X)
y
// Output: [1.1547005383792515]
Example 2. Evaluate multiple sets of two-dimensional pseudo-observations and demonstrate how boundary points are handled. The first row contains 0 and the third row contains 1, so the corresponding densities are 0.
u1 = [0.0, 0.2, 0.9]
u2 = [0.1, 0.3, 1.0]
X = matrix(u1, u2)
y = copulaPdfGaussian(0.7, X)
y
// Output: [0, 1.6000931673540228, 0]
Example 3. Use a fitted correlation matrix to calculate Gaussian copula densities for sample points.
setRandomSeed(5)
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)
fitRes = copulaFitGaussian(X)
y = copulaPdfGaussian(fitRes.rho, X)
avg(y)
// Output: 1.826696615255413
Example 4. Use a table as input to calculate the densities of pseudo-observations for two stocks under the specified Gaussian copula parameters.
setRandomSeed(5)
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)
stockReturns = table(uA as stockA, uB as stockB)
y = copulaPdfGaussian(0.6, stockReturns)
y[0:5]
// Output: [1.2167754772865382, 1.2529459921234738, 1.2116732436470703, 1.5904475671893479, 1.2464171642220696]
Related functions: copulaFitGaussian, copulaRandGaussian, copulaCdfGaussian, copulaPdfStudent, copulaPdfClayton, copulaPdfFrank, copulaPdfGumbel
