View source: R/tpm_functions.R
tpm | R Documentation |
Markov chains are parametrised in terms of a transition probability matrix \Gamma
, for which each row contains a conditional probability distribution of the next state given the current state.
Hence, each row has entries between 0 and 1 that need to sum to one.
For numerical optimisation, we parametrise in terms of unconstrained parameters, thus this function computes said matrix from an unconstrained parameter vector via the inverse multinomial logistic link (also known as softmax) applied to each row.
tpm(param, byrow = FALSE)
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 Defaults to |
Transition probability matrix of dimension c(N,N)
Other transition probability matrix functions:
generator()
,
tpm_cont()
,
tpm_emb()
,
tpm_emb_g()
,
tpm_g()
,
tpm_p()
# 2 states: 2 free off-diagonal elements
par1 = rep(-1, 2)
Gamma1 = tpm(par1)
# 3 states: 6 free off-diagonal elements
par2 = rep(-2, 6)
Gamma2 = tpm(par2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.