\Header{pamr.cv}{A function to cross-validate the nearest shrunken centroid
classifier}
\begin{Description}\relax
A function to cross-validate the nearest shrunken centroid
classifier produced by pamr.train
\end{Description}
\begin{Usage}
\begin{verbatim}
pamr.cv(fit, data,  nfold = min(table(data$y)), folds = balanced.folds(data$y), ...)\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{fit}] The result of a call to pamr.train
\item[\code{data}] A list with at least two components: x- an expression
genes in the rows, samples in the columns, and y-  a vector of
the class labels for each sample. Same form as data object
used by pamr.train.
\item[\code{nfold}] Number of cross-validation folds. Default is the
smallest
class size
\item[\code{folds}] A list with nfold components, each component a vector of
indices of the samples in that fold. By default a (random) balanced
cross-validation is used
\item[\code{...}] 
\end{ldescription}
 {Any additional arguments that are to be passed to pamr.train}
\end{Arguments}
\begin{Details}\relax
\code{pamr.cv} carries out cross-validation for a nearest shrunken
centroid classifier.
\end{Details}
\begin{Value}
A list with components
\begin{ldescription}
\item[\code{threshold}] 
\item[\code{errors}] The number of cross-validation  errors for each threshold value
\item[\code{loglik}] The cross-validated multinomial log-likelihood value
for each threshold value
\item[\code{size}] A vector of the number of genes that survived the
thresholding, for each threshold value tried.
\item[\code{yhat}] A matrix of size n by nthreshold, containing the
cross-validated
class predictions for each threshold value,  in each column
\item[\code{prob}] A matrix of size n by nthreshold, containing the
cross-validated
class probabilities for each threshold value,  in each column
\item[\code{folds}] The cross-validation folds used
\item[\code{call}] The calling sequence used
\end{ldescription}
\end{Value}
\begin{Author}\relax
Trevor Hastie,Robert Tibshirani, Balasubramanian Narasimhan, and Gilbert Chu
\end{Author}
\begin{References}\relax
\end{References}
\begin{Examples}
\begin{ExampleCode}
set.seed(120)
x <- matrix(rnorm(1000*20),ncol=20)
y <- sample(c(1:4),size=20,replace=TRUE)
mydata <- list(x=x,y=y)
mytrain <-   pamr.train(mydata)
mycv <- pamr.cv(mytrain,mydata)
\end{ExampleCode}
\end{Examples}

