Learn R Programming

aphid (version 1.3.5)

plot.HMM: Plot standard hidden Markov models.

Description

plot.HMM provides a visual representation of a standard hidden Markov model.

Usage

# S3 method for HMM
plot(x, just = "center", arrexp = 1, textexp = 1, begin = FALSE, ...)

Value

NULL (invisibly).

Arguments

x

an object of class "HMM".

just

a character string giving the justfication of the plot relative to the device. Accepted values are "left", "center" and "right".

arrexp

the expansion factor to be applied to the arrows in the plot.

textexp

the expansion factor to be applied to the text in the plot.

begin

logical indicating whether the begin/end state should be plotted. Defaults to FALSE.

...

additional arguments to be passed to plot.

Author

Shaun Wilkinson

Details

"plot.HMM" Plots a "HMM" object as a directed graph. States (rectangles) are interconnected by directed lines with line-weights proportional to the transition probabilities between the states.

References

Durbin R, Eddy SR, Krogh A, Mitchison G (1998) Biological sequence analysis: probabilistic models of proteins and nucleic acids. Cambridge University Press, Cambridge, United Kingdom.

Durbin R, Eddy SR, Krogh A, Mitchison G (1998) Biological sequence analysis: probabilistic models of proteins and nucleic acids. Cambridge University Press, Cambridge, United Kingdom.

See Also

plot.PHMM

Examples

Run this code
  ## the dishonest casino example from Durbin et al (1998)
  states <- c("Begin", "Fair", "Loaded")
  residues = paste(1:6)
  A <- matrix(c(0, 0, 0, 0.99, 0.95, 0.1, 0.01, 0.05, 0.9), nrow = 3)
  dimnames(A) <- list(from = states, to = states)
  E <- matrix(c(rep(1/6, 6), rep(1/10, 5), 1/2), nrow = 2, byrow = TRUE)
  dimnames(E) <- list(states = states[-1], residues = residues)
  x <- structure(list(A = A, E = E), class = "HMM")
  plot(x, main = "Dishonest casino hidden Markov model")

Run the code above in your browser using DataLab