## Simulate weight-based doses using covariate simulation

Post technical questions about making Pmetrics carry out a particular task.
njrhodes
Posts: 12
Joined: Fri Sep 12, 2014 1:03 pm

### Simulate weight-based doses using covariate simulation

Asked and answered.

To simulate the following four weight-based doses (e.g., 10, 15, 20, and 25 mg/kg) from a template data.csv file using a covariate simulation approach wherein the MCS engine selects covariate values from a unimodal distribution using the final model population parameters and covariate values stored in the final.xx and cov.xx objects, use the following SIMrun() scripting:

SIMrun(data="data.csv", model="model.txt", poppar=final.xx, nsim=1000, split=F, covariate=list(cov=cov.xx, limits=list(cov=c(40,120))), obsNoise=rep(0,4), predInt=0.5, limits=NA, include=c(1:4))

Where covariate=list(cov=cov.xx, limits=list(cov=c(40,120))) limits the MCS to values of the covariate cov between a minimum of 40 and a maximum of 120. This is a list within a list, as has been described in PMmanual().

The sim template data.csv file must have 10, 15, 20, and 25 listed as the doses for subjects 1:4 given at an interval XX for up to YY hours after the initial dose is given infused over DUR = ZZ. The model file would be the same as the final model file with the following adjustment (modified from: http://www.lapk.org/software/Pmetrics/Models/3C_1_D.txt):

#Dif
XP(1) = RATEIV(1)*cov - (Ke+KCP)*X(1) + KPC*X(2)
XP(2) = KCP*X(1) - KPC*X(2)

This tells the model file to apply the simulated weight for a given subject to the dose in the data.csv template in mg/kg and multiply in order to produce an exact weight-based dose in mg.

Parse the simulated file as you normally would:

Code: Select all

``simlist1 <- SIMparse("simout*.txt", include=c(1:4))``
If you wish to further compare an exposure measure, for example AUC0-24hr, across the range of simulated covariate values in the population, you can use the following scripting for makePTA(), just set the target and success ratio to 1 to avoid having to multiple or divide the results:

Code: Select all

``pta1 <- makePTA(simdata=simlist1, targets = 1, target.type="auc", success=1, start=0, end=24)``
Then extract the simulated covariate values from the simlist1 object

Code: Select all

``````sim1 <- lapply(simlist1, "[[", 3) # this pulls out the entire simulated parameters block
sim2 <- plyr::rbind.fill(sim1) # this transforms the data into the same format as the PTA analysis``````
Then insert the simulated values into the pta1 object as follows

Code: Select all

``````pta1\$results\$cov<- sim2\$cov #one can split the simulated covariate into increments of 10 using the following line
pta1\$results\$cov.cat<- cut(pta1\$results\$cov,seq(40,120,10),labels=c(1:8)) #cut produces values of class factor. To change values to class numeric, execute the following line
pta1\$results\$cov.cat<- as.numeric(pta1\$results\$cov.cat)``````
To plot the resulting AUCs as a function of the simulate cov values in a boxplot one executes:

Code: Select all

``````boxplot(pdi~cov.cat,
data=subset(pta1\$results, simnum == 1),
xlab="weight",
ylab="AUC[0-24hr]",
names=c("cat.1","cat.2","cat.3","cat.4","cat.5","cat.6", "cat.7","cat.8"),
col=c("dark grey", "light grey"),
boxwex = 0.25, at = 1:8,
main="AUC0-24hr for <Drug> dosed at 10 mg/kg every XX hours infused over ZZ according to cov.cat")``````