\HeaderA{sam.snp}{SAM Analysis for Categorical Data}{sam.snp}
\keyword{htest}{sam.snp}
\begin{Description}\relax
Performs a SAM (Significance Analysis of Microarrays) analysis for categorical
data such a SNP data
\end{Description}
\begin{Usage}
\begin{verbatim}
  sam.snp(data, cl, B = 1000, med = FALSE, delta = NULL, n.delta = 10, 
     p0 = NA, lambda = seq(0, 0.95, 0.05), ncs.value = "max", ncs.weights = NULL,
     gene.names = dimnames(data)[[1]], q.version = 1, na.replace = TRUE, 
     check.levels = TRUE, rand = NA)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{data}] a matrix or data frame. Each row must correspond to a SNP, and
each column to a sample
\item[\code{cl}] a numeric vector of length \code{ncol(data)} indicating to which class
a sample belongs. Recommended way of specifying \code{cl} is the use of the
integers between 1 and \eqn{g}{}, where \eqn{g}{} is the number of different groups,
or in the two-class case the use of 0's and 1's
\item[\code{B}] the number of permutations used in the estimation of the null distribution
\item[\code{med}] if \code{FALSE} (default), the mean number of falsely called SNPs 
will be computed. Otherwise, the median number is calculated
\item[\code{delta}] a numeric vector specifying a set of values for the threshold 
\eqn{\Delta}{Delta} that should be used. If \code{NULL}, \code{n.delta}
\eqn{\Delta}{Delta} values will be computed automatically
\item[\code{n.delta}] a numeric value specifying the number of \eqn{\Delta}{Delta} values
that will be computed over the range of possible values of \eqn{\Delta}{Delta}
if \code{delta} is not specified
\item[\code{p0}] a numeric value specifying the prior probability \eqn{\pi_0}{pi0} 
that a SNP is not differentially expressed. If \code{NA}, \code{p0} will
be computed by the function \code{pi0.est}
\item[\code{lambda}] a numeric vector or value specifying the \eqn{\lambda}{lambda}
values used in the estimation of the prior probability. For details, see
\code{?pi0.est}
\item[\code{ncs.value}] a character string. Only used if \code{lambda} is a
vector. Either \code{"max"} or \code{"paper"}. For details, see \code{?pi0.est}
\item[\code{ncs.weights}] a numerical vector of the same length as \code{lambda}
containing the weights used in the estimation of \eqn{\pi_0}{pi0}. By default
no weights are used. For details, see \code{?pi0.est}
\item[\code{gene.names}] a character vector of length \code{nrow(data)} containing the
names of the SNPs. By default the row names of \code{data} are used
\item[\code{q.version}] a numeric value indicating which version of the q-value should
be computed. If \code{q.version=2}, the original version of the q-value, i.e.
min\{pFDR\}, will be computed. If \code{q.version=1}, min\{FDR\} will be used
in the calculation of the q-value. Otherwise, the q-value is not computed.
For details, see \code{?qvalue.cal}
\item[\code{na.replace}] if \code{TRUE}, the missing values of a SNP will be replaced
by random draws from the empirical distribution of that SNP
\item[\code{check.levels}] if \code{TRUE}, it will be checked if all variables/SNPs have
the same number of levels/categories
\item[\code{rand}] numeric value. If specified, i.e. not \code{NA}, the random number generator
will be set into a reproducible state
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
For each SNP, Pearson's Chi-Square statistic is computed to test if the distribution
of the SNP differs between several groups. Since it is very likely that the assumptions
for the Chi-square-approximation are not fulfilled a permutation based
method is used to estimate the null distribution. Since only one null distribution is estimated
for all SNPs as proposed in the original SAM procedure of Tusher et al. (2001) all SNPs must
have the same number of levels/categories.
\end{Details}
\begin{Value}
an object of class SAM
\end{Value}
\begin{Section}{Warning}
This procedure will only work correctly if all SNPs/variables have the same
number of levels/categories.
\end{Section}
\begin{Note}\relax
SAM was deveoped by Tusher et al. (2001).

!!! There is a patent pending for the SAM technology at Stanford University. !!!
\end{Note}
\begin{Author}\relax
Holger Schwender, \email{holger.schw@gmx.de}
\end{Author}
\begin{References}\relax
Schwender, H. (2004). Modifying Microarray Analysis Methods for 
Categorical Data -- SAM and PAM for SNPs. To appear in: \emph{Proceedings
of the the 28th Annual Conference of the GfKl}.

Tusher, V.G., Tibshirani, R., and Chu, G. (2001). Significance analysis of microarrays
applied to the ionizing radiation response. \emph{PNAS}, 98, 5116-5121.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{SAM-class}{SAM.Rdash.class}},\code{\LinkA{sam}{sam}},\code{\LinkA{sam.dstat}{sam.dstat}},
\code{\LinkA{sam.wilc}{sam.wilc}}
\end{SeeAlso}


