R: Methods for Contour Plots in Package 'copula'

contour-methods {copula} | R Documentation

## Methods for Contour Plots in Package 'copula'

### Description

Methods for function `contour` to draw contour lines aka a level plot for objects from package copula.

### Usage

    ## S4 method for signature 'Copula'
    contour(x, FUN,
                       n.grid = 26, delta = 0,
                       xlab = quote(u[1]), ylab = quote(u[2]),
                       box01 = TRUE, ...)
    ## S4 method for signature 'mvdc'
    contour(x, FUN, xlim, ylim, n.grid = 26,
                       xlab = quote(x[1]), ylab = quote(x[2]),
    		   box01 = FALSE, ...)

### Arguments

`x` | a `"Copula"` or a `"mvdc"` object.
`FUN` | the `function` to be plotted; typically `dCopula` or `pCopula`.
`n.grid` | the number of grid points used in each dimension. This can be a vector of length two, giving the number of grid points used in x- and y-direction, respectively; the function `FUN` will be evaluated on the corresponding (x,y)-grid.
`delta` | a small number in [0, 1/2) influencing the evaluation boundaries. The x- and y- vectors will have the range `[0+delta, 1-delta]`, the default being `[0,1]`.
`xlab, ylab` | the x-axis and y-axis labels.
`xlim, ylim` | the `range` of the x and y variables, respectively.
`box01` | a logical specifying if a faint rectangle should be drawn on the boundary of [0,1]^2 (often useful for copulas, but typically not for general multivariate distributions (`"mvdc"`)).
`...` | further arguments for (the default method of) `contour()`, e.g., `nlevels`, `levels`, etc.

### Methods

Contour lines are drawn for `"Copula"` or `"mvdc"` objects, see `x` in the Arguments section.

### See Also

The `persp-methods` for “perspective” aka “3D” plots.

### Examples

    contour(frankCopula(-0.8), dCopula)
    contour(frankCopula(-0.8), dCopula, delta=1e-6)
    contour(frankCopula(-1.2), pCopula)
    contour(claytonCopula(2), pCopula)

    ## the Gumbel copula density is "extreme"
    ## --> use fine grid (and enough levels):
    r <- contour(gumbelCopula(3), dCopula, n=200, nlevels=100)
    range(r$z)# [0, 125.912]
    ## Now superimpose contours of three resolutions:
    contour(r, levels = seq(1, max(r$z), by=2), lwd=1.5)
    contour(r, levels = (1:13)/2, add=TRUE, col=adjustcolor(1,3/4), lty=2)
    contour(r, levels = (1:13)/4, add=TRUE, col=adjustcolor(2,1/2),
            lty=3, lwd=3/4)

    x <- mvdc(gumbelCopula(3), c("norm", "norm"),
              list(list(mean = 0, sd =1), list(mean = 1)))
    contour(x, dMvdc, xlim=c(-2, 2), ylim=c(-1, 3))
    contour(x, pMvdc, xlim=c(-2, 2), ylim=c(-1, 3))

[Package copula version 1.0-1 Index]