FOR c = t:104-Age
IF c<4, AdjAge = Age; ELSE AdjAge = Age+c; END
% Calculate TransMatrix from the health states in the first column to the health states in the first row. This depends on the drug selected for each health state.
TransMatrix(1,1:10) = AdjCVDrisk(1,1:10).*TrtRR(LastDrug,1:10);
TransMatrix(1,11) = TotalMort(AdjAge)*TrtRR(LastDrug,11);
TransMatrix(1,1) = 1-sum(TransMatrix(1,:));
.
.
.
TransMatrix(10,1:10) = AdjCVDrisk(10,1:10).*TrtRR(DrugForCVDDM(5),1:10);
TransMatrix(10,11) = TotalMort(AdjAge)*TrtRR(DrugForCVDDM(5),11);
TransMatrix(10,1) = 1-sum(TransMatrix(10,:));
% Calculate the state transition probabilities in the next period.
StateTransit(c+1,:) = StateTransit(c,:)*TransMatrix (:,:);
LTCost(c+1,:) = (StateTransit(c+1,:).*(cEvent(:)+cDrug(:)))/ ((1+DC)^(c-1));
LTQALY(c+1,:) = StateTransit(c+1,:).*(Ustate(:)*Uage)/((1+DC)^(c-1));
% Adjust the transition probabilities to three month basis.
IF c<4,
StateTransit(c+1,:)=1-power(StateTransit(c+1,:),0.25);
LTCost(c+1,:) = LTCost(c+1,:)*0.25;
LTQALY(c+1,:) = LTQALY(c+1,:)*0.25;
END
END
|