Learn R Programming

ks (version 1.8.13)

kcopula: Kernel copula/copula density estimate

Description

Kernel copula and copula density estimator for 2-dimensional data.

Usage

kcopula(x, H, hs, gridsize, gridtype, xmin, xmax, supp=3.7, eval.points,
  binned=FALSE, bgridsize, w, verbose=FALSE, marginal="kernel")
kcopula.de(x, H, Hfun, hs, gridsize, gridtype, xmin, xmax, supp=3.7,
  eval.points, binned=FALSE, bgridsize, w, verbose=FALSE, compute.cont=FALSE,
  approx.cont=TRUE, boundary.supp, marginal="kernel")

Arguments

x
matrix of data values
H,hs
bandwidth matrix. If these are missing, Hpi or hpi is called by default.
Hfun
bandwidth matrix function. If missing, Hpi is the default. This is called only when H is missing.
gridsize
vector of number of grid points
gridtype
not yet implemented
xmin,xmax
vector of minimum/maximum values for grid
supp
effective support for standard normal
eval.points
points at which estimate is evaluated
binned
flag for binned estimation. Default is FALSE.
bgridsize
vector of binning grid sizes
w
vector of weights. Default is a vector of all ones.
verbose
flag to print out progress information. Default is FALSE.
marginal
"kernel" = kernel cdf or "empirical" = empirical cdf to calculate pseudo-uniform values. Default is "kernel".
compute.cont
flag for computing 1% to 99% probability contour levels. Default is FALSE.
approx.cont
flag for computing approximate probability contour levels. Default is TRUE.
boundary.supp
scaled boundary region is [0, boundary.supp*h] or [1-boundary.supp*h,1] on [0,1]. Default is 1.

Value

  • A kernel copula estimate, output from kcopula, is an object of class kcde. A kernel copula density estimate, output from kcopula.de, is an object of class kde.

Details

For kernel copula estimates, a transformation approach is used to account for the boundary effects. For kernel copula density estimates, for those points which are in the interior region, the usual normal kernel density estimator (kde) is used. For those points in the boundary region, a product beta kernel based on the boundary corrected univariate beta kernel of Chen (1999) is used.

References

Duong, T. (2013) Optimal data-based smoothing for non-parametric estimation of copula functions and their densities. Submitted.

Chen, S.X. (1999). Beta kernel estimator for density functions. Computational Statistics & Data Analysis, 31, 131--145.

See Also

kcde, kde

Examples

Run this code
library(MASS)
data(crabs)
Chat <- kcopula(x=crabs[crabs$sp=="B",4:5])
plot(Chat, disp="persp", thin=3, col="white", border=1)
chat <- kcopula.de(x=crabs[crabs$sp=="B",4:5])
plot(chat, disp="persp", thin=3, theta=40, phi=30, col="white", border=1)

Run the code above in your browser using DataLab