Replies: 1 comment
-
Hi @XuefenYin - I'd be happy to look with you. Could you post the control file as text that is formatted to be directly run-able with mrgsolve? Thanks, Kyle |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I figured out the error, the condition must be met at the time the dose is given to trigger a reduction. It now works when I adjust the condition to 100. Thanks anyway.
code <- '
$PROB
$PARAM
KA= 0.5, CL=10 , V2 =247, Q =10, V3 =70, TR =0.02, dredf=0.5, condition=100
$PARAM
DOSE=60, INTERVAL=24, UNTIL=600, WHERE=1 // Initial dose and dosing interval
$CMT GUT,CENT,PERIPH,AUC
$PLUGIN evtools
$GLOBAL
evt::regimen reg;
$PK
double K = CL/V2;
double K23 = Q/V2;
double K32 = Q/V3;
double S2 = V2/1000;
double F1 = 1 - TR/(1+TR);
if (NEWIND <= 1) {
reg.init(self);
reg.amt(DOSE);
reg.cmt(WHERE);
reg.ii(INTERVAL);
reg.until(UNTIL);
}
$ODE
dxdt_GUT = -KA * GUT;
dxdt_CENT = KA * GUT - K23 * CENT + K32 * PERIPH - K * CENT;
dxdt_PERIPH = K23 * CENT - K32 * PERIPH;
dxdt_AUC = CENT / S2;
$ERROR
double CP = CENT / S2;
if (fmod(TIME, 24) == 0 && CP > condition) {
reg.amt(reg.amt() * dredf); // dose reduce to half
}
capture Dose = reg.amt(); // Capture the current dose
reg.execute(); // Execute the regimen updates
$CAPTURE CP // Capture these variables for output
'
mod.dose <- mcode("foo", code)
out.dose <- mod.dose %>%
mrgsim(
tgrid = c(seq(0, 300, by = 1)),
atol = 1E-8,
rtol = 1E-6
)
plot(out.dose)
out_df <- as.data.frame(out.dose)
Beta Was this translation helpful? Give feedback.
All reactions