\HeaderA{pamr.plotsurvival}{A function to plots Kaplan-Meier curves stratified by a group variable}{pamr.plotsurvival}
\begin{Description}\relax
A function to plots Kaplan-Meier curves stratified by a group variable
\end{Description}
\begin{Usage}
\begin{verbatim}
pamr.plotsurvival(group, survival.time, censoring.status)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{group}] A grouping factor
\item[\code{survival.time}] Vector of survival times
\item[\code{censoring.status}] Vector of censoring status values: 1=died, 0=censored 
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\end{Details}
\begin{Value}
\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}

gendata<-function(n=100, p=2000){
  tim <- 3*abs(rnorm(n))
  u<-runif(n,min(tim),max(tim))
  y<-pmin(tim,u)
   ic<-1*(tim<u)
m <- median(tim)
x<-matrix(rnorm(p*n),ncol=n)
  x[1:100, tim>m] <-  x[1:100, tim>m]+3
  return(list(x=x,y=y,ic=ic))
}

# generate training data; 2000 genes, 100 samples

junk<-gendata(n=100)
y<-junk$y
ic<-junk$ic
x<-junk$x
d <- list(x=x,survival.time=y, censoring.status=ic,
geneid=as.character(1:nrow(x)), genenames=paste("g",as.character(1:nrow(x)),sep=
""),)

# train model
a3<- pamr.train(d, ngroup.survival=2)

#make class predictions

yhat <- pamr.predict(a3,d$x, threshold=1.0)

pamr.plotsurvival(yhat, d$survival.time, d$censoring.status)

\end{ExampleCode}
\end{Examples}

