BiCopParamDistLp: Compute the distance between 2 parametric copulas

View source: R/BiCopParamDistLp.R

BiCopParamDistLpR Documentation

Compute the distance between 2 parametric copulas

Description

This function uses the numerical integration procedure cubature::hcubature() to numerical integrate the distance between the distribution or between the densities of two bivariate copulas.

Usage

BiCopParamDistLp(
  family,
  par,
  par_p,
  par2 = par,
  par2_p = par_p,
  family_p = family,
  p,
  type,
  maxEval = 0,
  truncVal = 0
)

Arguments

family

family of the first copula.

par

first parameter of the first copula.

par_p

first parameter of the second copula.

par2

second parameter of the first copula (only useful for two-parameter families of copulas).

par2_p

second parameter of the first copula (only useful for two-parameter families of copulas).

family_p

family of the second copula.

p

determines the L_p distance that is used.

type

type of the functions considered. Can be "cdf" for the distance between the two cumulative distribution functions or "pdf" for the distance between the two probability density functions.

maxEval

maximum number of evaluation of the function to be integrated. If 0, then no maximum limit is given. (Only used if p < Inf).

truncVal

the distance is computed using the supremum or the integral of the function on [truncVal, 1 - truncVal]^2.

Value

If p < Inf, it returns a list of four items

  • distance the value of the distance

  • integral the value of the integral, which is the p-th power of the distance.

  • error the estimated relative error of the integral

  • returnCode the integer return code of the C routine called by cubature::hcubature(). This should be 0 if there is no error.

If p = Inf, it returns a list of two items

  • distance the maximum difference between the two copulas (respectively, between the two copula densities).

  • u_max the point at which this difference is attained.

Examples

# Distance between the densities of a Gaussian copula with correlation 0.5
# and a Gaussian copula with correlation 0.2
BiCopParamDistLp(family = 1, par = 0.5, par_p = 0.2, p = 2, type = "cdf", maxEval = 10)
BiCopParamDistLp(family = 1, par = 0.5, par_p = 0.2, p = Inf, type = "cdf")

# Distance between the cdf of a Student copula
# with correlation 0.5 and 4 degrees of freedom
# and a Student copula with the same correlation but 20 degrees of freedom
BiCopParamDistLp(family = 2, par = 0.5, par_p = 0.5,
par2 = 5, par2_p = 20, p = 2, type = "pdf", maxEval = 10)

# Distance between the densities of a Gaussian copula with correlation 0.5
# and of a Student copula with correlation 0.5 and 15 degrees of freedom
BiCopParamDistLp(family = 1, par = 0.5, par_p = 0.5, par2_p = 15,
family_p = 2, p = 2, type = "pdf", maxEval = 10)


MMDCopula documentation built on April 25, 2022, 5:06 p.m.