gcmlcm                package:fdrtool                R Documentation

_G_r_e_a_t_e_s_t _C_o_n_v_e_x _M_i_n_o_r_a_n_t _a_n_d _L_e_a_s_t _C_o_n_c_a_v_e _M_a_j_o_r_a_n_t

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

     'gcmlcm' computes the greatest convex minorant (GCM) or the least
     concave majorant (LCM) of a piece-wise linear function.

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

     gcmlcm(x, y, type=c("gcm", "lcm"))

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

    x, y: coordinate vectors of the piece-wise linear function. Note
          that the x values need to be unique and be arranged in sorted
          order.

    type: specifies whether to compute the greatest convex  minorant
          ('type="gcm"', the default) or the least concave majorant
          ('type="lcm"').

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

     The GCM is obtained by isotonic regression of the raw slopes,
     whereas the LCM is obtained by antitonic regression. See Robertson
     et al. (1988).

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

     A list with the following entries:

 x.knots: the x values belonging to the knots of the LCM/GCM curve

 y.knots: the corresponding y values

slope.knots: the slopes of the corresponding line segments

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

     Korbinian Strimmer (<URL: http://strimmerlab.org>).

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

     Robertson, T., F. T. Wright, and R. L. Dykstra. 1988.  Order
     restricted statistical inference. John Wiley and Sons.

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

     'monoreg'.

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

     # load "fdrtool" library
     library("fdrtool")

     # generate some data
     x = 1:20
     y = rexp(20)
     plot(x, y, type="l", lty=3, main="GCM (red) and LCM (blue)")
     points(x, y)

     # greatest convex minorant (red)
     gg = gcmlcm(x,y)
     lines(gg$x.knots, gg$y.knots, col=2, lwd=2)

     # least concave majorant (blue)
     ll = gcmlcm(x,y, type="lcm")
     lines(ll$x.knots, ll$y.knots, col=4, lwd=2)

