fitHMM: Fit an HMM

Description Usage Arguments Value

View source: R/hmm.R

Description

Runs depmixs4 to fit an HMM to a set of observations given an expected number of states. It will then configure the emission dataframe to be compatible with downstream analysis

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
fitHMM(
  sample,
  het_cnt,
  states = 2,
  family = poisson(),
  nstart = 10,
  tiles = NULL,
  is.sim = FALSE,
  ret.raw = FALSE,
  multi = FALSE,
  tr_switch = c(0, 0.2),
  tr_same = c(0.9, 0.95)
)

Arguments

sample

String containing sample ID in columns

het_cnt

Dataframe for sample observations

states

Integer for expected number of states

family

Family of distribution to use (default=poisson())

nstart

Number of starts to try out for EM (Default=10)

tiles

GenomicRanges object for corresponding chrs and bins. If none is given, it will fill in the genomic poisition randomly (Default=NULL)

is.sim

Boolean flag for whether data is simulation or not (Default=FALSE)

ret.raw

Boolean flag to return the fitted model depmixS4 object

multi

Boolean whether to use depmixs4::multistart for fitting model

tr_switch

numeric vector length 2: min/max probabilty range of transition to different state

tr_same

numeric vector length 2: min/max probabilty range of transition to same state

Value

Dataframe containing the emission proabbility for each state and a fitted HMM


quevedor2/WadingPool documentation built on Dec. 22, 2021, 10:59 a.m.