Hi Lance additional info :
To be able to add bioavail you need to be in graphical or textual model:
In Graphical mode:
Click on absorption compartment Aa.
Click the bioavail check box chose a name for the F parameter e.g. FREL
Insert a parameter and name it FREL
Choose to add the OCC variable as a covariate and define it as an occasion variable
Of course if you are familiar with textual mode you can just go to the model text and edit as you like:
test(){
deriv(A1 = - (Cl * C) + (Aa * Ka))
deriv(Aa = - (Aa * Ka))
C = A1 / V
dosepoint(Aa, bioavail = (FREL), idosevar = AaDose, infdosevar = AaInfDose, infratevar = AaInfRate)
error(CEps = 1)
observe(CObs = C + CEps)
stparm(V = tvV * exp(nV))
stparm(Cl = tvCl * exp(nCl))
stparm(Ka = tvKa * exp(nKa))
stparm(FREL = tvFREL * exp(nFREL + nFRELx0*(OCC==0) + nFRELx1*(OCC==1) + nFRELx2*(OCC==2)))
fcovariate(OCC)
fixef(tvV = c(, 1, ))
fixef(tvCl = c(, 1, ))
fixef(tvKa = c(, 1, ))
fixef(tvFREL = c(, 1, ))
ranef(diag(nV, nCl, nKa, nFREL) = c(1, 1, 1, 1))
ranef(diag(nFRELx0) = c(1), same(nFRELx1), same(nFRELx2))
}
Note how all the occasion random effect have the same variance as show on the last line
Also
FREL = tvFREL * exp(nFREL + nFRELx0*(OCC==0) + nFRELx1*(OCC==1) + nFRELx2*(OCC==2)))
Does not ensure that your F is between 0-1 ( this is fine if we are in relative F if you are modeling absolute F versus IV you might want to : use an ilogit of the expression:
stparm(FREL = ilogit(tvFREL + nFREL + nFRELx0*(OCC==0) + nFRELx1*(OCC==1) + nFRELx2*(OCC==2)))
And as Serge pointed out you data need to be built correctly for the software to understand well the transition between the occasions.
The bug that has been fixed is that the software set up the covariate value after the obsercation
ID Time Cobs OCC
1 0 . 1
1 12 1 .2 1
1 24 2.1 2
with fcovariate the occasion value 1 from time 12 to time 24 since we have a Cobs=2.1 at 24 it is still applying the OCC=1 at this obs and then it switches occasion to 2.
if you want obs 2.1 to be treated as occ 2 you have to set the covariate to 2 before the observation
ID Time Cobs OCC
1 0 . 1
1 12 1 .2 1
1 24 2
1 24 2.1 2