test(){
## PK Model ##
deriv(Aa = - Ka * Aa)
deriv(A1 = Ka * Aa - Ke * A1)
C = A1 / V
dosepoint(Aa, tlag=Tlag, idosevar = AaDose)
## PD Model
psi = 20 # switch
E = E1 + E2 + E3 + E4 # tumor volume is sum of tumor volumes from all compartments
Inh = (1 + (lambda0*E/lambda1)^psi)^(1/psi) # inhibition function - denominator part
deriv(E1 = (lambda0 * E1 / Inh) - k2 * C * E1) # de for compartment of proliferating cells
deriv(E2 = k2 * C * E1 - k1 * E2) # de for first transit compartment of damaged cells
deriv(E3 = k1 * (E2 - E3)) # de for second transit compartment
deriv(E4 = k1 * (E3 - E4)) # de for third transit compartment
sequence{E1= E0} # initialize tumor
error(EEps = 1) # residual error initially set to 1
observe(EObs = E + EEps) # additive residual error model for effect
## secondary parameters
secondary(Eth=lambda1/lambda0) # threshold tumor volume
secondary(Ct=lambda0/k2) # threshold concentration for tumor eradication
deriv(AUC=C) # calculating drug exposure (AUC)
secondary(TEI=(k2*AUC)/lambda0) # time efficacy index
## fixed effects for PK model - all frozen ##
fixef(Ka(freeze) = c(, 4.0488, ))
fixef(V(freeze) = c(, 2.561, ))
fixef(Ke(freeze) = c(, 0.1439, ))
fixef(Tlag(freeze) = c(, 0.8454, ))
## fixed effects for PD model ##
fixef(lambda0 = c(,0.05,)) # first-order rate constant of tumor growth
fixef(lambda1 = c(,3,)) # zero-order rate constant of tumor growth
fixef(E0 = c(,340,)) # tumor volume at inoculation time
fixef(k1 = c(,0.04,)) # transit rate constant
fixef(k2 = c(,0.4,)) # decay rate constant
}