| get.P | R Documentation |
Computes the transition function P of the semi-Markov
chain (Z_k)_{k \in \mathbb{N}},
P_{ij}(k) = P(Z_k = j \mid Z_0 = i)
(Barbu and Limnios, 2008, Definition 3.8, p. 51, and Equation (3.33),
p. 59):
P = \psi * (I - H),
where \psi is the Markov renewal function (get.psi), H
the diagonal matrix of the sojourn time cumulative distribution functions
(get.H) and * the matrix convolution product
(matrixConvolution).
get.P(x, k, states = x$states, var = FALSE, klim = 10000)
x |
An object of S3 class |
k |
A positive integer giving the time horizon. |
states |
Vector giving the subset |
var |
Logical. If |
klim |
Optional. The time horizon used to approximate the series in the computation of the mean recurrence times (cf. meanRecurrenceTimes) for the asymptotic variance. |
Notation (see smmR-package for the complete description of the
models): (Z_k)_{k \in \mathbb{N}} is the semi-Markov
chain, q its kernel, H and \psi are defined in get.H
and get.psi, and s = \textrm{card}(E).
When states is a strict subset A of E, the function
computes \psi_{AA} * (I - H)_{AA}, where
\psi_{AA} is the Markov renewal function of the restriction
q_{AA} of the kernel to A: its element (i, j) at
time k is the probability that the chain stays in A up to
time k and is in state j at time k, given
Z_0 = i:
P(Z_k = j,\ Z_l \in A,\ l = 0, \dots, k \mid Z_0 = i), \quad i, j \in A.
With A = U, the set of up states, this is the function
P_{11} of Barbu and Limnios (2008, Proposition 5.1 and its
second proof, pp. 105-106), and the sum over j of these
probabilities is the reliability of the system starting from i
(see reliability).
With var = TRUE, the asymptotic variance of the estimator of
P_{ij}(k) is computed (Barbu and Limnios, 2008, Equation
(4.29), p. 91); this is relevant for a fitted model (class smmfit).
If var = FALSE, a numeric array of dimension
(a, a, k + 1), where a = \textrm{card}(A)
(a = s by default), whose slice l + 1 is the matrix
P(l), for l = 0, \dots, k; the rows and columns
follow the order of x$states. If var = TRUE, a list with the
following components:
x |
The array described above; |
sigma2 |
An array of the same dimension giving the asymptotic
variances |
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.
get.psi, get.H, matrixConvolution, availability, reliability, get.limitDistribution
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)
P <- get.P(x, k = 20)
P[, , 6] # P(5)
rowSums(P[, , 21]) # each P(k) is a stochastic matrix
# Probability to stay in {"a", "b"} up to time 5
Pab <- get.P(x, k = 5, states = c("a", "b"))
rowSums(Pab[, , 6])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.