Hi Sara,

You can also uncheck use closed form, and then edit as textual. This will give you the full PML model code and you can see the derivations of A, alpha, etc.

test(){

deriv(Aa = - Ka * Aa)

deriv(A1 = Ka * Aa - Ke * A1 - K12 * A1 + K21 * A2)

deriv(A2 = K12 * A1 - K21 * A2)

dosepoint(Aa, idosevar = AaDose)

C = A1 / V

error(CEps = 1)

observe(CObs = C + CEps)

stparm(Ka = tvKa * exp(nKa))

stparm(V = tvV * exp(nV))

stparm(Ke = tvKe * exp(nKe))

stparm(K12 = tvK12 * exp(nK12))

stparm(K21 = tvK21 * exp(nK21))

fixef(tvKa = c(, 1, ))

fixef(tvV = c(, 1, ))

fixef(tvKe = c(, 1, ))

fixef(tvK12 = c(, 1, ))

fixef(tvK21 = c(, 1, ))

secondary(Ktot = tvK12+tvK21+tvKe)

secondary(r1 = (Ktot^2-4*tvK21*tvKe)^0.5)

secondary(Alpha = (Ktot+r1)/2)

secondary(Beta = (Ktot-r1)/2)

secondary(Gamma = tvKa)

secondary(a1 = (tvK21-Alpha)/(Beta-Alpha))

secondary(b1 = (tvK21-Beta)/(Alpha-Beta))

secondary(KaAlpha = tvKa/(tvKa-Alpha))

secondary(KaBeta = tvKa/(tvKa-Beta))

secondary(aa = KaAlpha*a1)

secondary(bb = KaBeta*b1)

secondary(cc = -(aa+bb))

secondary(DoseOverVol = AaDose/tvV)

secondary(A = DoseOverVol*aa)

secondary(B = DoseOverVol*bb)

secondary(C = DoseOverVol*cc)

secondary(AUC = DoseOverVol/tvKe)

secondary(Cl = AaDose/AUC)

secondary(Alpha_hl = log(2)/Alpha)

secondary(Beta_hl = log(2)/Beta)

secondary(Tmax = CalcTMax(A,Alpha, B, Beta, C, Gamma))

secondary(Cmax = A*exp(-Alpha*Tmax)+B*exp(-Beta*Tmax)+C*exp(-Gamma*Tmax))

secondary(Ke_hl = log(2)/tvKe)

secondary(Ka_hl = log(2)/tvKa)

secondary(Cl2 = tvK12*tvV)

secondary(V2 = Cl2/tvK21)

ranef(diag(nV, nKa, nKe, nK12, nK21) = c(1, 1, 1, 1, 1))

}