weighted.median            package:limma            R Documentation

_W_e_i_g_h_t_e_d _M_e_d_i_a_n

_D_e_s_c_r_i_p_t_i_o_n:

     Compute a weighted median of a numeric vector.

_U_s_a_g_e:

     weighted.median(x, w, na.rm = FALSE)

_A_r_g_u_m_e_n_t_s:

       x: a numeric vector containing the values whose mean is to be
          computed.

       w: a vector of weights the same length as 'x' giving the weights
          to use for each element of 'x'.

   na.rm: a logical value indicating whether 'NA' values in 'x' should
          be stripped before the computation proceeds.

_D_e_t_a_i_l_s:

     If 'w' is missing then all elements of 'x' are given the same
     weight.

     Missing values in 'w' are not handled.

     The weighted median is the median of the discrete distribution
     with values given by 'x' and probabilities given by 'w/sum(w)'.

_V_a_l_u_e:

     numeric value giving the weighted median

_S_e_e _A_l_s_o:

     'median', 'weighted.mean'

_E_x_a_m_p_l_e_s:

     ## GPA from Siegel 1994
     wt <- c(5,  5,  4,  1)/15
     x <- c(3.7,3.3,3.5,2.8)
     xm <- weighted.median(x,wt)

