akde2d: Two-Dimensional Kernel Density Estimation (Astro)

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

View source: R/akde2d.R

Description

Two-dimensional kernel density estimation with an axis-aligned bivariate normal kernel, evaluated on a square grid. The function 'akde2d' (astro:kde2d) is a wrapper around the 'kde2d' function within the 'MASS' package. This function adds additional output to that function.

Usage

1
2
akde2d(x, y, n = 25, lims = c(range(x), range(y)), levels = seq(0,0.9,by=0.1), 
       ...)

Arguments

x

x coordinate of data

y

y coordinate of data

n

number of grid points in each direction. Can be scalar or a length-2 integer vector

lims

the limits of the rectangle covered by the grid as 'c(xl, xu, yl, yu)'

levels

output levels containing the given percentiles of the data

...

arguments to be passed to 'kde2d' in the 'MASS' package

Details

Characters in the string will be stripped 'outside in', from left-to-right in the order they are given in the argument. See examples below for more detail.

Value

A list of four components.

x,y

the x and y coordinates of the grid points, vectors of length 'n'

z

an 'n[1]' by 'n[2]' matrix of the estimated density: rows correspond to the value of 'x', columns to the value of 'y'

l

percentile levels containing given fractions of the data

Author(s)

Lee Kelvin <lee.kelvin@uibk.ac.at>

References

Venables, W. N. and Ripley, B. D. (2002) _Modern Applied Statistics with S._ Fourth edition. Springer.

See Also

The astronomy package: astro.

Examples

1
# See 'kde2d' for further examples.

Example output

Loading required package: MASS
Loading required package: plotrix

astro documentation built on May 2, 2019, 2:14 a.m.

Related to akde2d in astro...