| get.f | R Documentation |
Returns the values at times 1, \dots, k of the
conditional sojourn time distributions of a semi-Markov chain:
f_{ij}(l) = P(X_{n + 1} = l \mid J_n = i, J_{n + 1} = j), \quad l \ge 1,
(Barbu and Limnios, 2008, Definition 3.3, p. 46) or, depending on the
type of the model (type.sojourn), f_i(l) (depending on the
current state), f_j(l) (depending on the next state) or
f(l) (depending on neither) (Remark 3.3, p. 47). The semi-Markov
kernel is q_{ij}(l) = p_{ij} f_{ij}(l).
get.f(x, k)
x |
An object of S3 class |
k |
A strictly positive integer giving the time horizon. |
Notation (see smmR-package for the complete description of the
models): (J_n)_{n \in \mathbb{N}} is the embedded Markov
chain with transition matrix p (ptrans), (X_n)_{n \in
\mathbb{N}^*} the sojourn times and s =
\textrm{card}(E).
There are no instantaneous transitions, so that
f(0) = 0: the values start at time 1. For a nonparametric model
(smmnonparametric), the values beyond the maximal sojourn time
k_{max} of the model are 0. For a parametric model
(smmparametric), the distributions are those of distr shifted to
\{1, 2, \dots\} (see smmparametric); the entries
corresponding to NA in distr (e.g. the diagonal for "fij") are 0.
The values f(1), \dots, f(k), with
s = \textrm{card}(E), according to type.sojourn:
"fij" |
An array of dimension |
"fi", "fj" |
A matrix of dimension |
"f" |
A vector of length |
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.
smmparametric, smmnonparametric, fitsmm, get.kernel
states <- c("a", "b", "c")
ptrans <- matrix(c(0, 0.6, 0.4,
0.5, 0, 0.5,
0.7, 0.3, 0), nrow = 3, byrow = TRUE)
param <- matrix(c(0.3, 2, 0.6,
NA, NA, 0.8), nrow = 3)
x <- smmparametric(states = states, init = c(1/3, 1/3, 1/3),
ptrans = ptrans, type.sojourn = "fi",
distr = c("geom", "pois", "dweibull"), param = param)
f <- get.f(x, k = 10) # matrix (3, 10): f_i(l), l = 1, ..., 10
round(f, 3)
rowSums(get.f(x, k = 200)) # close to 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.