geometricmean          package:compositions          R Documentation

_T_h_e _g_e_o_m_e_t_r_i_c _m_e_a_n

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

     Computes the geometric mean.

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

               geometricmean(x,...)
               geometricmean.row(x,...)
               geometricmean.col(x,...)
               gsi.geometricmean(x,...)
               gsi.geometricmean.row(x,...)
               gsi.geometricmean.col(x,...)
               

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

       x: a numeric vector or matrix of data 

     ...: further arguments to compute the mean 

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

     The geometric mean is defined as:

             geometricmean(x) := 'prod(x)^(1/length(x))'

     The geometric mean is actually computed by
     'exp(mean(log(c(unclass(x))),...))'.

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

     The geometric means of x as a whole (geometricmean), its rows
     (geometricmean.row) or its columns (geometricmean.col).

_M_i_s_s_i_n_g _P_o_l_i_c_y:

     The the first three functions take the geometric mean of all
     non-missing values.  This is because they should yield a result in
     term of data analysis. 

     Contrarily, the gsi.* functions inherit the arithmetic IEEE policy
     of R through 'exp(mean(log(c(unclass(x))),...))'. Thus,  NA codes
     a not available i.e.  not measured, NaN codes a below detection
     limit, and 0.0 codes a structural zero. If any of the elements
     involved is 0, NA or NaN the result is of the same type. Here 0
     takes precedence over NA, and NA takes precedence over NaN. For
     example, if a structural 0 appears, the geometric mean is 0
     regardless of the presence of NaN's or NA's in the rest. Values
     below detection  limit become NaN's if they are coded as negative
     values.

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

     K.Gerald v.d. Boogaart <URL: http://www.stat.boogaart.de>

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

     'mean.rplus'

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

     geometricmean(1:10)  
     geometricmean(c(1,0,NA,NaN))  # 0
     X <- matrix(c(1,NA,NaN,0,1,2,3,4),nrow=4)
     X  
     geometricmean.row(X)
     geometricmean.col(X)

