dip                 package:diptest                 R Documentation

_C_o_m_p_u_t_e _H_a_r_t_i_g_a_n'_s _D_i_p _T_e_s_t _S_t_a_t_i_s_t_i_c _f_o_r _U_n_i_m_o_d_a_l_i_t_y

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

     Computes Hartigan's dip test statistic for testing unimodality,
     and additionally the modal interval.

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

     dip(x, full.result = FALSE, debug = FALSE)

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

       x: numeric; the data.

full.result: logical; if 'TRUE' returns the full result list, see
          below.

   debug: logical; if true, some tracing information is printed (from
          the C routine).

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

     depending on 'full.result' either a number, the dip statistic, or
     a list with components 

       x: the sorted 'unname()'d data.

       n: 'length(x)'.

     dip: the dip statistic

   lo.hi: indices into 'x' for lower and higher end of modal interval

  xl, xu: lower and upper end of modal interval

gcm, lcm: (last used) indices for *g*reatest *c*onvex *m*inorant and
          the *l*east *c*oncave *m*ajorant.

  mn, mj: index vectors of length 'n' for the GC minorant and the LC
          majorant respectively.

_N_o_t_e:

     For n <= 3 where 'n <- length(x)', the dip statistic is always
     zero, i.e., there's no possible dip test.

     Yong Lu lyongu+@cs.cmu.edu found in Oct 2003 that the code wasn't
     giving symmetric results for mirrored data (and was giving results
     of almost 1, and then found the reason, a misplaced ")" in the
     original Fortran code.  This bug has been corrected for diptest
     version 0.25-0.

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

     Martin Maechler maechler@stat.math.ethz.ch, based on earlier code
     from Dario Ringach dario@wotan.cns.nyu.edu

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

     P. M. Hartigan (1985) Computation of the Dip Statistic to Test for
     Unimodality; _Applied Statistics (JRSS C)_ *34*, 320-325.

     J. A. Hartigan and P. M. Hartigan (1985) The Dip Test of
     Unimodality; _Annals of Statistics_ *13*, 70-84.

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

     'isoreg' for isotonic regression.

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

     data(statfaculty)
     plot(density(statfaculty))
     dip(statfaculty)

     str(dip(statfaculty, full = TRUE, debug = TRUE))

     data(faithful)
     fE <- faithful$eruptions
     plot(density(fE))
     str(dip(fE, full = TRUE, debug = TRUE))

     data(precip)
     plot(density(precip))
     str(dip(precip, full = TRUE, debug = TRUE))

