\name{ZIPLDA}
\alias{ZIPLDA}
\title{Classifying next-generation sequencing data using
  a zero-inflated Poisson model}
\description{
  A method to classify next-generation sequencing data using
  a zero-inflated Poisson model.
}

\usage{
  ZIPLDA(x,y,xte=NULL,rho=0,beta=1,rhos=NULL,prob0=NULL,
           type=c("mle","deseq","quantile"), prior=NULL,
           transform=TRUE, alpha=NULL)
}

\arguments{
  \item{x}{Training data set.
  }
  \item{y}{A vector shows each sample in training set belongs to which class.
  }
  \item{xte}{Test data set, if not provide, testing was performed on training data set.
  }
  \item{rho}{Default value is 0.
  }
  \item{beta}{A prior value to estimate class differences, default is 1.
  }
  \item{rhos}{A vector rho can choose.
  }
  \item{prob0}{The probability of the point mass at zero.
  }
  \item{type}{There are three types to choose to estimate size factor, that is "mle", "deseq" and "quantile".
  }
  \item{prior}{A prior to calculate discriminant score, if NULL, the value is equall to the proportion that the number of samples belong to the k-th class to total sample numbers.
  }
  \item{transform}{Asking for if transformation, default is TRUE.
  }
  \item{alpha}{A value must be between 0 and 1.
  }
}

\value{An object of class "ZIPLDA" is a list containing at least the following components:

  \item{ns}{The product of Size factor and the total count of short reads of gene g for the training data.
    }
  \item{nste}{The product of Size factor and the total count of short reads of gene g for the test data.
  }
  \item{ds}{Estimated class differences.
  }
  \item{discriminant}{Discriminant matrix.
  }
  \item{ytehat}{The class that samples in test data set belongs to.
  }
  \item{...}{Parameters explained in arguments.
  }
}
\seealso{?ZIPLDA()}
\examples{
set.seed(1)
dat <- CountDataSet1(n=40,p=50,sdsignal=0.2,K=2,
param=1/0.001,drate=0.2)

prob<-estimatep(dat$x,dat$y,xte=dat$x,beta=1,
type=c("mle","deseq","quantile"), prior=NULL)

prob0<-estimatep(dat$x,dat$y,dat$xte,beta=1,
type=c("mle","deseq","quantile"), prior=NULL)

prob<-t(prob)
prob0<-t(prob0)

zipldacv.out <- ZIPDA.cv(dat$x,dat$y,prob0=prob)

ZIPLDA(dat$x,dat$y,dat$xte,transform=FALSE,
prob0=prob0,rho=zipldacv.out$bestrho)
}









