Function [rTrtSux,UncontSBP,UncontSBPSD,ContSBP,ContSBPSD,rCVD,rHF, rDM,rAE] = SBPmodelling(t,Drug,MT,bSBP,bSBPSD);
% Call datasets.
[mSLE,vSLE,RiskHF,RiskDM,hrDM,RiskAE] = Data(Scenario);
% Generate 1,000 random samples of baseline SBP using a lognormal distribution.
SBP_Before(1000,1) = lognrnd(mu_bSBP,sigma_bSBPSD,1,1000);
% Generate 1,000 random samples of SBP lowering effect using a lognormal distribution.
SBP_Rdt(1000,1) = lognrnd(mu_mSLE,sigma_vSLE,1,1000);
% SBP after treatment is a function of the baseline SBP, age-dependent SBP change and SBP lowering effect.
SBP_After(1000,1) = SBP_Before(:,1)+AgeDepSBP-(SBP_Before(:,1).* SBP_Rdt(:,1));
% Generate the probability of AEs including DM using a beta distribution.
pAE = betarnd((rAE+rDM)*1000,1000-((rAE+rDM)*1000));
% Randomly generate 1,000 samples of AEs using pAE and assign 1 for the proportion of the patients with AE and 0 for the proportion of the patients without AE.
AEs = round(pAE*1000); NoAEs=round((1-pAE)*1000);
TempAE = [zeros(NoAEs,1), ones(AEs,1)];
Sampled_AE(1000,1) = TempAE(randperm(1000));
% Estimate the 10-year CVD risks using the QRISK2.
TenYearCVD(1000,1) = QRISK2(Gender,Age,AF,RA,RD,TreatHist, Type1DM,Type2DM,BMI,Ethnicity,FamilyHist,SBP_After(:,1),Smoking,11, TownsendScore)+(TenYearHF*100);
% Adjust the 10-year CVD risk to the 3 month basis.
ThreeMonthCVD(1000,1) = 1-power((1-TenYearCVD(:,1)/100), 0.1*CycleLength);
% Decide whether the treatment is successful or not.
Dostları ilə paylaş: |