Aver_soj_time: Calculating the average sojourn time in each state

Description Usage Arguments Details Value Examples

View source: R/MMLR.R

Description

Calculating expectation of sojourn times in states for the observed time and for given initial state, using eigenvalues and eigenvectors.

Usage

1
Aver_soj_time(ii, tau_observed, Q)

Arguments

ii

number (scalar)

tau_observed

number (scalar), observed time

Q

Matrix (m x m), m - number of states

Details

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=λ-Λ, where λ is matrix with known transition rates from state $s_i$ to state $s_j$, and Λ is diagonal matrix with a vector (Λ_{1},...,Λ_{m} on the main diagonal, where m is a number of states of external environment. Eigenvalues and eigenvectors are used in calculations.

Value

Vector of average sojourn times in each state. Vector components in total should give observation time (tau_observed).

Examples

1
2
3
4
5
6
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)

MMLR documentation built on Jan. 9, 2020, 5:06 p.m.

Related to Aver_soj_time in MMLR...