Learn R Programming

Cormotif (version 1.18.0)

cormotiffit: Correlation Motif Fit

Description

This function fits the Correlation Motif model to multiple expression studies. It gives the fitted values for the probability distribution of each motif, the fitted values of the given correlation matrix and the posterior probability for each gene to be differentially expressed in each study.

Usage

cormotiffit(exprs,groupid,compid,K=1, tol=1e-3, max.iter=100, BIC=TRUE)

Arguments

exprs
a matrix, the expression data after normalization that is on log2 scale, each row of the matrix corresponds to a gene and each column of the matrix corresponds to a sample array.
groupid
the group label for each sample array, two arrays in the same study with same experinment condition$(e.g. control)$ have the same groupid.
compid
the study design and comparison matrix, each row of the matrix corresponds to one study with the first column being the first experinment condition and the second column being the second experinment condition.
K
a vector, each element specifing the number of motifs a model wants to fit.
tol
the relative tolerance level of error.
max.iter
maximun number of iterations.
BIC
default is BIC=TRUE, selecting the model with the lowest BIC value among all fitted models; if BIC=FALSE, selecting the model with the lowest AIC value among all fitted models.

Value

bestmotif$p.post
the posterior probability for each gene to be differentially expressed in each study for the best fitted model
bestmotif$motif.prior
fitted values of the probability distribution of different motifs for the best fitted model
bestmotif$motif.q
fitted values of the correlation motif matrix for the best fitted model
bestmotif$loglike
log-likelihood of the best fitted model
bic
the BIC values of all fitted models
aic
the AIC values of all fitted models
loglike
log-likelihood of all fitted models

Details

For the i^th element of $K$, the function fits total number of $K[i]$ motifs to the data. Each gene can belong to one of the $K[i]$ possible motifs according to prior probability distribution, $motif.prior$. For genes in motif $j$, the probability that they are differentially expressed in study $d$ is $motif.q(j,d)$. One should indicate the groupid and compid for each study clearly.

References

Ji, H., Wei, Y.,(2011) Correlation Motif. Unpublished

Examples

Run this code
data(simudata2)
n<-nrow(simudata2)
m<-ncol(simudata2)
#the expression data is from the second column to m
exprs.simu2<-as.matrix(simudata2[,2:m])

#prepare the group label for each sample array
data(simu2_groupid)

#prepare the design matrix for each group of samples
data(simu2_compgroup)

#fit 2 correlation motifs to the data
motif.fitted<-cormotiffit(exprs.simu2, simu2_groupid,simu2_compgroup,K=2)

Run the code above in your browser using DataLab