get.f: Conditional sojourn time distributions

View source: R/allgenerics.R

get.fR Documentation

Conditional sojourn time distributions

Description

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

Usage

get.f(x, k)

Arguments

x

An object of S3 class smm (smmparametric or smmnonparametric) or smmfit (see fitsmm).

k

A strictly positive integer giving the time horizon.

Details

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.

Value

The values f(1), \dots, f(k), with s = \textrm{card}(E), according to type.sojourn:

"fij"

An array of dimension (s, s, k) whose element ⁠[i, j, l]⁠ is f_{ij}(l);

"fi", "fj"

A matrix of dimension (s, k) whose element ⁠[i, l]⁠ is f_i(l) (or f_j(l));

"f"

A vector of length k whose element l is f(l).

References

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.

See Also

smmparametric, smmnonparametric, fitsmm, get.kernel

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)

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


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