scpstates: Returns xi like in the Baum-Welch algorithm.

Description Usage Arguments Value See Also Examples

View source: R/scpstates.R

Description

Returns the smooth joint probability mass function for consecutive states, which is usually called ξ in the Baum-Welch algorithm. Smooth states are marginal but as they are far to be independent it is convenient to have some information about their dependence. This function returns the joint probability mass function for two time consecutive states, conditional on the observations. This agrees with the so called ξ from the Baum-Welch algorithm.

It is returned as a matrix, so that the said joint probability for time instants i - 1 and i are the columns from i - 1 times the number of states plus one, to i times the number of states.

Usage

1
2
3
4
scpstates(...)

## S3 method for class 'HMM'
scpstates(x, e)

Arguments

x

A HMM model.

e

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

Value

A sparse matrix. The number of rows is the number of states, and the number of columns is the number of states times the number of observed events minus one. Each full row square slice of the output matrix corresponds to a joint probability mass function, so it sums up to one.

See Also

HMM, sstates, backward

Examples

1
2
3
4
5
6
7
8
9
model <- HMMrectangle(10,10)
tws <- matrix(c(3.2, 6.1, 2.2, 5.7, 5.9, 9.3, 5.4,
4.0, 2.9, 8.6, 6.9, 6.2, 9.7, 1.3),
nrow = 2, ncol = 7)
S <- function(x) if (x > 5) return(0) else return(20*log(5/x))
emissions(model)<-createEM(c(10,10), tws, S)
obs <- c(1,2,NA,NA,NA,NA,7,7)
model <- fit(model, obs)
scpstates(model, obs)

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