EMPIRgrid_lkup: Empirical Copula by Bilinear Interpolation of Gridded...

EMPIRgrid_lkupR Documentation

Empirical Copula by Bilinear Interpolation of Gridded Bivariate Empirical Copula

Description

Compute joint probability through a gridded empirical copula \mathbf{C}_n(u,v) using bilinear interpolation (vectorized, no for looping). The function is designed to act like EMPIRcop, but in lieu of consuming the bivariate data in para argument, the EMPIRgrid_lkup operates off a precomputed gridded list representation of the empirical copula computed either from EMPIRgrid (legacy) or EMPIRgrid_fast. Given a gridded empirical copula denoted as \ddot{\mathbf{C}}_n and bounding cells of a rectangle 11 (lower left), 12 (lower right), 21 (upper left), and 22, the \mathbf{C}_n(u,v) can be estimated by bilinear interpolation in a weighted mean form as:

\mathbf{C}_n(u,v) \approx w_{11}\times\ddot{\mathbf{C}}_{11} + w_{12}\times\ddot{\mathbf{C}}_{12} + w_{21}\times\ddot{\mathbf{C}}_{21} + w_{22}\times\ddot{\mathbf{C}}_{22}\text{,}

for which the weights are

w_{11} = \frac{(u_2 - u )(v_2 - v )}{(u_2 - u_1)(v_2 - v_1)}\text{,\ } w_{12} = \frac{(u_2 - u )(v - v_1)}{(u_2 - u_1)(v_2 - v_1)}\text{,}

w_{21} = \frac{(u - u_1)(v_2 - v )}{(u_2 - u_1)(v_2 - v_1)}\text{,\ and\ } w_{22} = \frac{(u - u_1)(v - v_1)}{(u_2 - u_1)(v_2 - v_1)}\text{.}

Usage

EMPIRgrid_lkup(u, v, para=NULL, ...)

Arguments

u

Nonexceedance probability u in the X direction;

v

Nonexceedance probability v in the Y direction;

para

A gridded empirical data structure from EMPIRgrid and EMPIRgrid_fast; and

...

Additional arguments to pass to EMPIRgrid_fast if para is null.

Value

Value(s) for the copula are returned.

Author(s)

W.H. Asquith

See Also

EMPIRgrid, EMPIRgrid_fast

Examples

## Not run: 
  n <- 2000
  para  <- list(cop=GHcop, para=c(2.3,1.5), breve=0.5)
  uv    <- simCOP(n, cop=breveCOP, para=para, graphics=TRUE)
  system.time(gridn <- EMPIRgrid(     uv, ctype="1/n", deluv=1/2000))
  system.time(gridf <- EMPIRgrid_fast(uv, ctype="1/n"))
  # gridf should be shown to be over 100 times faster.
  copn  <- EMPIRgrid_lkup(uv[,1], uv[,2], para=gridn)
  copf  <- EMPIRgrid_lkup(uv[,1], uv[,2], para=gridf)
  plot(copn, copf); abline(0,1) # equal value line 
## End(Not run)

## Not run: 
  n <- 21 # Make a small sample demonstration and exhaustive list of
  # comparisons in empirical copula computation styles.
  para  <- list(cop=GHcop, para=c(2.3,1.5), breve=0.5)
  uv    <- simCOP(n, cop=breveCOP, para=para,    graphics=TRUE )
  gridn <- EMPIRgrid_fast(uv, ctype="1/n",       gridonly=FALSE)
  gridw <- EMPIRgrid_fast(uv, ctype="bernstein", gridonly=FALSE)
  copw  <- EMPIRcop(uv[,1], uv[,2], para=uv, ctype="weibull"     )
  copn  <- EMPIRcop(uv[,1], uv[,2], para=uv, ctype="1/n"         )
  coph  <- EMPIRcop(uv[,1], uv[,2], para=uv, ctype="hazen"       )
  copb  <- EMPIRcop(uv[,1], uv[,2], para=uv, ctype="bernstein"   )
  copc  <- EMPIRcop(uv[,1], uv[,2], para=uv, ctype="checkerboard")
  copgn <- EMPIRgrid_lkup(uv[,1], uv[,2], para=gridn)
  copgb <- EMPIRgrid_lkup(uv[,1], uv[,2], para=gridw)

  plot(  copgn, copw, pch=24, col="seagreen4", bg="seagreen2")
  points(copgn, copn, pch=24, col="red4"     , bg="red1"     )
  points(copgn, coph, pch=24, col="blue4"    , bg="blue1"    )
  points(copgn, copb, pch=24, col="orchid4"  , bg="orchid1"  )
  points(copgn, copc, pch=24, col="salmon4"  , bg="salmon1"  )

  points(copgb, copw, pch=25, col="seagreen", bg="white")
  points(copgb, copn, pch=25, col="red"     , bg="white")
  points(copgb, coph, pch=25, col="blue"    , bg="white")
  points(copgb, copb, pch=25, col="orchid1" , bg="white")
  points(copgb, copc, pch=25, col="salmon"  , bg="white")

  abline(0,1, lty=2) # equal value line 
## End(Not run)

copBasic documentation built on July 23, 2026, 1:07 a.m.