bandwidth               package:stats               R Documentation

_B_a_n_d_w_i_d_t_h _S_e_l_e_c_t_o_r_s _f_o_r _K_e_r_n_e_l _D_e_n_s_i_t_y _E_s_t_i_m_a_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Bandwidth selectors for Gaussian kernels in 'density'.

_U_s_a_g_e:

     bw.nrd0(x)

     bw.nrd(x)

     bw.ucv(x, nb = 1000, lower = 0.1 * hmax, upper = hmax, tol = 0.1 * lower)

     bw.bcv(x, nb = 1000, lower = 0.1 * hmax, upper = hmax, tol = 0.1 * lower)

     bw.SJ(x, nb = 1000, lower = 0.1 * hmax, upper = hmax,
           method = c("ste", "dpi"), tol = 0.1 * lower)

_A_r_g_u_m_e_n_t_s:

       x: numeric vector.

      nb: number of bins to use.

lower, upper: range over which to minimize.  The default is almost
          always satisfactory.  'hmax' is calculated internally from a
          normal reference bandwidth.

  method: either '"ste"' ("solve-the-equation") or '"dpi"' ("direct
          plug-in").

     tol: for method '"ste"', the convergence tolerance for 'uniroot'. 
          The default leads to bandwidth estimates with only slightly
          more than one digit accuracy, which is sufficient for
          practical density estimation, but possibly not for
          theoretical simulation studies.

_D_e_t_a_i_l_s:

     'bw.nrd0' implements a rule-of-thumb for choosing the bandwidth of
     a Gaussian kernel density estimator. It defaults to 0.9 times the
     minimum of the standard deviation and the interquartile range
     divided by 1.34 times the sample size to the negative one-fifth
     power (= Silverman's 'rule of thumb', Silverman (1986, page 48,
     eqn (3.31)) _unless_ the quartiles coincide when a positive result
     will be guaranteed.

     'bw.nrd' is the more common variation given by Scott (1992), using
     factor 1.06.

     'bw.ucv' and 'bw.bcv' implement unbiased and biased
     cross-validation respectively.

     'bw.SJ' implements the methods of Sheather & Jones (1991) to
     select the bandwidth using pilot estimation of derivatives.
      The algorithm for method '"ste"' solves an equation (via
     'uniroot') and because of that, enlarges the interval
     'c(lower,upper)' when the boundaries were not user-specified and
     do not bracket the root.

_V_a_l_u_e:

     A bandwidth on a scale suitable for the 'bw' argument of
     'density'.

_R_e_f_e_r_e_n_c_e_s:

     Scott, D. W. (1992) _Multivariate Density Estimation: Theory,
     Practice, and Visualization._ Wiley.

     Sheather, S. J. and Jones, M. C. (1991) A reliable data-based
     bandwidth selection method for kernel density estimation. _Journal
     of the Royal Statistical Society series B_, *53*, 683-690.

     Silverman, B. W. (1986) _Density Estimation_. London: Chapman and
     Hall.

     Venables, W. N. and Ripley, B. D. (2002) _Modern Applied
     Statistics with S_. Springer.

_S_e_e _A_l_s_o:

     'density'.

     'bandwidth.nrd', 'ucv', 'bcv' and 'width.SJ' in package 'MASS',
     which are all scaled to the 'width' argument of 'density' and so
     give answers four times as large.

_E_x_a_m_p_l_e_s:

     require(graphics)

     plot(density(precip, n = 1000))
     rug(precip)
     lines(density(precip, bw="nrd"), col = 2)
     lines(density(precip, bw="ucv"), col = 3)
     lines(density(precip, bw="bcv"), col = 4)
     lines(density(precip, bw="SJ-ste"), col = 5)
     lines(density(precip, bw="SJ-dpi"), col = 6)
     legend(55, 0.035,
            legend = c("nrd0", "nrd", "ucv", "bcv", "SJ-ste", "SJ-dpi"),
            col = 1:6, lty = 1)

