

bkde2D(KernSmooth)                           R Documentation

_C_o_m_p_u_t_e _a _2_D _B_i_n_n_e_d _K_e_r_n_e_l _D_e_n_s_i_t_y _E_s_t_i_m_a_t_e

_D_e_s_c_r_i_p_t_i_o_n_:

     Returns the set of grid points in each coordinate
     direction, and the matrix of density estimates over the
     mesh induced by the grid points. The kernel is the
     standard bivariate normal density.

_U_s_a_g_e_:

     bkde2D(x, bandwidth, gridsize=c(51, 51), range.x=<<see below>>,
            truncate=T)

_A_r_g_u_m_e_n_t_s_:

       x: a two-column matrix containing the observations
          from the distribution whose density is to be esti-
          mated.  Missing values are not allowed.

bandwidth: vector containing the bandwidth to be used in
          each coordinate direction.

gridsize: vector containing the number of equally spaced
          points in each direction over which the density is
          to be estimated.

 range.x: a list containing two vectors, where each vector
          contains the minimum and maximum values of `x' at
          which to compute the estimate for each direction.
          The default minimum in each direction is minimum
          data value minus 1.5 times the bandwidth for that
          direction. The default maximum is the maximum data
          value plus 1.5 times the bandwidth for that direc-
          tion

truncate: logical flag: if TRUE, data with `x' values out-
          side the range specified by `range.x' are ignored.

_V_a_l_u_e_:

     a list containing the following components:

      x1: vector of values of the grid points in the first
          coordinate direction at which the estimate was
          computed.

      x2: vector of values of the grid points in the second
          coordinate direction at which the estimate was
          computed.

    fhat: matrix of density estimates over the mesh induced
          by `x1' and `x2'.

_D_e_t_a_i_l_s_:

     This is the binned approximation to the 2D kernel den-
     sity estimate.  Linear binning is used to obtain the
     bin counts and the Fast Fourier Transform is used to
     perform the discrete convolutions.  For each `x1',`x2'
     pair the bivariate Gaussian kernel is centered on that
     location and the heights of the kernel, scaled by the
     bandwidths, at each datapoint are summed.  This sum,
     after a normalization, is the corresponding `fhat'
     value in the output.

_R_e_f_e_r_e_n_c_e_s_:

     Wand, M. P. (1994).  Fast Computation of Multivariate
     Kernel Estimators.  Journal of Computational and Graph-
     ical Statistics, 3, 433-445.

     Wand, M. P. and Jones, M. C. (1995).  Kernel Smoothing.
     Chapman and Hall, London.

_S_e_e _A_l_s_o_:

     `bkde', `density', `hist', `ksmooth'.

_E_x_a_m_p_l_e_s_:

     data(geyser)
     x <- cbind(geyser$duration,geyser$waiting)
     est <- bkde2D(x,bandwidth=c(0.7,7))
     contour(est$x1,est$x2,est$fhat)
     # persp(est$fhat) ## not yet in R

