mc                package:robustbase                R Documentation

_M_e_d_c_o_u_p_l_e, _a _R_o_b_u_s_t _M_e_a_s_u_r_e _o_f _S_k_e_w_n_e_s_s

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

     Compute the 'medcouple', a _robust_ concept and estimator of
     skewness.  The medcouple is defined as a scaled median difference
     of the left and right half of distribution, and hence _not_ based
     on the third moment as the classical skewness.

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

     mc(x, ...)
     ## Default S3 method:
     mc(x, na.rm = FALSE, doReflect = (length(x) <= 100),
          eps1 = .Machine$double.xmin, eps2 = eps1, maxit = 100, trace.lev = 0,
          full.result = FALSE, ...)

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

       x: a numeric vector

   na.rm: logical indicating how missing values ('NA's) should be dealt
          with.

doReflect: logical indicating if the internal MC should also be
          computed on the _reflected_ sample '-x', with final result
          '(mc.(x) - mc.(-x))/2'.  This makes sense since the internal
          MC, 'mc.()' computes the himedian() which can differ slightly
          from the median.

eps1,eps2: tolerance in the algorithm; only change with care!

   maxit: maximul number of iterations; typically a few should be
          sufficient.

trace.lev: integer specifying how much diagnostic output the algorithm
          (in C) should produce.  No output by default, most output for
          'trace_lev = 3'.

full.result: logical indicating if the full return values (from C)
          should be return, as a list 'attr(*, "mcComp")'.

     ...: potentially further arguments passed to other methods.

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

     a number between -1 and 1, which is the medcouple, MC(x). For 'r
     <- mc(x, full.result = TRUE, ....)', then 'attr(r, "mcComp")' is a
     list with components 

    medc: the medcouple  mc.(x).

   medc2: the medcouple mc.(-x) if 'doReflect=TRUE'.

eps,eps2: tolerances used.

iter,iter2: number of iterations used.

converged,converged2: logical specifying "convergence".

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

     Guy Brys; modifications by Tobias Verbeke and bug fixes and
     extensions by Martin Maechler.

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

     Guy Brys, Mia Hubert and Anja Struyf (2004) A Robust Measure of
     Skewness; _JCGS_ *13* (4), 996-1017.

     Mia Hubert and E. Vandervieren (2006) An adjusted boxplot for
     skewed distributions.

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

     'Qn' for a robust measure of scale (aka "dispersion"), ....

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

     mc(1:5) # 0 for a symmetric sample

     x1 <- c(1, 2, 7, 9, 10)
     mc(x1) # = -1/3

     data(cushny)
     mc(cushny) # 0.125

     stopifnot(mc(c(-20, -5, -2:2, 5, 20)) == 0,
               mc(x1, doReflect=FALSE) ==  -mc(-x1, doReflect=FALSE),
               all.equal(mc(x1, doReflect=FALSE), -1/3, tol = 1e-12))

