Transform-Parameters: Transform Transition or Rate Matrices to Vector

Description Usage Arguments Details Value See Also Examples

Description

These functions transform m*m transition probability matrices or Q matrices to a vector of length m(m-1), and back. See Details.

Usage

1
2
3
4
5

Arguments

Pi

an m by m transition probability matrix.

Q

an m by m rate matrix.

p

a vector of length m(m-1).

Details

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).

Value

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*m rate matrix Q.

See Also

neglogLik

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)))

HiddenMarkov documentation built on April 27, 2021, 5:06 p.m.