eln {plotHMM} | R Documentation |
Log probability arithmetic
Description
Binary operators in log probability space, to avoid numerical underflow.
Usage
elnproduct(elnx, elny)
elnsum(elnx, elny)
logsumexp(exponents.vec)
Arguments
elnx , elny , exponents.vec |
numeric vectors of log probabilities. |
Value
Numeric vector with one (logsumexp) or more (others) log probability value(s).
Author(s)
Toby Dylan Hocking
References
http://bozeman.genome.washington.edu/compbio/mbt599_2006/hmm_scaling_revised.pdf
Examples
px <- c(0.1, 0.5, 0.9)
py <- c(0.001, 0.123, 0.999)
lx <- log(px)
ly <- log(py)
library(plotHMM)
elnproduct(lx, ly)
elnsum(lx, ly)
logsumexp(ly)
[Package plotHMM version 2023.8.28 Index]