| get.kernel | R Documentation |
qComputes the semi-Markov kernel q_{ij}(k).
get.kernel(x, k, var = FALSE, klim = 10000)
x |
An object of S3 class |
k |
A positive integer giving the time horizon. |
var |
Logical. If |
klim |
Optional. The time horizon used to approximate the series in the
computation of the mean sojourn times vector |
Notation (see smmR-package for the complete description of the models):
(Z_k)_{k \in \mathbb{N}} is the semi-Markov chain,
(J_n)_{n \in \mathbb{N}} its embedded Markov chain
(initial distribution init, transition matrix p = ptrans),
(X_n)_{n \in \mathbb{N}^*} the sojourn times,
q_{ij}(k) = p_{ij} f_{ij}(k) the semi-Markov
kernel and s = \textrm{card}(E).
An array giving the value of q_{ij}(k) at each time between 0
and k if var = FALSE. If var = TRUE, a list containing the
following components:
an array giving the value of q_{ij}(k) at each time
between 0 and k;
an array giving the asymptotic variance of the estimator
\sigma_{q}^{2}(i, j, k).
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)
q <- get.kernel(x, k = 5)
q[, , 3] # q(2)
# The kernel sums to 1 over the next states and the times (k large)
rowSums(apply(get.kernel(x, k = 200), c(1, 2), sum))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.