Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

kde3d

Compute a Three Dimension Kernel Density Estimate


Description

Evaluates a three dimensional kernel density estimate using a Gaussian kernel with diagonal covariance matrix on a regular grid.

Usage

kde3d(x, y, z, h, n = 20, lims = c(range(x), range(y), range(z)))

Arguments

x,y,z

x, y, and z coordinates of the data.

h

vector of three bandwidths for the density estimate; recycled if length is less than three; default is based on the normal reference bandwidth (see bandwidth.nrd).

n

numbers of grid points to use for each dimension; recycled if length is less than three.

lims

lower and upper limits on the region for which the density estimate is to be computed, provides as a vector of length 6, corresponding to low and high values of x, y, and z; recycled if only two values are supplied.

Value

A list of four components, x, y, z, and d. x, y, and z are the coordinates of the grid points at which the density estimate has been evaluated, and d is a three dimensional array of the estimated density values.

References

Based on the function kde2d in package MASS.

See Also

Examples

with(quakes, {
      d <- kde3d(long, lat, -depth, n = 40)
      contour3d(d$d, exp(-12), d$x/22, d$y/28, d$z/640,
                color = "green", color2 = "gray", scale=FALSE,
                engine = "standard")
  })

misc3d

Miscellaneous 3D Plots

v0.9-0
GPL
Authors
Dai Feng and Luke Tierney
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.