HMM: Hidden Markov Model (HMM)

Description Usage Arguments Value Author(s) References Examples

View source: R/HMM.R

Description

This function runs a 2-state HMM with negative binomial emissions. It is used for parameter initialization in ZIMHMM and ZIHMM.

Usage

1
2
3
4
HMM(ChIP.init, Control.init, offset.init, pcut = 0.05,
  epsilon.em = 0.001, maxit.em = 5, minit.em = 3, gap.em = 3,
  maxcount.em = 3, max.phi = 1000, min.zero = .Machine$double.xmin,
  quant = 0.75, quiet = F)

Arguments

ChIP.init

M*N matrix of ChIP read counts, where M is the number of windows in the analyzed genome and N is the number of replicates

Control.init

M*N matrix of log-transformed Control read counts

offset.init

M*N matrix of offsets. If no offset is used, use offset = matrix(0,nrow=M,ncol=N)

pcut

cutoff for rejection controlled EM algorithm (default is 0.05)

epsilon.em

A positive value with the convergence tolerance value for the EM algorithm (default is 1e-3)

maxit.em

integer giving the maximum number of EM iterations (default 5)

minit.em

integer giving the minimum number of EM iterations to start evaluating the convergence (default 3)

gap.em

integer giving the number of EM iterations apart to compute the convergence criterion (default 3)

maxcount.em

integer giving the number of consecutive EM iterations satisfying the convergence criterion in order to stop the algorithm (default 3)

max.phi

maximum positive value allowed for the dispersion parameters (default 1000)

min.zero

minimum positive value allowed in computations to avoid having zeros (default is .Machine$double.xmin)

quant

quantile of the distribution of the score of scaled ChIP counts to define the very first set of enrichment and background windows to begin the EM algorithm (default is 0.75). Scaled windows with score below the quant-tile are defined as background to start the EM algorithm.

quiet

whether to print messages (default F)

Value

A list with components

Pi

Vector of initial probabilities of the HMM

Gamma

Matrix of transition probabilities of the HMM

Psi

Vector of component-specific parameters of the HMM

Prob

Mx2 Matrix with posterior probabilities

LogF

Mx2 Matrix with log-forward probabilities

LogB

Mx2 Matrix with log-backward probabilities

Loglik

Mx2 Matrix with window-based probabilities

Parhist

Matrix with paramater estimates across EM iterations

Mean

M*(N*2) Matrix with NB means for every replicate and HMM component. The first two columns of Mean are the background and enrichment means of replicate 1, respectively, and so on

Viterbi

Predicted sequence of Viterbi states

Author(s)

Pedro L. Baldoni, pedrobaldoni@gmail.com

References

https://github.com/plbaldoni/ZIMHMM

Examples

1
2
3
4
5
data(Huvec)
ChIP = SummarizedExperiment::assay(Huvec,'ChIP')
Control = log(SummarizedExperiment::assay(Huvec,'Control')+1)
offset = matrix(0,nrow = nrow(ChIP),ncol = ncol(ChIP),byrow = TRUE)
## Not run: HMM(ChIP.init = rowSums(ChIP),Control.init = rowMeans(Control),offset.init = rowMeans(offset))

plbaldoni/ZIMHMM documentation built on Dec. 5, 2019, 11:43 p.m.