EBHMMNBfunForMulti {EBSeqHMM} | R Documentation

## Baum-Welch algorithm for multiple hidden markov chains

### Description

Baum-Welch algorithm for multiple hidden markov chains

### Usage

    EBHMMNBfunForMulti(Data,PPIn,
    	NgVector=NULL,Conditions, sizeFactors,
    	PriorFC=1.5,homo=TRUE, maxround=5,
    	Pi0=NULL, Tran=NULL, NumTranStage=3,
    	FCParam=NULL, AlphaIn=NULL,BetaIn=NULL,
    	StateNames=c("Up","NC","Down"),
    	EM=TRUE, UpdateParam=TRUE, Print=TRUE,WithinCondR=TRUE,
    	PenalizeLowMed=TRUE, PenalizeLowMedQt=.2,PenalizeLowMedVal=10)

### Arguments

`Data` | input data, rows are genes/isoforms and columns are samples
`PPIn` | PPDE for all adjacent comparisons
`NgVector` | Ng vector; NULL for gene level data
`Conditions` | A factor indicates the condition (time/spatial point) which each sample belongs to.
`sizeFactors` | a vector indicates library size factors
`Tran` | initial values for transition matrices
`Pi0` | initial values for starting probabilities
`NumTranStage` | number of states in two chains
`PriorFC` | target FC for gridient change
`StateNames` | name of the hidden states
`homo` | whether the chain is assumed to be homogenious
`maxround` | max number of iteration
`AlphaIn,BetaIn` | If the parameters are known and the user doesn't want to estimate them from the data, user may specify them here.
`FCParam` | not in use
`EM` | Whether estimate the prior parameters of the beta distribution by EM
`UpdateParam` | Whether update starting probabilities and transition probabilities
`WithinCondR` | By defining WithinCondR=TRUE, estimation of r's are obtained within each condition. (WithinCondR=FALSE is not suggested here)
`Print` | Whether print the elapsed-time while running the test.
`PenalizeLowMed,PenalizeLowMedQt,PenalizeLowMedVal` | Transcripts with median quantile < = PenalizeLowMedQt will be penalized

### Details

EBHMMNBfunForMulti() function implements the Balm-Welch algorithm that estimates the starting probabilities and transition probabilities of a hidden Markov model with multiple chains. Here the emission distribution of each gene is assumed to be a Beta-Negative Binomial distribution with parameters (r_g, alpha, beta) , in which alpha and beta are shared by all the genes and r_g is gene specific. If not specified, r_g, alpha and beta will be estimated using method of moments. For isoform data, we assume isoforms from the same Ig group share the same beta^Ig. alpha is shared by all the isoforms and r_gi is isoform specific. The user also needs to specify an expected FC.

### Value

MAPTerm: the most likely path of each gene/isoform.

MAPTermNum: numeric version of MAPTerm.

AllTerm: all possible expression paths considered in the model.

PP: posterior probability of being each expression path.

WhichMax: index of the most likely path.

Allf: prior probability of being each path.

Pi0Track: estimated starting probabilities of each iteration.

TranTrack: estimated transition probabilities of each iteration.

AlphaTrack, BetaTrack: estimated alpha and beta(s).

LLAll=PostSumForLL.Sum: log likelihood of the model.

### Author(s)

Ning Leng

### Examples

    data(GeneExampleData)
    CondVector <- rep(paste("t",1:5,sep=""),each=3)
    Conditions <- factor(CondVector, levels=c("t1","t2","t3","t4","t5"))
    Sizes <- MedianNorm(GeneExampleData)
    tmp <- EBHMMNBfunForMulti(Data=GeneExampleData, PPIn=matrix(1,ncol=15, nrow=100),sizeFactors=Sizes, Conditions=Conditions,
              maxround=2)

[Package EBSeqHMM version 1.14.0 Index]