View source: R/tpm_functions.R
| tpm_cont | R Documentation |
A continuous-time Markov chain is described by an infinitesimal generator matrix Q.
When observing data at time points t_1, \dots, t_n the transition probabilites between t_i and t_{i+1} are caluclated as
\Gamma(\Delta t_i) = \exp(Q \Delta t_i),
where \exp() is the matrix exponential. The mapping \Gamma(\Delta t) is also called the Markov semigroup.
This function calculates all transition matrices based on a given generator and time differences.
tpm_cont(Q, timediff, ad = NULL, report = TRUE)
Q |
infinitesimal generator matrix of the continuous-time Markov chain of dimension c(N,N) |
timediff |
time differences between observations of length n-1 when based on n observations |
ad |
optional logical, indicating whether automatic differentiation with |
report |
logical, indicating whether |
array of continuous-time transition matrices of dimension c(N,N,n-1)
Other transition probability matrix functions:
generator(),
tpm(),
tpm_emb(),
tpm_emb_g(),
tpm_g(),
tpm_g2(),
tpm_p()
# building a Q matrix for a 3-state cont.-time Markov chain
Q = generator(rep(-2, 6))
# draw random time differences
timediff = rexp(100, 10)
# compute all transition matrices
Gamma = tpm_cont(Q, timediff)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.