This function is currently not exported, so be sure to call it with
mrgsolve:::code(...)
.
Examples
mod <- mrgsolve::house()
mrgsolve:::code(mod)
#> [1] "$PROB "
#> [2] ""
#> [3] "# `mrgsolve` housemodel"
#> [4] ""
#> [5] "This model is compiled with `mrgsolve`."
#> [6] ""
#> [7] " - Author: Metrum Research Group, LLC"
#> [8] " - Description: Generic indirect response PK/PD model"
#> [9] " - Covariates: Weight, female sex"
#> [10] " - Random effects: CL, VC, KA, KOUT"
#> [11] " - Error model: exponential"
#> [12] ""
#> [13] ""
#> [14] ""
#> [15] "$PLUGIN base"
#> [16] ""
#> [17] "$PARAM @annotated"
#> [18] "CL : 1 : Clearance (L/hr)"
#> [19] "VC : 20 : Volume of distribution (L)"
#> [20] "KA : 1.2 : Absorption rate constant (1/hr)"
#> [21] "F1 : 1.0 : Bioavailability fraction (.)"
#> [22] "D1 : 2.0 : Infusion duration (hr)"
#> [23] "WTCL : 0.75 : Exponent WT on CL"
#> [24] "WTVC : 1.00 : Exponent WT on VC"
#> [25] "SEXCL: 0.7 : Prop cov effect on CL"
#> [26] "SEXVC: 0.85 : Prop cov effect on VC"
#> [27] "KIN : 100 : Resp prod rate constant (1/hr)"
#> [28] "KOUT : 2 : Resp elim rate constant (1/hr)"
#> [29] "IC50 : 10 : Conc giving 50% max resp (ng/ml)"
#> [30] ""
#> [31] "$PARAM @annotated @covariates"
#> [32] "WT : 70 : Weight (kg)"
#> [33] "SEX : 0 : Covariate female sex"
#> [34] ""
#> [35] "$CMT @annotated"
#> [36] "GUT : Dosing compartment (mg)"
#> [37] "CENT : Central compartment (mg)"
#> [38] "RESP : Response (unitless)"
#> [39] ""
#> [40] "$OMEGA @labels ECL EVC EKA EKOUT"
#> [41] "0 0 0 0"
#> [42] ""
#> [43] "$SIGMA @labels EXPO"
#> [44] "0"
#> [45] ""
#> [46] "$SET end=120, delta=0.25"
#> [47] ""
#> [48] "$GLOBAL"
#> [49] "#define CP (CENT/VCi)"
#> [50] "#define INH (CP/(IC50+CP))"
#> [51] ""
#> [52] "typedef double localdouble;"
#> [53] ""
#> [54] "$MAIN"
#> [55] "F_GUT = F1;"
#> [56] "D_CENT = D1;"
#> [57] ""
#> [58] "double CLi = exp(log(CL) + WTCL*log(WT/70) + log(SEXCL)*SEX + ECL);"
#> [59] "double VCi = exp(log(VC) + WTVC*log(WT/70) + log(SEXVC)*SEX + EVC);"
#> [60] "double KAi = exp(log(KA) + EKA);"
#> [61] "double KOUTi = exp(log(KOUT) + EKOUT);"
#> [62] ""
#> [63] "RESP_0 = KIN/KOUTi;"
#> [64] ""
#> [65] "$ODE"
#> [66] "dxdt_GUT = -KAi*GUT;"
#> [67] "dxdt_CENT = KAi*GUT - (CLi/VCi)*CENT;"
#> [68] "dxdt_RESP = KIN*(1-INH) - KOUTi*RESP;"
#> [69] ""
#> [70] "$TABLE"
#> [71] "double DV = CP*exp(EXPO);"
#> [72] ""
#> [73] "$CAPTURE @annotated"
#> [74] "DV: Dependent variable (ng/ml)"
#> [75] "CP: Plasma concentration (ng/ml)"
# Alternative
as.list(mod)$code
#> [1] "$PROB "
#> [2] ""
#> [3] "# `mrgsolve` housemodel"
#> [4] ""
#> [5] "This model is compiled with `mrgsolve`."
#> [6] ""
#> [7] " - Author: Metrum Research Group, LLC"
#> [8] " - Description: Generic indirect response PK/PD model"
#> [9] " - Covariates: Weight, female sex"
#> [10] " - Random effects: CL, VC, KA, KOUT"
#> [11] " - Error model: exponential"
#> [12] ""
#> [13] ""
#> [14] ""
#> [15] "$PLUGIN base"
#> [16] ""
#> [17] "$PARAM @annotated"
#> [18] "CL : 1 : Clearance (L/hr)"
#> [19] "VC : 20 : Volume of distribution (L)"
#> [20] "KA : 1.2 : Absorption rate constant (1/hr)"
#> [21] "F1 : 1.0 : Bioavailability fraction (.)"
#> [22] "D1 : 2.0 : Infusion duration (hr)"
#> [23] "WTCL : 0.75 : Exponent WT on CL"
#> [24] "WTVC : 1.00 : Exponent WT on VC"
#> [25] "SEXCL: 0.7 : Prop cov effect on CL"
#> [26] "SEXVC: 0.85 : Prop cov effect on VC"
#> [27] "KIN : 100 : Resp prod rate constant (1/hr)"
#> [28] "KOUT : 2 : Resp elim rate constant (1/hr)"
#> [29] "IC50 : 10 : Conc giving 50% max resp (ng/ml)"
#> [30] ""
#> [31] "$PARAM @annotated @covariates"
#> [32] "WT : 70 : Weight (kg)"
#> [33] "SEX : 0 : Covariate female sex"
#> [34] ""
#> [35] "$CMT @annotated"
#> [36] "GUT : Dosing compartment (mg)"
#> [37] "CENT : Central compartment (mg)"
#> [38] "RESP : Response (unitless)"
#> [39] ""
#> [40] "$OMEGA @labels ECL EVC EKA EKOUT"
#> [41] "0 0 0 0"
#> [42] ""
#> [43] "$SIGMA @labels EXPO"
#> [44] "0"
#> [45] ""
#> [46] "$SET end=120, delta=0.25"
#> [47] ""
#> [48] "$GLOBAL"
#> [49] "#define CP (CENT/VCi)"
#> [50] "#define INH (CP/(IC50+CP))"
#> [51] ""
#> [52] "typedef double localdouble;"
#> [53] ""
#> [54] "$MAIN"
#> [55] "F_GUT = F1;"
#> [56] "D_CENT = D1;"
#> [57] ""
#> [58] "double CLi = exp(log(CL) + WTCL*log(WT/70) + log(SEXCL)*SEX + ECL);"
#> [59] "double VCi = exp(log(VC) + WTVC*log(WT/70) + log(SEXVC)*SEX + EVC);"
#> [60] "double KAi = exp(log(KA) + EKA);"
#> [61] "double KOUTi = exp(log(KOUT) + EKOUT);"
#> [62] ""
#> [63] "RESP_0 = KIN/KOUTi;"
#> [64] ""
#> [65] "$ODE"
#> [66] "dxdt_GUT = -KAi*GUT;"
#> [67] "dxdt_CENT = KAi*GUT - (CLi/VCi)*CENT;"
#> [68] "dxdt_RESP = KIN*(1-INH) - KOUTi*RESP;"
#> [69] ""
#> [70] "$TABLE"
#> [71] "double DV = CP*exp(EXPO);"
#> [72] ""
#> [73] "$CAPTURE @annotated"
#> [74] "DV: Dependent variable (ng/ml)"
#> [75] "CP: Plasma concentration (ng/ml)"