backward: The backward part of the FB algorithm.

Description Usage Arguments Value See Also Examples

View source: R/backward.R

Description

Calculates the backward probabilities. The main purpose of this function is to be combined with forward function to calculate smooth states and smooth consecutive pairwise states. This is done by functions sstates and scpstates.

Usage

1
2
3
4
backward(...)

## S3 method for class 'HMM'
backward(x, y, sfactors)

Arguments

x

A HMM model.

y

A vector with the observed events. It admits missing values.

sfactors

A vector with the scale factors from the forward algorithm.

Value

A matrix that contains the (rescaled) backward probabilities.

See Also

forward, sstates, scpstates

Examples

1
2
3
4
5
6
7
model <- HMMrectangle(3,3)
emissions(model) <- Matrix(c(1, 1, 0.5, 1, 0.5, 0, 0.5, 0, 0,
                             0, 0, 0.5, 0, 0.5, 1, 0.5, 1, 1),
                             ncol = 2, sparse = TRUE)
model <- initparams(model)
fpass <- forward(model, c(1,2,1))
backward(model, c(1,2,1), fpass$scalefactors)

MobilePhoneESSnetBigData/destim documentation built on Dec. 7, 2020, 7:35 p.m.