plot.smmfit | R Documentation |
Displays the densities for the conditional sojourn time
distributions depending on the current state i
and on the next state
j
.
## S3 method for class 'smmfit'
plot(x, i, j, klim = NULL, ...)
x |
An object of class |
i |
An element of the state space vector |
j |
An element of the state space vector |
klim |
An integer giving the limit value for which the density will be
plotted. If |
... |
Arguments passed to plot. |
None.
V. S. Barbu, N. Limnios. (2008). Semi-Markov Chains and Hidden Semi-Markov Models Toward Applications - Their Use in Reliability and DNA Analysis. New York: Lecture Notes in Statistics, vol. 191, Springer.
states <- c("a", "c", "g", "t")
s <- length(states)
# Creation of the initial distribution
vect.init <- c(1 / 4, 1 / 4, 1 / 4, 1 / 4)
# Creation of the transition matrix
pij <- matrix(c(0, 0.2, 0.3, 0.4, 0.2, 0, 0.5, 0.2, 0.5,
0.3, 0, 0.4, 0.3, 0.5, 0.2, 0), ncol = s)
# Creation of the distribution matrix
distr.vec <- c("pois", "geom", "geom", "geom")
parameters <- matrix(c(2, 0.6, 0.8, 0.8, NA, NA, NA, NA),
ncol = 2, byrow = FALSE)
# Specify the semi-Markov model
smm <- smmparametric(states = states, init = vect.init, ptrans = pij,
type.sojourn = "fi", distr = distr.vec, param = parameters)
seqs <- simulate(object = smm, nsim = rep(5000, 100), seed = 10)
est <- fitsmm(sequences = seqs, states = states, type.sojourn = "fi", distr = distr.vec)
class(est)
plot(x = est, i = "a", col = "blue", pch = "+")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.