computeL: computeL

Description Usage Arguments Details Value Examples

View source: R/computeL.R

Description

computeL computes matrix, L, where L[k,t] = P(Z[t]=k | whole X = x)

Usage

1
computeL(alpha, beta)

Arguments

alpha

a matrix, alpha, from Forward Algorithm

beta

a matrix, beta, from Backward Algorithm

Details

We only calculate P(Z[t]=k , whole X = x)= alpha[k,t] * beta[k,t]. While the true matrix, L, needs to be normalised by a constant 1/P(whole X = x))

Value

A matrix, L, where L[k,t] = P(Z[t]=k | whole X = x).

Examples

1
2
3
4
5
set.seed(1221)
df <- generateHMM(num=2,n=10)
alpha <- forwardAlg(df$X[,1], df$trans, df$u, df$sig)
beta <- backwardAlg(df$X[,1], df$trans, df$u, df$sig)
L <- computeL(alpha, beta)

jiangrongo/HMM documentation built on May 19, 2019, 9:38 p.m.