Learn R Programming

VineCopula (version 1.6-1)

BiCopMetaContour: Contour Plot of Bivariate Meta Distribution

Description

This function plots a bivariate contour plot corresponding to a bivariate meta distribution with different margins and specified bivariate copula and parameter values or creates corresponding empirical contour plots based on bivariate copula data.

Usage

BiCopMetaContour(u1 = NULL, u2 = NULL, bw = 1, size = 100,
                 levels = c(0.01, 0.05, 0.1, 0.15, 0.2), 
                 family = "emp", par = 0, par2 = 0, PLOT = TRUE,
                 margins = "norm", margins.par = 0, xylim = NA, obj = NULL, ...)

Arguments

u1, u2
Data vectors of equal length with values in [0,1] (default: u1 and u2 = NULL).
bw
Bandwidth (smoothing factor; default: bw = 1).
size
Number of grid points; default: size = 100.
levels
Vector of contour levels. For Gaussian, Student t or exponential margins the default value (levels = c(0.01, 0.05, 0.1, 0.15, 0.2)) typically is a good choice. For uniform margins we recommend levels = c(0.1, 0.3, 0.5, 0.7, 0.
family
An integer defining the bivariate copula family or indicating an empirical contour plot: "emp" = empirical contour plot (default; margins can be specified by margins) 0 = independence copula 1 = Gauss
par
Copula parameter; if empirical contour plot, par = NULL or 0 (default).
par2
Second copula parameter for t-, BB1, BB6, BB7, BB8, Tawn type 1 and type 2 copulas (default: par2 = 0).
PLOT
Logical; whether the results are plotted. If PLOT = FALSE, the values x, y and z are returned (see below; default: PLOT = TRUE).
margins
Character; margins for the bivariate copula contour plot. Possible margins are: "norm" = standard normal margins (default) "t" = Student t margins with degrees of freedom as specified by margins.par "gamma"
margins.par
Parameter(s) of the distribution of the margins if necessary (default: margins.par = 0), i.e.,
  • a positive real number for the degrees of freedom of Student t margins (seedt),
  • a
xylim
A 2-dimensional vector of the x- and y-limits. By default (xylim = NA) standard limits for the selected margins are used.
obj
BiCop object containing the family and parameter specification.
...
Additional plot arguments.

Value

  • xA vector of length size with the x-values of the kernel density estimator with Gaussian kernel if the empirical contour plot is chosen and a sequence of values in xylim if the theoretical contour plot is chosen.
  • yA vector of length size with the y-values of the kernel density estimator with Gaussian kernel if the empirical contour plot is chosen and a sequence of values in xylim if the theoretical contour plot is chosen.
  • zA matrix of dimension size with the values of the density of the meta distribution with chosen margins (see margins and margins.par) evaluated at the grid points given by x and y.

See Also

BiCopChiPlot, BiCopKPlot, BiCopLambda

Examples

Run this code
## Example 1: contour plot of meta Gaussian copula distribution
## with Gaussian margins
tau <- 0.5
fam <- 1
theta <- BiCopTau2Par(fam, tau)	
BiCopMetaContour(u1 = NULL, u2 = NULL, bw = 1, size = 100,
                 levels = c(0.01, 0.05, 0.1, 0.15, 0.2),
                 family = fam, par = theta, main = "tau = 0.5")


## Example 2: empirical contour plot with standard normal margins
dat <- BiCopSim(N = 1000, fam, theta)
BiCopMetaContour(dat[,1], dat[,2], bw = 2, size = 100,
                 levels = c(0.01, 0.05, 0.1, 0.15, 0.2),
                 par = 0, family = "emp", main = "N = 1000")

# empirical contour plot with exponential margins
BiCopMetaContour(dat[,1], dat[,2], bw = 2, size = 100,
                 levels = c(0.01, 0.05, 0.1, 0.15, 0.2),
                 par = 0, family = "emp", main = "n = 500",
                 margins = "exp", margins.par = 1)

Run the code above in your browser using DataLab