Calculate the mean length of stay for a linear facility model
meanlengthofstay(M, init, mgf)
Arguments
- M
A matrix of state transition rates between facility patient states
- init
A vector of admission state probabilities to each state
- mgf
The moment generating function characterizing a time-of-stay-dependent removal hazard
Value
The mean length of stay
Examples
M <- rbind(c(-1.1,2),c(1,-2.2))
init <- c(0.9,0.1)
mgf <- function(x, deriv=0) MGFgamma(x, rate=0.2, shape=3, deriv)
meanlengthofstay(M, init, mgf)
#> [1] 5.943294