tkdensity              package:sfsmisc              R Documentation

_G_U_I _D_e_n_s_i_t_y _E_s_t_i_m_a_t_i_o_n _u_s_i_n_g _T_c_l/_T_k

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

     This is graphical user interface (GUI) to 'density', allowing for
     dynamic bandwidth choice and a simple kind of zooming, relying on
     'library(tcltk)'.

_U_s_a_g_e:

     tkdensity(y, n = 1024, log.bw = TRUE, showvalue = TRUE,
               xlim = NULL, do.rug = size < 1000, kernels = NULL,
               from.f = if (log.bw) -2 else 1/1000,
               to.f   = if (log.bw) +2.2 else 2,
               col = 2)

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

       y: numeric; the data the density of which we want.

       n: integer; the number of abscissa values for 'density'
          evaluation (and plotting).

  log.bw: logical; if true (default), the gui scrollbar is on a _log_
          bandwidth scale, otherwise, simple interval.

showvalue: logical; if true, the value of the current (log) bandwidth
          is shown on top of the scrollbar.

    xlim: initial 'xlim' for plotting, see 'plot.default'.

  do.rug: logical indicating if 'rug(y)' should be added to each plot. 
          This is too slow for really large sample sizes.

 kernels: character vector of kernel names as allowable for the
          'kernels' argument of the standard 'density' function.

from.f, to.f: numeric giving the left and right limit of the bandwidth
          scrollbar.

     col: color to be used for the density curve.

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

     'library(tcltk)' must be working, i.e., Tcl/Tk must have been
     installed on your platform, and must have been visible during R's
     configuration and/or installation.

     You can not only choose the bandwidth (the most important
     parameter), but also the kernel, and you can zoom in and out (in
     x-range only).

_V_a_l_u_e:

     none.
      (How could this be done?  'tcltk' widgets run as separate
     processes!)

_A_u_t_h_o_r(_s):

     Martin Maechler, building on 'demo(tkdensity)'.

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

     if (dev.interactive()) { ## does really not make sense otherwise
      data(faithful)
      if(try(require(tcltk)))# still not there on broken installations
        tkdensity(faithful $ eruptions)

      if(try(require(nor1mix)))
        tkdensity(rnorMix(150, MW...), kernels = c("gaussian", "epanechnikov"))
     }

