I need help to write a user model. The question is relatively simple. I have 3 different PK profiles, each of one at different doses (2,10 and 50). I want to fit a one comparment oral absorption model (cfMicro(A1, Ke, first = (Aa = Ka))) to those three profiles simultaneously. From the three parameters to be estimated in this model, V, Ke and Ka, I want to estimate the same V and Ke for all doses, but change Ka for the different doses. Note, I already know how to set up a model that calculates all the three parameters for all doses simultaneously , and it works in my computer. The question is, how to write the model when you want just one of the parameters to change with dose. I thought that in order to do that, I would have to introduce a covariate with the dose value and define three Ka parameters, one for each dose. I called my covariate RegimenBID, which has the values 2,10 or 50 and wrote the following code below, but for some reason it doesn’t work. Could anybody help? test(){ covariate(RegimenBID) Ka=Ka1(RegimenBID==2) + Ka2(RegimenBID==10)+ Ka3(RegimenBID==50) cfMicro(A1, Ke, first = (Aa = Ka)) dosepoint(Aa) C = A1 / V error(CEps = 1) observe(CObs = C + CEps) stparm(Ka1 = tvKa1 * exp(nKa1)) stparm(Ka2 = tvKa2 * exp(nKa2)) stparm(Ka3 = tvKa3 * exp(nKa3)) stparm(V = tvV * exp(nV)) stparm(Ke = tvKe * exp(nKe)) fixef(tvKa1 = c(, 5.45255, )) fixef(tvKa2 = c(, 5.45255, )) fixef(tvKa3 = c(, 5.45255, )) fixef(tvV = c(, 1.37032, )) fixef(tvKe = c(, 0.11487, )) ranef(diag(nV, nKe, nKa1, nKa2, nKa3) = c(1, 1, 1, 1, 1))}
You’ve almost got it. You only need to put a multiply sign after the Ka values: Ka=Ka1*(RegimenBID==2) + Ka2*(RegimenBID==10)+ Ka3*(RegimenBID==50) Text that is followed directly by a parenthesis is interpreted as a function call, e.g. log(x) In the error logs, you will see references like, “unable to resolve external symbol ‘Ka1’”, meaning you are calling a function Ka1, but the linker can’t find one by that name to use.