Learn R Programming

gaga (version 2.18.0)

classpred: Predict the class that a new sample belongs to.

Description

Computes the posterior probability that a new sample belongs to each group and classifies it into the group with highest probability.

Usage

classpred(gg.fit, xnew, x, groups, prgroups, ngene=100)

Arguments

gg.fit
GaGa or MiGaGa fit (object of type gagafit, as returned by fitGG).
xnew
Expression levels of the sample to be classified. Only the subset of the genes indicated by ngene is used.
x
ExpressionSet, exprSet, data frame or matrix containing the gene expression measurements used to fit the model.
groups
If x is of type ExpressionSet or exprSet, groups should be the name of the column in pData(x) with the groups that one wishes to compare. If x is a matrix or a data frame, groups should be a vector indicating to which group each column in x corresponds to.
prgroups
Vector specifying prior probabilities for each group. Defaults to equally probable groups.
ngene
Number of genes to use to build the classifier. Genes with smaller probability of being equally expressed are selected first.

Value

List with the following elements:
d
Numeric value indicating the group that the new sample is classified into, i.e. where the maximum in posgroups is.
posgroups
Vector giving the posterior probability that the xnew belongs to each of the groups.

Details

The classifier weights each gene according to the posterior probability that it is differentially expressed. Hence, adding genes that are unlikely to be differentially expressed does not affect the performance of the classifier, but it does increase the computational cost. All computations are performed by fixing the hyper-parameters to their estimated value (posterior mean if model was fit with method=='Bayes' or maximum likelihood estimate is model was fit with method=='EBayes').

References

Rossell D. GaGa: a simple and flexible hierarchical model for microarray data analysis. http://rosselldavid.googlepages.com.

See Also

fitGG, parest

Examples

Run this code
#Not run. Example from the help manual
#library(gaga)
#set.seed(10)
#n <- 100; m <- c(6,6)
#a0 <- 25.5; nu <- 0.109
#balpha <- 1.183; nualpha <- 1683
#probpat <- c(.95,.05)
#xsim <- simGG(n,m,p.de=probpat[2],a0,nu,balpha,nualpha)
#
#ggfit <- fitGG(xsim$x[,c(-6,-12)],groups,patterns=patterns,nclust=1)
#ggfit <- parest(ggfit,x=xsim$x[,c(-6,-12)],groups,burnin=100,alpha=.05)
#
#pred1 <- classpred(ggfit,xnew=xsim$x[,6],x=xsim$x[,c(-6,-12)],groups)
#pred2 <- classpred(ggfit,xnew=xsim$x[,12],x=xsim$x[,c(-6,-12)],groups)
#pred1
#pred2

Run the code above in your browser using DataLab