Description Usage Arguments Value Author(s) References Examples

Compute the forward and backward variables of a `depmix`

object.

1 2 | ```
## S4 method for signature 'mix'
forwardbackward(object, return.all=TRUE, useC=TRUE, ...)
``` |

`object` |
A depmix object. |

`return.all` |
If FALSE, only gamma and xi and the log likelihood are returned (which are the only variables needed in using EM). |

`useC` |
Flag used to set whether the C-code is used to compute the forward, backward, gamma and xi variables or not; the R-code is basically obsolete (but retained for now for debugging purposes). |

`...` |
Not currently used. |

`forwardbackward`

returns a list of the following (the variables
are named after the notation from Rabiner, 1989):

`alpha` |
The forward variables. |

`beta` |
The backward variables. |

`gamma` |
The smoothed state probabilities. |

`xi` |
The smoothed transition probabilities. |

`sca` |
The scale factors (called lambda in Rabiner, 1989). |

`logLike` |
The log likelihood (computed as |

If return.all=FALSE, only gamma, xi and the log likelihood are returned.

Maarten Speekenbrink & Ingmar Visser

Lawrence R. Rabiner (1989). A tutorial on hidden Markov models and
selected applications in speech recognition. *Proceedings of
IEEE*, 77-2, p. 267-295.

1 2 3 4 5 6 7 8 9 10 | ```
data(speed)
# 2-state model on rt and corr from speed data set
# with Pacc as covariate on the transition matrix
# ntimes is used to specify the lengths of 3 separate series
mod1 <- depmix(list(rt~1,corr~1),data=speed,transition=~Pacc,nstates=2,
family=list(gaussian(),multinomial("identity")),ntimes=c(168,134,137))
fb <- forwardbackward(mod1)
all.equal(-sum(log(fb$sca)),fb$logLike)
``` |

depmixS4 documentation built on May 30, 2017, 6:48 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.