Rev 5391 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{bkde2D}\alias{bkde2D}\title{Compute a 2D Binned Kernel Density Estimate}\description{Returns the set of grid points in each coordinate direction,and the matrix of density estimates over the mesh induced bythe grid points. The kernel is the standard bivariate normaldensity.}\usage{bkde2D(x, bandwidth, gridsize = c(51L, 51L), range.x, truncate = TRUE)}\arguments{\item{x}{a two-column numeric matrix containing the observations from thedistribution whose density is to be estimated.Missing values are not allowed.}\item{bandwidth}{numeric vector oflength 2, containing the bandwidth to be used in each coordinatedirection.}\item{gridsize}{vector containing the number of equally spaced points in each directionover which the density is to be estimated.}\item{range.x}{a list containing two vectors, where each vectorcontains the minimum and maximum values of \code{x}at which to compute the estimate for each direction.The default minimum in each direction is minimumdata value minus 1.5 times the bandwidth forthat direction. The default maximum is the maximumdata value plus 1.5 times the bandwidth forthat direction}\item{truncate}{logical flag: if TRUE, data with \code{x} values outside therange specified by \code{range.x} are ignored.}}\value{a list containing the following components:\item{x1}{vector of values of the grid points in the first coordinatedirection at which the estimate was computed.}\item{x2}{vector of values of the grid points in the second coordinatedirection at which the estimate was computed.}\item{fhat}{matrix of density estimatesover the mesh induced by \code{x1} and \code{x2}.}}\section{Details}{This is the binned approximation to the 2D kernel density estimate.Linear binning is used to obtain the bin counts and theFast Fourier Transform is used to perform the discrete convolutions.For each \code{x1},\code{x2} pair the bivariate Gaussian kernel iscentered on that location and the heights of thekernel, scaled by the bandwidths, at each datapoint are summed.This sum, after a normalization, is the corresponding\code{fhat} value in the output.}\references{Wand, M. P. (1994).Fast Computation of Multivariate Kernel Estimators.\emph{Journal of Computational and Graphical Statistics,}\bold{3}, 433-445.Wand, M. P. and Jones, M. C. (1995).\emph{Kernel Smoothing.}Chapman and Hall, London.}\seealso{\code{\link{bkde}}, \code{\link{density}}, \code{\link{hist}}.}\examples{data(geyser, package="MASS")x <- cbind(geyser$duration, geyser$waiting)est <- bkde2D(x, bandwidth=c(0.7, 7))contour(est$x1, est$x2, est$fhat)persp(est$fhat)}\keyword{distribution}\keyword{smooth}% Converted by Sd2Rd version 0.2-a5.