ecdf2d: Bivariate empirical cumulative density function plot

Description Usage Arguments Value Examples

View source: R/density2D.R

Description

Calculates the joint empirical cumulative probability density function of two variables and then plots them using persp.

Usage

1
2
3
4
5
6
7
ecdf2d(x, y, xlim = range(x), ylim = range(y), zlim = range(z, na.rm
  = TRUE), xlab = " x", ylab = "y", zlab = "Joint CDF",
  main = NULL, sub = NULL, theta = -20, phi = 15, r = exp(1),
  d = 25, scale = TRUE, expand = 1, col = NULL,
  viridis.opt = "D", border = NA, ltheta = -135, lphi = 0,
  shade = NA, box = TRUE, axes = TRUE, nticks = 4,
  ticktype = "detailed", plot = TRUE, plotly = FALSE)

Arguments

x

the data from which the estimate is to be computed. For the default method a numeric vector: long vectors are not supported.

y

the data from which the estimate is to be computed. For the default method a numeric vector: long vectors are not supported.

xlim

x-, y- and z-limits. These should be chosen to cover the range of values of the surface

ylim

x-, y- and z-limits. These should be chosen to cover the range of values of the surface

zlim

x-, y- and z-limits. These should be chosen to cover the range of values of the surface

xlab

titles for the axes. N.B. These must be character strings; expressions are not accepted. Numbers will be coerced to character strings.

ylab

titles for the axes. N.B. These must be character strings; expressions are not accepted. Numbers will be coerced to character strings.

zlab

titles for the axes. N.B. These must be character strings; expressions are not accepted. Numbers will be coerced to character strings.

main

main and sub title, as for title.

sub

main and sub title, as for title.

theta

angles defining the viewing direction. theta gives the azimuthal direction and phi the colatitude.

phi

angles defining the viewing direction. theta gives the azimuthal direction and phi the colatitude.

r

the distance of the eyepoint from the centre of the plotting box.

d

a value which can be used to vary the strength of the perspective transformation. Values of d greater than 1 will lessen the perspective effect and values less and 1 will exaggerate it.

scale

before viewing the x, y and z coordinates of the points defining the surface are transformed to the interval [0,1]. If scale is TRUE the x, y and z coordinates are transformed separately. If scale is FALSE the coordinates are scaled so that aspect ratios are retained. This is useful for rendering things like DEM information.

expand

a expansion factor applied to the z coordinates. Often used with 0 < expand < 1 to shrink the plotting box in the z direction.

col

the color(s) of the surface facets. Transparent colours are ignored. This is recycled to the (nx-1)(ny-1) facets.

viridis.opt

A character string indicating the viridis palette variant to use. Four options are available: "magma" (or "A"), "inferno" (or "B"), "plasma" (or "C"), "viridis" (or "D", the default option) and "cividis" (or "E").

border

the color of the line drawn around the surface facets. The default of NA will disable the drawing of borders: this is sometimes useful when the surface is shaded. NULL corresponds to par("fg").

ltheta

if finite values are specified for ltheta and lphi, the surface is shaded as though it was being illuminated from the direction specified by azimuth ltheta and colatitude lphi.

lphi

if finite values are specified for ltheta and lphi, the surface is shaded as though it was being illuminated from the direction specified by azimuth ltheta and colatitude lphi.

shade

the shade at a surface facet is computed as ((1+d)/2)^shade, where d is the dot product of a unit vector normal to the facet and a unit vector in the direction of a light source. Values of shade close to one yield shading similar to a point light source model and values close to zero produce no shading. Values in the range 0.5 to 0.75 provide an approximation to daylight illumination.

box

should the bounding box for the surface be displayed. The default is TRUE.

axes

should ticks and labels be added to the box. The default is TRUE. If box is FALSE then no ticks or labels are drawn.

nticks

character: "simple" draws just an arrow parallel to the axis to indicate direction of increase; "detailed" draws normal ticks as per 2D plots.

ticktype

the (approximate) number of tick marks to draw on the axes. Has no effect if ticktype is "simple".

plot

defaults to TRUE. Otherwise, returns a list of x, y, and z.

plotly

whether or not to use plotly for the plotting. If TRUE, most of the arguments except col, xlab, ylab, and zlab are ignored.

Value

either a list or a plot

Examples

1
ecdf2d(wines$Alcohol, wines$Malic.acid)

abnormally-distributed/Bayezilla documentation built on Oct. 31, 2019, 1:57 a.m.