BiCopMetaContour: Contour plot of bivariate meta distribution with different...

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/BiCopMetaContour.r

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

1
2
3
4
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, ...)

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.9,1.1,1.3,1.5)
and for Gamma margins
levels = c(0.005,0.01,0.03,0.05,0.07,0.09).

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 = Gaussian copula
2 = Student t copula (t-copula)
3 = Clayton copula
4 = Gumbel copula
5 = Frank copula
6 = Joe copula
7 = BB1 copula
8 = BB6 copula
9 = BB7 copula
10 = BB8 copula
13 = rotated Clayton copula (180 degrees; “survival Clayton”)
14 = rotated Gumbel copula (180 degrees; “survival Gumbel”)
16 = rotated Joe copula (180 degrees; “survival Joe”)
17 = rotated BB1 copula (180 degrees; “survival BB1”)
18 = rotated BB6 copula (180 degrees; “survival BB6”)
19 = rotated BB7 copula (180 degrees; “survival BB7”)
20 = rotated BB8 copula (180 degrees; “survival BB8”)
23 = rotated Clayton copula (90 degrees)
24 = rotated Gumbel copula (90 degrees)
26 = rotated Joe copula (90 degrees)
27 = rotated BB1 copula (90 degrees)
28 = rotated BB6 copula (90 degrees)
29 = rotated BB7 copula (90 degrees)
30 = rotated BB8 copula (90 degrees)
33 = rotated Clayton copula (270 degrees)
34 = rotated Gumbel copula (270 degrees)
36 = rotated Joe copula (270 degrees)
37 = rotated BB1 copula (270 degrees)
38 = rotated BB6 copula (270 degrees)
39 = rotated BB7 copula (270 degrees)
40 = rotated BB8 copula (270 degrees)

par

Copula parameter; if empirical contour plot, par = NULL or 0 (default).

par2

Second copula parameter for t-, BB1, BB6, BB7 and BB8 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" = Gamma margins with shape and scale as specified by margins.par
"exp" = Exponential margins with rate as specified by margins.par
"unif" = uniform margins

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 (see dt),

  • a 2-dimensional vector of positive real numbers for the shape and scale parameters of Gamma margins (see dgamma),

  • a positive real number for the rate parameter of exponential margins (see dexp).

xylim

A 2-dimensional vector of the x- and y-limits. By default (xylim = NA) standard limits for the selected margins are used.

...

Additional plot arguments.

Value

x

A 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.

y

A 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.

z

A 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.

Note

Warning: The combination family = 0 (independence copula) and margins = "unif" (uniform margins) is not possible because all z-values are equal.

Author(s)

Ulf Schepsmeier, Alexander Bauer

See Also

BiCopChiPlot, BiCopKPlot, BiCopLambda

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## 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)

Example output

The CDVine package is no longer developed actively.
Please consider using the more general VineCopula package
(see https://CRAN.R-project.org/package=VineCopula),
which extends and improves the functionality of CDVine.

CDVine documentation built on May 2, 2019, 9:28 a.m.