Health economic evaluation in practice 193
c.0 <- c(2.38,2.38,1815.58,95.21)
c.1 <- c(7.96,7.96,1821.17,100.79)
# Computes total weekly costs
cost0 <- cost1 <- matrix(0,n.sims,J)
for (i in 1:n.sims){
for (j in 2:(J+1)){
c5[j] <- (c.0%*%m.0[i,1:(S-1),j])/sum(m.0[i,1:(S-1),j])
cost0[i,j-1] <- m.0[i,S,j]*c5[j] + c.0%*%m.0[i,1:(S-1),j]
cost1[i,j-1] <- m.1[i,S,j]*c5[j] + c.1%*%m.1[i,1:(S-1),j]
}
}
First, we define the unit cost associated with each of the first four states. Then
we define two matrices cost.0 and cost.1, each of dimension (n.sims, J)and
originally filled with 0 values. For each time point in the follow up j,wefirst
compute the cost of the state TP, according to (5.11).
Here, the R notation %*% codifies the inner product between the elements
of two v