rowFtests             package:arrayMagic             R Documentation

_F-_t_e_s_t _a_n_d _t-_t_e_s_t _f_o_r _r_o_w_s _o_f _a _m_a_t_r_i_x

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

     F-test and t-test for rows of a matrix

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

     rowFtests(x, fac,var.equal = TRUE)
     rowttests(x, fac)

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

       x: Matrix

     fac: Factor, with 'length(fac)=ncol(x)'. For 'rowttests', 'fac'
          must have exactly two levels.

var.equal: a logical variable indicating whether to treat the variances
          in the samples as equal.  If 'TRUE', a simple F test for the
          equality of means in a one-way analysis of variance is
          preformed.  If 'FALSE', an approximate method of Welch (1951)
          is used, which generalizes the commonly known 2-sample Welch
          test to the case of arbitrarily many samples.

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

     If 'fac' is specified, 'rowttests' performs for each row of 'x' a
     two-sided, two-class t-test with equal variances. 'fac' must be a
     factor of length 'ncol(x)' with two levels, corresponding to the
     two groups.

     If 'fac' is missing, 'rowttests' performs for each row of 'x' a
     two-sided one-class t-test against the null hypothesis 'mean=0'.

     With the current implementation, 'NA's are not allowed. This could
     be changed if desirable.

     If 'var.equal' is 'FALSE' 'nrow(x)' +1 degree of freedoms are
     given, the first one is the first degree of freedom (it is the
     same for each row) and the other ones are the second degree of
     freedom (one for each row).

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

     A list with the test statistics, p-values, degrees of freedom.

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

     Wolfgang Huber <w.huber@dkfz.de>

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

     B. L. Welch (1951), On the comparison of several mean values: an
     alternative approach. Biometrika, *38*, 330-336

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

     'mt.teststat'

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

        x  = matrix(runif(9700), ncol=97)
        k2 = floor(runif(ncol(x))*2)
        k7 = floor(runif(ncol(x))*7)

        t1 = rowttests(x)
        t2 = rowttests(x, factor(k2))
        ft = rowFtests(x, factor(k7))

        # some trouble with multtest
        #if(require(multtest)) {
          #fs = mt.teststat(x, k7, test="f")
          #stopifnot(all(abs(fs - ft$statistic) < 1e-6))

          #ts2 = mt.teststat(x, k2, test="t.equalvar")
          #stopifnot(all(abs(ts2 - t2$statistic) < 1e-6))

          #ts1 = apply(x, 1, function(x) t.test(x)$statistic)
          #stopifnot(all(abs(ts1 - t1$statistic) < 1e-6))
        #}

