grenader               package:fdrtool               R Documentation

_G_r_e_n_a_n_d_e_r _E_s_t_i_m_a_t_o_r _o_f _a _D_e_c_r_e_a_s_i_n_g _o_r _I_n_c_r_e_a_s_i_n_g _D_e_n_s_i_t_y

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

     The function 'grenander' computes the Grenander estimator of a
     one-dimensional decreasing or increasing density.

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

     grenander(F, type=c("decreasing", "increasing"))

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

       F: an 'ecdf' containing the empirical cumulative density.

    type: specifies whether the distribution is decreasing (the
          default) or increasing.

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

     The Grenander (1956) density estimator is given by the slopes of
     the  least concave majorant (LCM) of the empirical distribution
     function (ECDF). It is a decreasing piecewise-constant function
     and can be shown to be the  non-parametric maximum likelihood
     estimate (NPMLE) under the assumption of a decreasing density
     (note that the ECDF is the NPMLE without this assumption). 
     Similarly, an increasing density function is obtained by using the
     greatest convex minorant (GCM) of the ECDF.

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

     A list of class 'grenander' with the following components:

       F: the empirical distribution function specified as input.   

 x.knots: x locations of the knots of the least concave majorant of the
          ECDF.

 F.knots: the corresponding y locations of the least concave majorant
          of the ECDF.

 f.knots: the corresponding slopes (=density).

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

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

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

     Grenander, U. (1956). On the theory of mortality measurement, Part
     II.   _Skan. Aktuarietidskr_, *39*, 125-153.

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

     'ecdf', 'gcmlcm', 'density'.

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

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

     # samples from random exponential variable 
     z = rexp(30,1)
     e = ecdf(z)
     g = grenander(e)
     g

     # plot ecdf, concave cdf, and Grenander density estimator (on log scale)
     plot(g, log="y") 

     # for comparison the kernel density estimate
     plot(density(z)) 

     # area under the Grenander density estimator 
     sum( g$f.knots[-length(g$f.knots)]*diff(g$x.knots) )

