View source: R/tpm_functions.R
| generator_g | R Documentation |
This function builds infinitesimal generator matrices for a continuous-time Markov chain based on a design matrix and coefficient matrix.
generator_g(Z, beta, Eta = NULL, byrow = FALSE, report = TRUE)
Z |
Covariate design matrix with or without intercept column, i.e. of dimension |
beta |
Matrix of coefficients for the off-diagonal elements of the generator matrix
of dimension |
Eta |
optional pre-calculated matrix of linear predictors of dimension |
byrow |
logical indicating if the generator matrices should be filled by row |
report |
logical, indicating whether the generator matrices |
Off-diagonal entries are calculated as \exp(Z \beta_i) to ensure positivity. The diagonal entries are then set to the negative row sums, which is required for generator matrices.
array of infinitesimal generator matrices of dimension c(nStates, nStates, nObs)
Other transition probability matrix functions:
generator(),
tpm(),
tpm_ct(),
tpm_emb(),
tpm_emb_g(),
tpm_g(),
tpm_g2(),
tpm_p()
# 2 states: 2 free off-diagonal elements
generator(rep(-1, 2))
# 3 states: 6 free off-diagonal elements
generator(rep(-2, 6))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.