get.processes: Processes associated with a list of sequences

View source: R/get.processes.R

get.processesR Documentation

Processes associated with a list of sequences

Description

Computes, for a list of sequences, the processes of the Markov renewal representation of a semi-Markov chain (successively visited states, jump times, sojourn times, backward recurrence times) and the counting processes used by the estimators of fitsmm.

Usage

get.processes(sequences)

Arguments

sequences

A list of vectors (of characters or numbers) representing the observed sequences of states.

Details

Notation (see smmR-package for the complete description of the models): (Z_k)_{k \in \mathbb{N}} is the observed semi-Markov chain, (J_n)_{n \in \mathbb{N}} the visited states, (X_n)_{n \in \mathbb{N}^*} the sojourn times and (U_k)_{k \in \mathbb{N}} the backward recurrence times.

For each sequence Z_1, \dots, Z_n (time is counted from 1 to n, as the indices of the R vector):

  • Jm gives the successively visited states J_0, J_1, \dots (embedded Markov chain (J_n)_{n \in \mathbb{N}});

  • Xm gives the corresponding sojourn times X_1, X_2, \dots ((X_n)_{n \in \mathbb{N}^*}); the last one is censored by the end of the sequence;

  • Tm gives the times when a new state is entered, from the second visited state on, followed by n + 1;

  • Um gives the backward recurrence times (U_k)_{k \in \mathbb{N}}, i.e. the number of time units already spent in the current state (0 at each jump; Barbu and Limnios, 2008, Equation (6.5), p. 137).

The states are taken in their order of first appearance in sequences (unique(unlist(sequences))), not in alphabetical order.

Value

A list with the following components:

s

Number of distinct observed states;

states

Vector of the observed states, in their order of first appearance (length s);

M

Total length (sum of the length of each sequence);

L

Number of sequences;

kmax

Length of the longest sojourn (censored sojourns included);

Ym

The list sequences itself;

Jm

List of the successively visited states of each sequence;

Tm

List of the jump times of each sequence (see Details);

Xm

List of the sojourn times of each sequence;

Um

List of the backward recurrence times of each sequence;

counting

List of counting processes, with the states coded by their index in states and the sojourn times k = 1, \dots, k_{max}: Nijk (array of dimension (s, s, k_{max}), number of transitions i \to j after a complete sojourn of length k in i), its margins Nij, Nik, Njk, Ni, Nj, Nk and its total N; Nbijk and its margins Nbik, Nbjk, Nbk (first sojourn of each sequence, used for the censoring at the beginning); Neik, Nek (last sojourn of each sequence, censored at the end); Nebik, Nebk (sums of the previous two); Nstarti (number of sequences starting in each state).

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

get.Niuj, fitsmm

Examples

seqs <- list(c("c", "c", "a", "a", "a", "g"), c("a", "g", "g"))
p <- get.processes(seqs)
p$states    # "c" "a" "g"
p$Jm[[1]]   # "c" "a" "g"
p$Xm[[1]]   # 2 3 1
p$Tm[[1]]   # 3 6 7
p$Um[[1]]   # 0 1 0 1 2 0
p$counting$Nij


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