Description Usage Arguments Details Value Author(s) References See Also Examples
Draws a perspective plot of the surface of a depth function over the x-y plane.
1 2 |
x |
Bivariate data as a matrix, data frame or list. If it is a matrix or data frame, then each row is viewed as one bivariate observation. If it is a list, both components must be numerical vectors of equal length (coordinates of observations). |
method |
Character string which determines the depth function used. |
output |
Logical. Default FALSE produces a perspective plot; otherwise, returns a list containing the grid points and depth values over these points. |
tt |
Gridsize. Number of equally spaced grid points in each coordinate direction to be used in perspective plot. |
xlab |
Title for x-axis. Must be a character string. |
ylab |
Title for y-axis. Must be a character string. |
zlab |
Title for z-axis. Must be a character string. Default NULL identifies the depth function. |
col |
Color of the surface plot. Default NULL is "lightblue". |
... |
Any additional graphical parameters. |
Requires the rgl
package. The perspective plot takes advantage of some of the user interaction facilities of that package.
Default output = FALSE
yields a perspective plot; otherwise the function returns a list with components
x |
x-coordinates of the grid where the depth function is evaluated. |
y |
y-coordinates of the grid where the depth function is evaluated. |
z |
Matrix whose entry z[i ,j] is the value of the depth function at (x[i], y[j]). |
Jean-Claude Masse and Jean-Francois Plante, based on Fortran code by Rousseeuw, Ruts and Struyf from University of Antwerp.
Rousseuw, P.J. and Ruts, I. (1996), AS 307 : Bivariate location depth, Appl. Stat.-J. Roy. S. C, 45, 516–526.
1 2 3 4 5 6 7 8 9 10 11 12 | ## 2 perspective plots
data(geyser, package = "MASS")
perspdepth(geyser, col = "magenta")
set.seed(159); library(MASS)
mu1 <- c(0,0); mu2 <- c(6,0); sigma <- matrix(c(1,0,0,1), nc = 2)
mixbivnorm <- rbind(mvrnorm(80, mu1, sigma),mvrnorm(20, mu2, sigma))
perspdepth(mixbivnorm, col = "chartreuse")
## grid coordinates and corresponding depth values
set.seed(601)
x <- matrix(rnorm(48), nc = 2)
perspdepth(x, output = TRUE, tt = 10)
|
Loading required package: abind
Loading required package: circular
Attaching package: ‘circular’
The following objects are masked from ‘package:stats’:
sd, var
Loading required package: rgl
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl.init' failed, running with 'rgl.useNULL = TRUE'.
$x
[1] -1.74447201 -1.38629214 -1.02811228 -0.66993241 -0.31175254 0.04642733
[7] 0.40460720 0.76278707 1.12096694 1.47914681 1.83732667
$y
[1] -2.0136489 -1.5720292 -1.1304095 -0.6887897 -0.2471700 0.1944497
[7] 0.6360695 1.0776892 1.5193090 1.9609287 2.4025484
$z
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
[2,] 0 0.00000000 0.04166667 0.04166667 0.04166667 0.04166667 0.04166667
[3,] 0 0.00000000 0.04166667 0.08333334 0.12500000 0.12500000 0.12500000
[4,] 0 0.04166667 0.08333334 0.20833333 0.25000000 0.20833333 0.16666667
[5,] 0 0.04166667 0.12500000 0.29166666 0.33333334 0.33333334 0.25000000
[6,] 0 0.04166667 0.12500000 0.20833333 0.33333334 0.33333334 0.20833333
[7,] 0 0.00000000 0.04166667 0.08333334 0.16666667 0.16666667 0.12500000
[8,] 0 0.00000000 0.00000000 0.04166667 0.04166667 0.04166667 0.04166667
[9,] 0 0.00000000 0.00000000 0.00000000 0.04166667 0.04166667 0.04166667
[10,] 0 0.00000000 0.00000000 0.00000000 0.00000000 0.04166667 0.04166667
[11,] 0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
[,8] [,9] [,10] [,11]
[1,] 0.00000000 0.00000000 0.00000000 0
[2,] 0.00000000 0.00000000 0.00000000 0
[3,] 0.04166667 0.00000000 0.00000000 0
[4,] 0.08333334 0.04166667 0.00000000 0
[5,] 0.12500000 0.08333334 0.04166667 0
[6,] 0.12500000 0.08333334 0.04166667 0
[7,] 0.12500000 0.04166667 0.04166667 0
[8,] 0.04166667 0.04166667 0.04166667 0
[9,] 0.04166667 0.04166667 0.00000000 0
[10,] 0.00000000 0.00000000 0.00000000 0
[11,] 0.00000000 0.00000000 0.00000000 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.