test(){
# differential equations for the PK model
deriv(A1 = - Cl * C - Cl2 * (C - C2) - Cl3 * (C - C3))
deriv(A2 = Cl2 * (C - C2))
deriv(A3 = Cl3 * (C - C3))
# differential equation for Indirect Response model
deriv(E = Kin - Kout * (1 + Emax * C^gamma / (C^gamma + EC50^gamma)) * E)
# IV dose administration to central compartment
dosepoint(A1)
# concentrations in central and peripheral compartments
C = A1 / V
C2 = A2 / V2
C3 = A3 / V3
# baseline response R0
sequence{E = Kin / Kout}
# observed response with error model
error(EEps = 1)
observe(EObs = E + EEps)
# PK parameters as frozen fixed effects
fixef(V(freeze) = c(, 0.7633, ))
fixef(V2(freeze) = c(, 1.72876, ))
fixef(V3(freeze) = c(, 3.43857, ))
fixef(Cl(freeze) = c(, 6.2417, ))
fixef(Cl2(freeze) = c(, 5.4595, ))
fixef(Cl3(freeze) = c(, 0.85806, ))
# Indirect response parameters with initial estimates
fixef(Kin = c(, 48.4, ))
fixef(Kout = c(, 4.4, ))
fixef(Emax = c(, 4.5, ))
fixef(EC50 = c(, 350, ))
fixef(gamma = c(, 1, ))
}