wireframe2-methods {copula}R Documentation

Perspective Plots - 'wireframe2' in Package 'copula'

Description

Generic function and methods wireframe2() to draw (lattice) wireframe (aka “perspective”) plots of two-dimensional distributions from package copula.

Usage

## S4 method for signature 'matrix'
wireframe2(x,
      xlim = range(x[,1], finite = TRUE),
      ylim = range(x[,2], finite = TRUE),
      zlim = range(x[,3], finite = TRUE),
      xlab = NULL, ylab = NULL, zlab = NULL,
      alpha.regions = 0.5, scales = list(arrows = FALSE, col = "black"),
      par.settings = standard.theme(color = FALSE),
      draw.4.pCoplines = FALSE, ...)

## _identical_ method for  'data.frame'  as for  'matrix'

## S4 method for signature 'Copula'
wireframe2(x, FUN, n.grid = 26, delta = 0,
      xlim = 0:1, ylim = 0:1, zlim = NULL,
      xlab = quote(u[1]), ylab = quote(u[2]),
      zlab = list(deparse(substitute(FUN))[1], rot = 90),
      draw.4.pCoplines = identical(FUN, pCopula), ...)

## S4 method for signature 'mvdc'
wireframe2(x, FUN, n.grid = 26, xlim, ylim, zlim = NULL,
      xlab = quote(x[1]), ylab = quote(x[2]),
      zlab = list(deparse(substitute(FUN))[1], rot = 90), ...)

Arguments

x

a "matrix", "data.frame", "Copula" or a "mvdc" object.

xlim, ylim, zlim

the x-, y- and z-axis limits.

xlab, ylab, zlab

the x-, y- and z-axis labels.

alpha.regions

see wireframe().

scales

a list determining how the axes are drawn; see wireframe().

par.settings

See wireframe().

FUN

the function to be plotted; for a "copula", typically dCopula or pCopula; for an "mvdc", rather dMvdc, etc. In general of the form function(x, copula).

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, \frac 1 2) influencing the evaluation boundaries. The x- and y- vectors will have the range [0+delta, 1-delta], the default being [0,1].

draw.4.pCoplines

logical indicating if the 4 known border segments of a copula distribution function, i.e., pCopula, should be drawn. If true, the line segments are drawn with col.4 = "#668b5580", lwd.4 = 5, and lty.4 = "82" which you can modify (via the ... below). Applies only when you do not set panel.3d.wireframe (via the ...).

...

additional arguments passed to the underlying wireframe(), such as shade, drape, aspect, etc., or (if you do not specify panel.3d.wireframe differently), to the function panel.3dwire from the lattice package.

Value

An object of class “trellis” as returned by wireframe().

Methods

Wireframe plots for objects of class "matrix" , "data.frame", "Copula" or "mvdc".

See Also

The persp-methods for drawing perspective plots via base graphics.

The lattice-based contourplot2-methods.

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'
wireframe2(x.W)
wireframe2(x.W, shade = TRUE) # plot of W
wireframe2(x.M, drape = TRUE) # plot of M

## For 'Copula' objects
cop <- frankCopula(-4)
wireframe2(cop, pCopula) # the copula
wireframe2(cop, pCopula, shade = TRUE) # ditto, "shaded"
wireframe2(cop, pCopula, shade = TRUE, col = "gray60") # ditto, "shaded"+grid
wireframe2(cop, pCopula, drape = TRUE, xlab = quote(x[1])) # adjusting an axis label
wireframe2(cop, dCopula, delta=0.01) # the density
wireframe2(cop, dCopula) # => the density is set to 0 on the margins
wireframe2(cop, function(u, copula) dCopula(u, copula, log=TRUE),
           zlab = list(quote(log(c(u[1],u[2]))), rot=90), main = "dCopula(.., log=TRUE)")


## For 'mvdc' objects
mvNN <- mvdc(gumbelCopula(3), c("norm", "norm"),
             list(list(mean = 0, sd = 1), list(mean = 1)))
wireframe2(mvNN, dMvdc, xlim=c(-2, 2), ylim=c(-1, 3))

[Package copula version 1.1-3 Index]