jitter                 package:base                 R Documentation

_A_d_d '_J_i_t_t_e_r' (_N_o_i_s_e) _t_o _N_u_m_b_e_r_s

_D_e_s_c_r_i_p_t_i_o_n:

     Add a small amount of noise to a numeric vector.

_U_s_a_g_e:

     jitter(x, factor=1, amount = NULL)

_A_r_g_u_m_e_n_t_s:

       x: numeric to which _jitter_ should be added.

  factor: numeric 

  amount: numeric; if positive, used as _amount_ (see below),
          otherwise, if '= 0' the default is 'factor * z/50'.

          Default ('NULL'): 'factor * d/5' where 'd' is about the
          smallest difference between 'x' values.

_D_e_t_a_i_l_s:

     The result, say 'r', is 'r <- x + runif(n, -a, a)' where 'n <-
     length(x)' and 'a' is the 'amount' argument (if specified).

     Let 'z <- max(x) - min(x)' (assuming the usual case). The amount
     'a' to be added is either provided as _positive_ argument 'amount'
     or otherwise computed from 'z', as follows:

     If 'amount == 0', we set 'a <- factor * z/50' (same as S).

     If 'amount' is 'NULL' (_default_), we set 'a <- factor * d/5'
     where _d_ is the smallest difference between adjacent unique
     (apart from fuzz) 'x' values.

_V_a_l_u_e:

     'jitter(x,...)' returns a numeric of the same length as 'x', but
     with an 'amount' of noise added in order to break ties.

_A_u_t_h_o_r(_s):

     Werner Stahel and Martin Maechler, ETH Zurich

_R_e_f_e_r_e_n_c_e_s:

     Chambers, J. M., Cleveland, W. S., Kleiner, B. and Tukey, P.A.
     (1983) _Graphical Methods for Data Analysis._ Wadsworth; figures
     2.8, 4.22, 5.4.

     Chambers, J. M. and Hastie, T. J. (1992) _Statistical Models in
     S._ Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o:

     'rug' which you may want to combine with 'jitter'.

_E_x_a_m_p_l_e_s:

     round(jitter(c(rep(1,3),  rep(1.2, 4), rep(3,3))), 3)
     ## These two 'fail' with S-plus 3.x:
     jitter(rep(0, 7))
     jitter(rep(10000,5))

