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)
     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.

_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.

_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>

_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))

        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))
        }

