plotDensity3d.fnc: Kernel density estimation for two continuous variables.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/plotDensity3d.fnc.R

Description

The densities of two continuous variables is first computed using the density function from package stats. The outer product of the two densities is computed, which can be plotted as a contour map or a perspective plot.

Usage

1
2
3
4
5
6
plotDensity3d.fnc(x, y, plot.type = "contour", color = "terrain", 
xlab = NULL, ylab = NULL, zlab = NULL, main = NULL, cex = 1, 
lit = TRUE, theta = 0, phi = 0, bw = "nrd0", adjust = 1, kernel = c("gaussian", 
"epanechnikov", "rectangular", "triangular", "biweight", "cosine", 
"optcosine"), weights = NULL, window = kernel, width, give.Rkern = FALSE, 
n = 50, from, to, cut = 3, na.rm = FALSE, ...)

Arguments

x, y

Numeric vectors.

plot.type

The type of plot to make. Can be any of "contour" (default) or "persp".

color

The colour scheme to use for plots. One of “topo”, “heat”, “cm”, “terrain”, “gray” or “bw”. Schemes “gray” and “bw” also modify the colors used.

xlab, ylab, zlab

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

main

The main title on top of the plot.

cex

The size of label and main text.

lit

Logical, specifying if lighting calculation should take place on geometry.

theta

Angle defining the viewing direction. theta gives the azimuthal direction. Used only if plot.type = "persp".

phi

Angle defining the viewing direction. phi gives the colatitude. Used only if plot.type = "persp".

bw, adjust, kernel, weights, window, width, give.Rkern, n, from, to, cut, na.rm

See help page to function density.

...

Further arguments passed to functions image, contour or persp.

Details

See help page to the density function.

Value

Either a contour map or a perspective plot. Invisibly returns

x

The numeric vector supplied in argument x.

y

The numeric vector supplied in argument y.

xd

The density object tied to vector x.

yd

The density object tied to vector y.

mat

The outer product of the x and y densities in matrix format.

col

The color used for plotting.

Author(s)

Antoine Tremblay, Statistics Canada, trea26@gmail.com.

See Also

contour; persp; density; outer

Examples

1
# see example in LMERConvenienceFunctions help page.

Example output

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 

LMERConvenienceFunctions documentation built on Oct. 23, 2020, 5:12 p.m.