Constructing a Markov Model
Introduction
The goal of this exercise is to structure a Markov model using literature-derived parameters.
library(Matrix)
r_AS <- .08
r_Db <- 0.006
HR_DS <- 3
R <- matrix(0, nrow=4, ncol = 4, dimnames=list(c("Asymptomatic","Progressive Disease","Disease Mortality", "Background Mortality"),
c("Asymptomatic","Progressive Disease","Disease Mortality", "Background Mortality")))
R[1,1] <- -(r_AS + r_Db)
R[1,2] <- r_AS
R[1,4] <- r_Db
R[2,3] <- HR_DS * r_Db
R[2,4] <- r_Db
R[2,2] <- -(HR_DS * r_Db + r_Db)
P <- as.matrix(expm(R))
P[is.na(P)] <- 0
RR_A <- 0.8
P_A <- P