Constructing a Markov Model

Constructing a Markov Model

Introduction

The goal of this exercise is to structure a Markov model using literature-derived parameters.

H Asympomatic H->H S Progressive Disease H->S Db Death from other causes H->Db S->S S->Db Dd Death from disease S->Dd Db->Db Dd->Dd
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