| Transform-Parameters | R Documentation |
These functions transform m \times m transition probability matrices or Q matrices to a vector of length m(m-1), and back. See Details.
Pi2vector(Pi)
vector2Pi(p)
Q2vector(Q)
vector2Q(p)
Pi |
an |
Q |
an |
p |
a vector of length |
The function Pi2vector maps the m by m transition probability matrix of a discrete time HMM to a vector of length m(m-1), and vector2Pi has the reverse effect. They use a logit like transformation so that the parameter space is on the whole real line thus avoiding hard boundaries which cause problems for many optimisation procedures (see neglogLik).
Similarly, the function Q2vector maps the m by m rate matrix Q of an MMPP process to a vector of length m(m-1), and vector2Q has the reverse effect. They use a log transformation so that the parameter space is on the whole real line thus avoiding hard boundaries which cause problems for many optimisation procedures (see neglogLik).
The functions Pi2vector and Q2vector return a vector of length m(m-1), the function vector2Pi returns an m by m transition probability matrix, and vector2Q returns an m \times m rate matrix Q.
neglogLik
Pi <- matrix(c(0.8, 0.1, 0.1,
0.1, 0.6, 0.3,
0.2, 0.3, 0.5),
byrow=TRUE, nrow=3)
print(vector2Pi(Pi2vector(Pi)))
#------------------------------------------------
Q <- matrix(c(-8, 5, 3,
1, -4, 3,
2, 5, -7),
byrow=TRUE, nrow=3)
print(vector2Q(Q2vector(Q)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.