Learn R Programming

LaMa (version 2.0.3)

generator: Build the generator matrix of a continuous-time Markov chain

Description

This function builds the infinitesimal generator matrix for a continuous-time Markov chain from an unconstrained parameter vector.

Usage

generator(param, byrow = FALSE, report = TRUE)

Value

infinitesimal generator matrix of dimension c(N,N)

Arguments

param

unconstrained parameter vector of length N*(N-1) where N is the number of states of the Markov chain

byrow

logical indicating if the transition probability matrix should be filled by row

report

logical, indicating whether the generator matrix Q should be reported from the fitted model. Defaults to TRUE, but only works if when automatic differentiation with RTMB is used.

See Also

Other transition probability matrix functions: tpm(), tpm_cont(), tpm_emb(), tpm_emb_g(), tpm_g(), tpm_p()

Examples

Run this code
# 2 states: 2 free off-diagonal elements
generator(rep(-1, 2))
# 3 states: 6 free off-diagonal elements
generator(rep(-2, 6))

Run the code above in your browser using DataLab