You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to implement the following in the mrgoslve solve;
Cycle 1 (Day 1) = Everyone get a dose 10 mg
Cycle 2
(Day1) = Evaluate if PD > Threshold and dose full amount if criteria is met
If PD < Threshold at the Next dose, then Postpone the dose by a week and reevaluate and dose again if criteria met
If even after 1 week holiday there is no recovery of the target then do not dose until the next cycle.
Below is my attempt to get it using the adaptive dosing in mrgoslve. However, I would like to know. What happens if I want multiple time points evaluated within each cycle? for example, can we still use this logic first on Day 3 and then on Day 7? Or what if I want to evaluate the PD daily and then dose on the Day the PD marker is above the threshold value?
The idea is to maintain the drug exposure and not compromise safety.
Thank you,
code <- '
$PROB Example of Dynamic Dosing with PD-based Adjustment and Detailed Capture within Mrgsolve
$PLUGIN evtools
$PARAM
VC = 483.8
CRCL = 0.0
CLH = 5
ALC0 = 10.0
KIN = 10.0
KOUT = 1.0
EMAX = 457.0
WTKG = 0
EC50 = 0
WEEK = 168; // Assuming 1 week = 7 days
DOSE_CYCLE = 3 * 168; // 3 weeks per cycle
DOSE_DELAY = 1 * 168; // 1 week delay if PD is below threshold
NO_DOSE_WEEK = 6 * 168; // No dose at week 6 (Cycle 3)
FINAL_DOSE_WEEK = 9 * 168; // Dose at week 9 (Cycle 4)
DOSE_ENDTIME = 12 * 168; // End simulation at week 12
TOTAL_CYCLES = 4; // Number of cycles to run
DOSE_CMT = 1;
PD_THRESHOLD = 2; // Define PD threshold for dose delay
$CMT
CENT
PD
$GLOBAL
evt::regimen reg; // create dosing regimen object
$MAIN
// Dynamic Dosing
double DOSEMG_IN = 10.0;
if(WTKG < 50.0){
DOSEMG_IN = 5.0;
}else if(WTKG > 50.0){
DOSEMG_IN = 10.0;
}
if(NEWIND <= 1){ // do once for each subject
reg.init(self);
reg.amt(DOSEMG_IN);
reg.cmt(DOSE_CMT);
reg.ii(DOSE_CYCLE);
reg.until(DOSE_ENDTIME);
reg.flagnext();
double DRUG_ON = 1.0;
}
double DOSE_OUT = reg.amt();
double NEW_DOSE=reg.amt() * 0.25;
double DOSE_DELAYED = 0; // To track if dose was delayed
double ACTUAL_DOSE_TIME = 0; // To track actual dose time
// PK and PK-PD Model
double CLR = 3.66*(CRCL/1000.0*60.0);
double CL = CLH + CLR;
double KE = CL/VC;
PD_0 = ALC0;
$ODE
// PK and PK-PD Model
dxdt_CENT = -KE*CENT;
double CP = 1000.0*(CENT/VC);
if(CP < ATOL){
CP = 0.0;
}
double EFFECT = 0.0;
if(CP > 0){
EFFECT = EMAX*CP/(EC50+CP);
}
dxdt_PD = KIN - KOUT*(1.0+EFFECT)*PD;
$OMEGA 0.0
$ERROR
double REPEAT_TIME = TIME;
double CYCLE = std::floor(REPEAT_TIME / DOSE_CYCLE) + 1.0;
double CYCLE_TIME = REPEAT_TIME - (CYCLE - 1.0) * DOSE_CYCLE;
// Capture the PD value before making dosing decisions
double PD_CURRENT = PD;
// Dosing logic
if (CYCLE == 1) {
// First cycle - Week 0 - Always dose
if (evt::near(CYCLE_TIME, 0.0)) {
reg.amt(DOSEMG_IN);
DRUG_ON = 1.0;
ACTUAL_DOSE_TIME = REPEAT_TIME; // Record the actual dose time
}
} else if (CYCLE == 2 && evt::near(CYCLE_TIME, 0.0)) {
// Second cycle - Week 3 - Dose if PD is above threshold; otherwise delay by 1 week
if (PD_CURRENT >= PD_THRESHOLD) {
reg.amt(DOSEMG_IN);
DRUG_ON = 1.0;
DOSE_DELAYED = 0; // No delay
ACTUAL_DOSE_TIME = REPEAT_TIME; // Record the actual dose time
} else {
reg.amt(DOSEMG_IN*0);
// Delay by one week and re-check PD before dosing
DOSE_DELAYED = 1; // Indicate that dose was delayed
double DELAYED_TIME = REPEAT_TIME + DOSE_DELAY;
}
} // else if (CYCLE == 2 && TIME== 576) {
// Second cycle - Week 3 - Dose if PD is above threshold; otherwise delay by 1 week
// if (PD_CURRENT >= PD_THRESHOLD) {
// evt::ev dose = evt::infuse(10, 1, 100);
//evt::retime(dose, REPEA);
//self.push(dose);
// // reg.amt(DOSEMG_IN*4);
// DRUG_ON = 1.0;
// DOSE_DELAYED = 0; // No delay
// ACTUAL_DOSE_TIME = REPEAT_TIME; // Record the actual dose time
// }
//}
else if (CYCLE == 2 && TIME== 672) {
// Second cycle - Week 3 - Dose if PD is above threshold; otherwise delay by 1 week
if (PD_CURRENT >= PD_THRESHOLD) {
evt::ev dose = evt::infuse(10, 1, 100);
//evt::retime(dose, REPEA);
self.push(dose);
// reg.amt(DOSEMG_IN*4);
DRUG_ON = 1.0;
DOSE_DELAYED = 0; // No delay
ACTUAL_DOSE_TIME = REPEAT_TIME; // Record the actual dose time
}
}
else {
reg.amt(0);
}
reg.execute();
$TABLE
double PD1 = PD;
double ALC_BX = (pow(PD1, 0.2) - 1.0)/0.2;
// Capture additional information for analysis
$CAPTURE WTKG EC50 CP CYCLE REPEAT_TIME CYCLE_TIME PD_CURRENT DRUG_ON DOSE_OUT DOSE_DELAYED ACTUAL_DOSE_TIME NEW_DOSE DELAYED_TIME
'
mod <- mcode("example_dynamic_dosing", code)
demo <- data.frame( # creating dummy subjects for testing logic
ID = c(1:4),EC50 = c(0.1,2.5,5,50),WTKG =70)
data<-sim0 <- mod %>%
idata_set(demo) %>%
carry.out(CMT,EVID)%>%
mrgsim(start = 0, end=168*12, delta=1, nocb=F)#%>%
# as.data.frame()%>%
#rename(TIME = time)
plot(data,PD+CP~time)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi Everyone,
I am trying to implement the following in the mrgoslve solve;
Below is my attempt to get it using the adaptive dosing in mrgoslve. However, I would like to know. What happens if I want multiple time points evaluated within each cycle? for example, can we still use this logic first on Day 3 and then on Day 7? Or what if I want to evaluate the PD daily and then dose on the Day the PD marker is above the threshold value?
The idea is to maintain the drug exposure and not compromise safety.
Thank you,
Beta Was this translation helpful? Give feedback.
All reactions