get.kernel: Method to get the semi-Markov kernel q

View source: R/allgenerics.R

get.kernelR Documentation

Method to get the semi-Markov kernel q

Description

Computes the semi-Markov kernel q_{ij}(k).

Usage

get.kernel(x, k, var = FALSE, klim = 10000)

Arguments

x

An object of S3 class smmfit or smm.

k

A positive integer giving the time horizon.

var

Logical. If TRUE the asymptotic variance is computed.

klim

Optional. The time horizon used to approximate the series in the computation of the mean sojourn times vector m (cf. meanSojournTimes function) for the asymptotic variance.

Details

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).

Value

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:

x:

an array giving the value of q_{ij}(k) at each time between 0 and k;

sigma2:

an array giving the asymptotic variance of the estimator \sigma_{q}^{2}(i, j, k).

Examples

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))


smmR documentation built on Nov. 28, 2026, 1:06 a.m.