Posted 16 June 2014 - 12:19 PM

Hi Simon,

I should have attached the updated project file..as I did fix those syntax errors.

Here is a copy of the code. In a previous set of postings Serge Guzy suggested that one could simulate a distribution of body weights in the model code, thus simplifying the input template worksheet.

So I was attempting to integrate this into the simulation.

Another question I have is if the dose is to be a ug/kg then should all the fixed effect typical values be normalized (where applicable) by body weight as well, or is there a means of coding this in the text?

I can get it to work as a built-in model when I use R to generate my weight distribution and include it in the simulation template worksheet but would like to be able to do this in 1 step instead of 2 and Serge suggested it was possible.

So the dose is 3 mg/kg (3000 ug/kg since my CObs is ug) and duration of infusion is 1.5 hours as a fixed infusion time.

test(){

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

urinecpt(A0 = (Cl * C))

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

C = A1 / V

dosepoint(A1, duration = (1.5), idosevar = A1Dose, infdosevar = A1InfDose, infratevar = A1InfRate)

error(CEps = 1)

observe(CObs = C + CEps * (1 + C * CMixRatio))

stparm(V = tvV * (Weight/median(Weight))^dVdWeight * (1+dVdGender0*(Gender==0)) * exp(nV))

stparm(Cl = tvCl * (Weight/median(Weight))^dCldWeight * (1+dCldGender0*(Gender==0)) * exp(nCl))

stparm(K12 = tvK12)

stparm(K21 = tvK21)

stparm(CMixRatio = tvCMixRatio)

covariate(Gender())

stparm(Weight=tvWeight*exp(nWeight)) #here I am attempting to define Weight as a distribution with a mean of 70 kg and CV of 30%.

fixef(tvWeight= c(,70,))

ranef(diag(nWeight)=c(0.09))

fixef(tvV = c(, 2660, ))

fixef(tvCl = c(, 8.625, ))

fixef(tvK12 = c(, 0.00929, ))

fixef(tvK21 = c(, 0.00896, ))

fixef(tvCMixRatio = c(, 0.0236, ))

fixef(dVdGender0(enable=1) = c(, 0.221, )) # can I delete this "enable=..."?

fixef(dCldGender0(enable=2) = c(, 0.207, ))

fixef(dVdWeight(enable=4) = c(, 0.411, ))

fixef(dCldWeight(enable=8) = c(, 0.368, ))

ranef(diag(nV, nCl) = c(0.0676, 0.0282))

}