

   SSeelleecctt aa HHiissttooggrraamm BBiinn WWiiddtthh

        dpih(x, scalest="minim", level=2, gridsize=401,
             range.x=range(x), truncate=F)

   AArrgguummeennttss::

          x: vector containing the sample on which the his-
             togram is to be constructed.

    scalest: estimate of scale.

             `"stdev"' - standard deviation is used.

             `"iqr"' - inter-quartile range divided by 1.349 is
             used.

             `"minim"' - minimum of `"stdev"' and `"iqr"' is
             used.

      level: number of levels of functional estimation used in
             the plug-in rule.

   gridsize: number of grid points used in the binned approxi-
             mations to functional estimates.

    range.x: range over which functional estimates are
             obtained.  The default is the minimum and maximum
             data values.

   truncate: if `truncate' is `TRUE' then observations outside
             of the interval specified by `range.x' are omit-
             ted.  Otherwise, they are used to weight the
             extreme grid points.

   DDeessccrriippttiioonn::

        Uses direct plug-in methodology to select the bin width
        of a histogram.

   VVaalluuee::

        the selected bin width.

   DDeettaaiillss::

        The direct plug-in approach, where unknown functionals
        that appear in expressions for the asymptotically opti-
        mal bin width and bandwidths are replaced by kernel
        estimates, is used.  The normal distribution is used to
        provide an initial estimate.

   BBAACCKKGGRROOUUNNDD::

        This method for selecting the bin width of a histogram
        is described in Wand (1995). It is an extension of the
        normal scale rule of Scott (1979) and uses plug-in
        ideas from bandwidth selection for kernel density esti-
        mation (e.g. Sheather and Jones, 1991).

   RReeffeerreenncceess::

        Scott, D. W. (1979).  On optimal and data-based his-
        tograms.  Biometrika, 66, 605-610.

        Sheather, S. J. and Jones, M. C. (1991).  A reliable
        data-based bandwidth selection method for kernel den-
        sity estimation.  Journal of the Royal Statistical
        Society, Series B, 53, 683-690.

        Wand, M. P. (1995).  Data-based choice of histogram
        binwidth.  University of New South Wales, Australian
        Graduate School of Management Working Paper Series No.
        95-011.

   SSeeee AAllssoo::

        `hist'

   EExxaammpplleess::

        data(geyser)
        x <- geyser$duration
        h <- dpih(x)
        bins <- seq(min(x)-0.1,max(x)+0.1+h,by=h)
        hist(x,breaks=bins)

