zeroreplace           package:compositions           R Documentation

_Z_e_r_o-_r_e_p_l_a_c_e_m_e_n_t _r_o_u_t_i_n_e

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

     A function to automatically replace rounded zeroes/BDLs in a
     composition.

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

               zeroreplace(x,d=NULL,a=2/3)
               

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

       x: composition or dataset of compositions

       d: vector containing the detection limits of each part

       a: fraction of the detection limit to be used in replacement

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

     If 'd' is given, zeroes from each column of 'x' are replaced by
     the  corresponding detection limit contained there, scaled down by
     the value of 'a' (usually a scalar, although if  it is a vector it
     will be recycled with a warning). The variable 'd' should be a
     vector of length equal to 'ncol(x)'  or a matrix of the same shape
     as 'x'. 
      If 'd=NULL', then the detection limit is extracted from the data
     set, if it is available there (i.e., if there are negative
     numbers). If no negative number is present in the data set, and no
     value is given for 'd', the result will be equal to 'x'. See
     'compositions.missings' for more  details on the missing policy.

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

     an object of the same class as 'x', where all WZERO values have
     been replaced.  Output contains a further attribute (named
     'Losts'),  with a logical array of the same dimensions as 'x', 
     showing which elements were replaced (TRUE) and which were  kept
     unchanged (FALSE).

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

     Aitchison, J. (1986) _The Statistical Analysis of Compositional
     Data_ Monographs on Statistics and Applied Probability. Chapman &
     Hall Ltd., London (UK). 416p.

     Martn-Fern\'andez, J.A.; Barcel\'o-Vidal, C. and Pawlowsky-Glahn,
     V. (2003) Dealing With Zeros and Missing Values in Compositional
     Data Sets Using Nonparametric Imputation. _Mathematical Geology_,
     35 , 253-278

     <URL: http://ima.udg.es/Activitats/CoDaWork03>

     <URL: http://ima.udg.es/Activitats/CoDaWork05>

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

     'compositions.missings','getDetectionlimit'

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

     data(SimulatedAmounts)
     x <- acomp(sa.lognormals)
     xnew <- simulateMissings(x,detectionlimit=0.05,knownlimit=FALSE)
     xnew
     xrep <- zeroreplace(xnew,0.05)
     xnew

