FOR t = 1:T % Repeat for the drug switching period.
% Go through all possible health states at t one by one.
FOR h = 1:size(dTree)
IF dTree(h,t)==3 % For the patients died.
TotalCosts(h,t) = 0; TotalQALYs(h,t) = 0;
ELSE % Otherwise, carry on the following calculations.
% Assign the baseline SBP and SD.
bSBP = SBP(h,t); bSBPSD = SBPSD(h,t);
% For the given policy, select the actually used drug for h at t.
IF DrugInx(h,t) <= size(Policy)
Drug = Policy(DrugIdx(h,t));
% If the patients used all drugs in the given policy, randomly generate a drug, which has not been used.
ELSE
RdOpt = 1:NoTrtOpt+1; % All possible treatment options.
RdOpt(:,Policy) = []; % Exclude the drugs, which was used.
Drug = datasample(RdOpt,1); % Randomly generated a drug.
END
% Decide whether a maintenance therapy is applied, and if so, how long the patient has been under the maintenance therapy.
MT = Maintenance(h,t);
% With the given t, Drug, MT, bSBP and bSBPSD, run the function ‘SBPmodelling’(see Figure 6.4). The outputs are the treatment success rate, the mean SBP and SD for the controlled and the uncontrolled and the probability of CVD, HF, DM and AEs.
[rTrtSux,UncontSBP,UncontSBPSD,ContSBP,ContSBPSD,rCVD,rHF, rDM,rAE] = SBPmodelling(t,Drug,MT,bSBP,bSBPSD);
% Calculate the following parameters with the outputs of ‘SBPmodelling’.
pCVD(h,t) = pDizPath(h,t)*rCVD(h,t); % Prob. of CVDs.
mortCVD = pCVD(h,t)*distCVD(Age,4); % CVD mortality.
mortNonCVD = pDizPath(h,t)*(pNonCVDd(Age,1)); % Non-CVD mortality.
pDeath = mortCVD+mortNonCVD; % Prob. of total death.
pSurv = pDizPath(h,t)-pDeath; % Prob. of survivors.
pHF(h,c) = pSurv*rHF; % Prob. of HF.
pDM(h,c) = pSurv*rDM; % Prob. of DM.
pAE(h,c) = pSurv*rAE; % Prob. of AE.
otherCVDs = pQRISK(h,t)*(1-sum(distCVD(Age,1:4)); % Prob. of other CVDs.
% Calculate the transition probabilities to Success and Failure.
pCont = pSurv*rTrtSux; pUncont = pSurv*(1-rTrtSux);
% Save the one-step transition probabilities to the health states in the next period.
pDizPath(Uncont,t+1) = (pUncont-(pCVD(h,t)+pHF(h,t)+pDM(h,t)-otherCVD-mortCVD+pHF(h,t)));
pDizPath(Cont,t+1) = pCont;
pDizPath(Death,t+1) = pDeath;
% Save the mean SBP and the SD after treatment depending on the health state in the next period.
SBP(Uncont,t+1) = UncontSBP;
SBP(Cont,t+1) = ContSBP;
SBPSD(Uncont,t+1) = UncontSBPSD;
SBPSD(Cont,t+1) = ContSBPSD;
% Calculate the short-term costs and QALYs.
STCosts(h,t) = (cEvent(Well)+cDrug(Drug))*pDizPath(h,t);
STQALYs(h,t) = AgeDepUtility*pDizPath(h,t);
% With the given t, Drug, pCVD(h,t), pHF(h,t), pDM(h,t), SBP(h,t) and pDeath, run the function ‘CVDmodelling’ to calculate the long-term costs and QALYs for a cohort of patients who move to the long-term CVD model from h at t. Each cohort had a 44x11 matrix including the CVD and DM related costs and QALYs from the time moved to the long-term CVD model to 100 years old.
[LTCost{t}{h},LTQaly{t}{h},LTProb{t}{h}]
= CVDmodelling(t,Drug,pCVD(h,t),pHF(h,t),pDM(h,t),SBP(h,t),
pDeath);
% Incorporate the long-term costs and QALYs from 23 cohorts.
CumLTProb = CumLTProb(:,:)+LTProb{t}{h}(:,:);
CumLTCost = CumLTCost(:,:)+LTCost{t}{h}(:,:);
CumLTQaly = CumLTQaly (:,:)+LTQaly{t}{h}(:,:);
% Calculate the total costs and QALYs for h at t.
Dostları ilə paylaş: |