\Header{rowFtests}{F-test and t-test for rows of a matrix}
\alias{rowttests}{rowFtests}
\keyword{math}{rowFtests}
\begin{Description}\relax
F-test and t-test for rows of a matrix
\end{Description}
\begin{Usage}
\begin{verbatim}
rowFtests(x, fac)
rowttests(x, fac)\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] Matrix
\item[\code{fac}] Factor, with \code{length(fac)=ncol(x)}. For
\code{rowttests}, \code{fac} must have exactly two levels.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
If \code{fac} is specified, \code{rowttests} performs for each
row of \code{x} a two-sided, two-class t-test with equal variances.
\code{fac} must be a factor of length \code{ncol(x)} with two levels,
corresponding to the two groups.

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

With the current implementation, \code{NA}s are not allowed. This
could be changed if desirable.
\end{Details}
\begin{Value}
A list with the test statistics, p-values, degrees of freedom.
\end{Value}
\begin{Author}\relax
Wolfgang Huber <w.huber@dkfz.de>
\end{Author}
\begin{SeeAlso}\relax
\code{\Link{mt.teststat}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
   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))
   }
\end{ExampleCode}
\end{Examples}

