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 |
xlim , ylim , zlim |
the x-, y- and z-axis limits. |
xlab , ylab , zlab |
the x-, y- and z-axis labels. |
alpha.regions |
see |
scales |
|
par.settings |
See |
FUN |
the |
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 |
draw.4.pCoplines |
logical indicating if the 4 known border
segments of a copula distribution function, i.e., |
... |
additional arguments passed to the underlying |
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))