contourplot2-methods {copula} | R Documentation |
Contour Plot Methods 'contourplot2' in Package 'copula'
Description
Methods for contourplot2()
, a version of
contourplot()
from lattice, to draw
contour plots of two dimensional distributions from package copula.
Usage
## NB: The 'matrix' and 'data.frame' methods are identical - documenting the former
## S4 method for signature 'matrix'
contourplot2(x, aspect = 1,
xlim = range(x[,1], finite = TRUE),
ylim = range(x[,2], finite = TRUE),
xlab = NULL, ylab = NULL,
cuts = 16, labels = !region, pretty = !labels,
scales = list(alternating = c(1,1), tck = c(1,0)),
region = TRUE, ...,
col.regions = gray(seq(0.4, 1, length.out = max(100, 4*cuts))))
## S4 method for signature 'Copula'
contourplot2(x, FUN, n.grid = 26, delta = 0,
xlim = 0:1, ylim = 0:1,
xlab = quote(u[1]), ylab = quote(u[2]), ...)
## S4 method for signature 'mvdc'
contourplot2(x, FUN, n.grid = 26, xlim, ylim,
xlab = quote(x[1]), ylab = quote(x[2]), ...)
Arguments
x |
a |
aspect |
the aspect ratio. |
xlim , ylim |
the x- and y-axis limits. |
xlab , ylab |
the x- and y-axis labels. If at least one is
|
cuts |
the number of levels; see |
labels , pretty |
|
scales |
a |
region |
a |
col.regions |
the colors of the regions if |
FUN |
|
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 |
delta |
a small number in |
... |
additional arguments passed to the underlying
|
Value
An object of class “trellis” as returned by contourplot()
.
Methods
Contourplot plots for objects of class "matrix"
,
"data.frame"
, "Copula"
or
"mvdc"
.
See Also
The contour-methods
for drawing perspective plots via base graphics.
The lattice-based wireframe2-methods
for functions,
and cloud2-methods
and splom2-methods
for data.
Examples
## For 'matrix' objects
## The Frechet--Hoeffding bounds W and M
n.grid <- 26
u <- seq(0, 1, length.out = n.grid)
grid <- expand.grid("u[1]" = u, "u[2]" = u)
W <- function(u) pmax(0, rowSums(u)-1) # lower bound W
M <- function(u) apply(u, 1, min) # upper bound M
x.W <- cbind(grid, "W(u[1],u[2])" = W(grid)) # evaluate W on 'grid'
x.M <- cbind(grid, "M(u[1],u[2])" = M(grid)) # evaluate M on 'grid'
contourplot2(x.W) # contour plot of W
contourplot2(x.M) # contour plot of M
## For 'Copula' objects
cop <- frankCopula(-4)
contourplot2(cop, pCopula) # the copula
contourplot2(cop, pCopula, xlab = "x", ylab = "y") # adjusting the labels
contourplot2(cop, dCopula) # the density
## For 'mvdc' objects
mvNN <- mvdc(gumbelCopula(3), c("norm", "norm"),
list(list(mean = 0, sd = 1), list(mean = 1)))
xl <- c(-2, 2)
yl <- c(-1, 3)
contourplot2(mvNN, FUN = dMvdc, xlim = xl, ylim = yl, contour = FALSE)
contourplot2(mvNN, FUN = dMvdc, xlim = xl, ylim = yl)
contourplot2(mvNN, FUN = dMvdc, xlim = xl, ylim = yl, region = FALSE, labels = FALSE)
contourplot2(mvNN, FUN = dMvdc, xlim = xl, ylim = yl, region = FALSE)
contourplot2(mvNN, FUN = dMvdc, xlim = xl, ylim = yl,
col.regions = colorRampPalette(c("royalblue3", "maroon3"), space="Lab"))