stdize           package:ffmanova           R Documentation(latin1)

_C_e_n_t_e_r_i_n_g _a_n_d _s_c_a_l_i_n_g _o_f _m_a_t_r_i_c_e_s

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

     Function to center and/or scale the coloumns of a matrix in
     various ways.  The coloumns can be centered with their means or
     with supplied values, and they can be scaled with their standard
     deviations or with supplied values.

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

     stdize(x, center = TRUE, scale = TRUE, avoid.zero.divisor = FALSE)

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

       x: A matrix.

  center: A logical, or a numeric vector.  The values to subtract from
          each column. If 'center' is 'TRUE', the mean values are used.

   scale: A lgical, or a numeric vector.  The values to divide each
          column with.  If 'scale' is 'TRUE', the standard deviations
          are used.

avoid.zero.divisor: A logical.  If 'TRUE', each occurence of 0 in
          'scale' is replaced with a 1.

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

     'stdize' standardizes the coloumns of a matrix by subtracting
     their means (or the supplied values) and dividing by their
     standard deviations (or the supplied values).

     If 'avoid.zero.divisor' is 'TRUE', division-by-zero is guarded
     against by substituting any 0 in 'center' (either calculated or
     supplied) with 1 prior to division.

     The main difference between 'stdize' and 'scale' is that 'stdize'
     divides by the standard deviations even when 'center' is not
     'TRUE'.

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

     A matrix.

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

     Bjrn-Helge Mevik and yvind Langsrud

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

     'scale'

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

     A <- matrix(rnorm(15, mean = 1), ncol = 3)
     stopifnot(all.equal(stdize(A), scale(A), check.attributes = FALSE))

     ## These are different:
     stdize(A, center = FALSE)
     scale(A, center = FALSE)

