Aver_soj_time {MMLR} | R Documentation |
Calculating expectation of sojourn times in states for the observed time and for given initial state, using eigenvalues and eigenvectors.
Aver_soj_time(ii, tau_observed, Q)
ii |
number (scalar) |
tau_observed |
number (scalar), observed time |
Q |
Matrix (m x m), m - number of states |
Calculating expectation of sojourn times in states for the observed time (tau_observed) and if initial state is given (ii).
Matrix Q is so-called Generator matrix: Q=\lambda-\Lambda, where \lambda
is matrix with known transition rates from state $s_i$ to state $s_j$,
and \Lambda
is diagonal matrix with a vector (\Lambda_{1},...,\Lambda_{m}
on the main diagonal, where m is a number of states of external environment.
Eigenvalues and eigenvectors are used in calculations.
Vector of average sojourn times in each state. Vector components in total should give observation time (tau_observed).
lambda <- matrix(c(0, 0.33, 0.45, 0), nrow = 2, ncol = 2, byrow = TRUE)
m <- nrow(lambda)
ld <- as.matrix(rowSums(lambda))
Lambda <- diag(as.vector(ld))
Generator <- t(lambda) - Lambda
Aver_soj_time(1,10,Generator)