\Header{fdc}{FDC (false discovery count)}
\keyword{math}{fdc}
\begin{Description}\relax
Estimate the FDC (false discovery count) through permutations
\end{Description}
\begin{Usage}
\begin{verbatim}fdc(x, fac,
  teststatfun = "rowFtests",
  nrperm      = 100,
  nrgenesel   = c(10, 20, 40, 60, 80, 100, 200),
  ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] Matrix.
\item[\code{fac}] Factor, with \code{length(fac)=ncol(x)}.
\item[\code{teststatfun}] Character. Name of a function that takes arguments
\code{x} and \code{fac}, and returns a list with component
\code{statistic}. See for example \code{\Link{rowFtests}}.
\item[\code{nrperm}] Numeric. Number of permutations.
\item[\code{nrgenesel}] Numeric. A vector with the 'number of genes' for which
the FDC is to be calculated.
\item[\code{...}] Further arguments passed to code{teststatfun}.
\end{ldescription}
\end{Arguments}
\begin{Value}
A list with elements
\code{stat}: the test statistics;
\code{mpstat}: median permuted test statistics;
\code{fdc}: estimated false discovery counts;
\code{thresh}: the threshholds associated with \code{nrgenesel};
\code{nrgenesel}
\end{Value}
\begin{Author}\relax
Wolfgang Huber <w.huber@dkfz.de>
\end{Author}
\begin{SeeAlso}\relax
\code{\Link{rowFtests}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
   ## data matrix: 2000 genes, 16 samples
   x  <- matrix(runif(2000*16), ncol=16)
   ## 8 blue and 8 red samples
   fac <- factor(c(rep("blue", 8), rep("red", 8)))
   ## implant differential signal into the first 50 genes
   x[1:50, fac=="blue"] <- x[1:50, fac=="blue"] + 1

   res <- fdc(x, fac)
   plot(res$nrgenesel, res$fdc, pch=16, col="blue",
       xlab="Number of genes selected",
       ylab="Expected number of false discoveries")
   abline(a=0, b=1, col="red", lwd=2)

   qqplot(res$stat, res$mpstat, pch=".")
   abline(a=0, b=1, col="red", lwd=2)

\end{ExampleCode}
\end{Examples}

