expStep: E-step of HMM (forward-backward probability + posterior...

View source: R/RcppExports.R

expStepR Documentation

E-step of HMM (forward-backward probability + posterior probability calculation)

Description

E-step of HMM (forward-backward probability + posterior probability calculation)

Usage

expStep(pi, gamma, logf, hdf5)

Arguments

pi

a vector of probabilities (sum of probabilities should sum to one)

gamma

a matrix of transition probabilities (row sums should be one)

logf

a matrix of observed log-likelihood values. Columns represent hidden states, rows represent genomic regions

hdf5

path to where the hdf5 is saved

Examples

#Creating dummy object
countData <- rbind(matrix(rnbinom(1e3,mu = 2,size = 10),ncol = 1),
                  matrix(rnbinom(2e3,mu = 7.5,size = 5),ncol = 1),
                  matrix(rnbinom(1e3,mu = 2,size = 10),ncol = 1))



colData <- data.frame(condition = 'A', replicate = 1)
object <- epigraHMMDataSetFromMatrix(countData,colData)

#Initializing
object <- initializer(object,controlEM())

#Running epigraHMM
object <- epigraHMM(object,controlEM(),type = 'consensus',dist = 'nb')

#Example
expStep(pi = c(0.99,0.02),
       gamma = matrix(c(0.99,0.01,0.01,0.99),nrow = 2),
       logf = cbind(dnbinom(rnbinom(100,mu = 2,size = 10),mu = 2,size = 10,log = TRUE),
                    dnbinom(rnbinom(100,mu = 7.5,size = 5),mu = 7.5,size = 5,log = TRUE)),
       hdf5 = file.path(tempdir(),'tmp.h5'))

plbaldoni/epigrahmm documentation built on Oct. 14, 2023, 5:13 a.m.