hallowkm / RxODE

RxODE is an R package that facilitates easy simulations in R
20 stars 13 forks source link

Problem in running RxODE #6

Closed RajuKadam closed 8 years ago

RajuKadam commented 8 years ago

Hi There, First I would like to thank you for developing such wonderful R package for pharmacometricians.

I was trying to use RxODE package for PK simulation but facing a problem. I downloaded the package using CRAN and trying to run the test run but getting following error message. Could you please assist me in troubleshooting this problem.

m1 <- RxODE(model = ode, modName = "m1", wd = getwd()) C:/PROGRA~1/R/R-32~1.2/etc/x64/Makeconf:204: warning: overriding commands for target .m.o' C:/PROGRA~1/R/R-32~1.2/etc/x64/Makeconf:197: warning: ignoring old commands for target.m.o' gcc -m64 -I"C:/PROGRA~1/R/R-32~1.2/include" -DNDEBUG -IC:/Users/KADAMR05/DOCUME~1/R/WIN-LI~1/3.2/RxODE/include -I"d:/RCompile/r-compiling/local/local320/include" -O2 -Wall -std=gnu99 -mtune=core2 -c C:/Users/KADAMR05/DOCUME~1/m1.d/m1.c -o C:/Users/KADAMR05/DOCUME~1/m1.d/m1.o C:/Users/KADAMR05/DOCUME~1/m1.d/m1.c:1: sorry, unimplemented: 64-bit mode not compiled in C:/Users/KADAMR05/DOCUME~1/m1.d/m1.c:1: fatal error: math.h: No such file or directory compilation terminated. make: *\ [C:/Users/KADAMR05/DOCUME~1/m1.d/m1.o] Error 1 Warning message: running command 'make -f "Makevars" -f "C:/PROGRA~1/R/R-32~1.2/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-32~1.2/share/make/winshlib.mk" SHLIB="C:/Users/KADAMR05/DOCUME~1/m1.d/m1.dll" PKG_LIBS='-LC:/Users/KADAMR05/DOCUME~1/R/WIN-LI~1/3.2/RxODE/libs/x64 -lodeaux -lRblas -lgfortran' WIN=64 TCLBIN=64 OBJECTS="C:/Users/KADAMR05/DOCUME~1/m1.d/m1.o C:/Users/KADAMR05/DOCUME~1/m1.d/call_dvode.o"' had status 2 Error in cmpMgr$compile() : error loading dll file C:/Users/KADAMR05/DOCUME~1/m1.d/m1.dll In addition: Warning message: running command 'C:/PROGRA~1/R/R-32~1.2/bin/R CMD SHLIB C:/Users/KADAMR05/DOCUME~1/m1.d/m1.c C:/Users/KADAMR05/DOCUME~1/m1.d/call_dvode.o -LC:/Users/KADAMR05/DOCUME~1/R/WIN-LI~1/3.2/RxODE/libs/x64 -lodeaux -lRblas -lgfortran' had status 1

Thanks a lot for your help.

Best Regards, Raj

wwang-at-github commented 8 years ago

Raj:

could you tell me the versions of your R and Rtools? also, please provide your path environment variable (by type path on the command window).

Wenping

On Fri, Sep 2, 2016 at 1:56 PM, RajuKadam notifications@github.com wrote:

Hi There, First I would like to thank you for developing such wonderful R package for pharmacometricians.

I was trying to use RxODE package for PK simulation but facing a problem. I downloaded the package using CRAN and trying to run the test run but getting following error message. Could you please assist me in troubleshooting this problem.

m1 <- RxODE(model = ode, modName = "m1", wd = getwd()) C:/PROGRA~1/R/R-32~1.2/etc/x64/Makeconf:204: warning: overriding commands for target .m.o' C:/PROGRA~1/R/R-32~1.2/etc/x64/Makeconf:197: warning: ignoring old commands for target.m.o' gcc -m64 -I"C:/PROGRA~1/R/R-32~1.2/include" -DNDEBUG -IC:/Users/KADAMR05/DOCUME~1/R/WIN-LI~1/3.2/RxODE/include -I"d:/RCompile/r-compiling/local/local320/include" -O2 -Wall -std=gnu99 -mtune=core2 -c C:/Users/KADAMR05/DOCUME~1/m1.d/m1.c -o C:/Users/KADAMR05/DOCUME~1/m1.d/m1.o C:/Users/KADAMR05/DOCUME~1/m1.d/m1.c:1: sorry, unimplemented: 64-bit mode not compiled in C:/Users/KADAMR05/DOCUME~1/m1.d/m1.c:1: fatal error: math.h: No such file or directory compilation terminated. make: *\ [C:/Users/KADAMR05/DOCUME~1/m1.d/m1.o] Error 1 Warning message: running command 'make -f "Makevars" -f "C:/PROGRA~1/R/R-32~1.2/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-32~1.2/share/make/winshlib.mk" SHLIB="C:/Users/KADAMR05/DOCUME~1/m1.d/m1.dll" PKG_LIBS='-LC:/Users/KADAMR05/DOCUME~1/R/WIN-LI~1/3.2/RxODE/libs/x64 -lodeaux -lRblas -lgfortran' WIN=64 TCLBIN=64 OBJECTS="C:/Users/KADAMR05/DOCUME~1/m1.d/m1.o C:/Users/KADAMR05/DOCUME~1/m1.d/call_dvode.o"' had status 2 Error in cmpMgr$compile() : error loading dll file C:/Users/KADAMR05/DOCUME~1/m1.d/m1.dll In addition: Warning message: running command 'C:/PROGRA~1/R/R-32~1.2/bin/R CMD SHLIB C:/Users/KADAMR05/DOCUME~1/m1.d/m1.c C:/Users/KADAMR05/DOCUME~1/m1.d/call_dvode.o -LC:/Users/KADAMR05/DOCUME~1/R/WIN-LI~1/3.2/RxODE/libs/x64 -lodeaux -lRblas -lgfortran' had status 1

Thanks a lot for your help.

Best Regards, Raj

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hallowkm/RxODE/issues/6, or mute the thread https://github.com/notifications/unsubscribe-auth/AMdZdrWmWSM8tYyo_ay2av1a22hwfKd3ks5qmGNagaJpZM4Jz8c- .

RajuKadam commented 8 years ago

Hi Wenping,

Thanks for your prompt reply. I am able to troubleshoot the problem.

I haven't had Rtools downloaded on my system and that was creating the problem.

Once I downloaded Rtools, I am able to run the simulations and getting all expected outputs without any problems.

Again thank you very much for development of such wonderful R package and your help.

Best Regards, Raj kadam

On Sun, Sep 4, 2016 at 5:52 PM, wwang-at-github notifications@github.com wrote:

Raj:

could you tell me the versions of your R and Rtools? also, please provide your path environment variable (by type path on the command window).

Wenping

On Fri, Sep 2, 2016 at 1:56 PM, RajuKadam notifications@github.com wrote:

Hi There, First I would like to thank you for developing such wonderful R package for pharmacometricians.

I was trying to use RxODE package for PK simulation but facing a problem. I downloaded the package using CRAN and trying to run the test run but getting following error message. Could you please assist me in troubleshooting this problem.

m1 <- RxODE(model = ode, modName = "m1", wd = getwd()) C:/PROGRA~1/R/R-32~1.2/etc/x64/Makeconf:204: warning: overriding commands for target .m.o' C:/PROGRA~1/R/R-32~1.2/etc/x64/Makeconf:197: warning: ignoring old commands for target.m.o' gcc -m64 -I"C:/PROGRA~1/R/R-32~1.2/include" -DNDEBUG -IC:/Users/KADAMR05/DOCUME~1/R/WIN-LI~1/3.2/RxODE/include -I"d:/RCompile/r-compiling/local/local320/include" -O2 -Wall -std=gnu99 -mtune=core2 -c C:/Users/KADAMR05/DOCUME~1/m1.d/m1.c -o C:/Users/KADAMR05/DOCUME~1/m1.d/m1.o C:/Users/KADAMR05/DOCUME~1/m1.d/m1.c:1: sorry, unimplemented: 64-bit mode not compiled in C:/Users/KADAMR05/DOCUME~1/m1.d/m1.c:1: fatal error: math.h: No such file or directory compilation terminated. make: *\ [C:/Users/KADAMR05/DOCUME~1/m1.d/m1.o] Error 1 Warning message: running command 'make -f "Makevars" -f "C:/PROGRA~1/R/R-32~1.2/etc/ x64/Makeconf" -f "C:/PROGRA~1/R/R-32~1.2/share/make/winshlib.mk" SHLIB="C:/Users/KADAMR05/DOCUME~1/m1.d/m1.dll" PKG_LIBS='-LC:/Users/KADAMR05/DOCUME~1/R/WIN-LI~1/3.2/RxODE/libs/x64 -lodeaux -lRblas -lgfortran' WIN=64 TCLBIN=64 OBJECTS="C:/Users/KADAMR05/ DOCUME~1/m1.d/m1.o C:/Users/KADAMR05/DOCUME~1/m1.d/call_dvode.o"' had status 2 Error in cmpMgr$compile() : error loading dll file C:/Users/KADAMR05/DOCUME~1/m1.d/m1.dll In addition: Warning message: running command 'C:/PROGRA~1/R/R-32~1.2/bin/R CMD SHLIB C:/Users/KADAMR05/DOCUME~1/m1.d/m1.c C:/Users/KADAMR05/DOCUME~1/m1. d/call_dvode.o -LC:/Users/KADAMR05/DOCUME~1/R/WIN-LI~1/3.2/RxODE/libs/x64 -lodeaux -lRblas -lgfortran' had status 1

Thanks a lot for your help.

Best Regards, Raj

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hallowkm/RxODE/issues/6, or mute the thread https://github.com/notifications/unsubscribe-auth/AMdZdrWmWSM8tYyo_ ay2av1a22hwfKd3ks5qmGNagaJpZM4Jz8c- .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hallowkm/RxODE/issues/6#issuecomment-244630842, or mute the thread https://github.com/notifications/unsubscribe-auth/AIkoOQ3bx1rm3fjk7sS27xhV79h-q9tEks5qmz2SgaJpZM4Jz8c- .

RajuKadam commented 8 years ago

Hi,

I am trying to simulate the PK profile for drug-X with variability on PK parameters and covariates (Age and Wt).

Dosing for the Drug-X is body weight normalized (mg/kg).

I am trying to use the WT calculated using mean weight and CV to estimate the body weight normalized dose in dosing events.

When I simulate the PK profile for 100 subjects, my plasma concentrations are getting multiplied by 100 and if I simulate for 1000 subjects plasma concentrations are getting multiplied by 1000.

I am providing my RxODE code below. I think I need to specify the dose somewhere in loop but not able to figure out how to edit the code.

Could you please help in trouble shooting my problem.

Step 1 - Create a model specification (Create ODE file)

ode <- "CL1 = CL_(0.693AGE/(2.4+AGE)+0.42)(WT/70)^0.75; TVV2 = V2(WT/70); TVV3 = V3(WT/70); Q1 = Q_(WT/70)^0.75; C2 = centr/TVV2; C3 = peri/TVV3; d/dt(depot) =-KA_depot; d/dt(centr) = KA_depot - CL1_C2 - Q1_C2 + Q1_C3; d/dt(peri) = Q1_C2 - Q1*C3;"

cmt2 <- RxODE(model = ode, modName = "cmt2", wd = getwd())

Perform simulation 1000 times with variability

nsub <- 1000 CL <- 6.32_exp(rnorm(nsub,0,.569^2)) V2 <- 42.9_exp(rnorm(nsub,0,.693^2)) V3 <- 56.5_exp(rnorm(nsub,0,.521^2)) Q <- 44.4_exp(rnorm(nsub,0,.807^2)) KA <- 0.447_exp(rnorm(nsub,0,.952^2)) AGE <- 3.8_exp(rnorm(nsub,0,.342^2)) WT <- 15.3*exp(rnorm(nsub,0,.207^2))

theta.all <- cbind(KA=KA, CL=CL, V2=V2, # central Q=Q, V3=V3, # peripheral WT=WT, AGE= AGE) # Covariates

inits <- c(depot=0, centr=0, peri=0)

######################Simulate dosing ########

ev <- eventTable(amount.units='mg', time.units='hours')

Specify Day 1 dosing (3mg/kg)

ev$add.dosing(dose = 3*WT, nbr.doses = 1, dosing.interval = 24)

Add Day-2 and 3 dosing (2mg/kg)

ev$add.dosing(dose = 2_WT, nbr.doses = 1, dosing.interval = 24, start.time = 24) ev$add.dosing(dose = 2_WT, nbr.doses = 1, dosing.interval = 24, start.time = 48)

Specify sampling

ev$add.sampling(0:96)

res <- NULL #Create an empty matrix for storing results

Loop through each row of parameter values and simulate

for (i in 1:nsub) { params <- theta.all[i,] x <- cmt2$run(params, ev, inits = inits) res <- cbind(res,x[,"C2"]) }

Calculate and plot quantiles

res.q.t <- apply(res, 1, quantile, prob = c(.05, .5, .95)) matplot(t(res.q.t), type = "l", lty = c(2,1,2), col = c(2,1,2), ylab = "Aprepitant Conc (ug/mL)", xlab = "Time (hrs)") legend("topright", c("median","5 and 95%"), lty = c(1,2), col = c("black","red"), cex = .8)

Thanks in advance for your help in this regards.

Best Regards, Raj

wwang-at-github commented 7 years ago

Hi Raj:

you may find this attached example relevant.

Best, Wenping

On Thu, Sep 22, 2016 at 6:16 PM, RajuKadam notifications@github.com wrote:

Hi,

I am trying to simulate the PK profile for drug-X with variability on PK parameters and covariates (Age and Wt).

Dosing for the Drug-X is body weight normalized (mg/kg).

I am trying to use the WT calculated using mean weight and CV to estimate the body weight normalized dose in dosing events.

When I simulate the PK profile for 100 subjects, my plasma concentrations are getting multiplied by 100 and if I simulate for 1000 subjects plasma concentrations are getting multiplied by 1000.

I am providing my RxODE code below. I think I need to specify the dose somewhere in loop but not able to figure out how to edit the code.

Could you please help in trouble shooting my problem.

Step 1 - Create a model specification (Create ODE file)

ode <- "CL1 = CL_(0.693AGE/(2.4+AGE)+0.42)(WT/70)^0.75; TVV2 = V2(WT/70); TVV3 = V3(WT/70); Q1 = Q_(WT/70)^0.75; C2 = centr/TVV2; C3 = peri/TVV3; d/dt(depot) =-KA_depot; d/dt(centr) = KA_depot - CL1_C2 - Q1_C2 + Q1_C3; d/dt(peri) = Q1_C2 - Q1*C3;"

cmt2 <- RxODE(model = ode, modName = "cmt2", wd = getwd())

Perform simulation 1000 times with variability

nsub <- 1000 CL <- 6.32_exp(rnorm(nsub,0,.569^2)) V2 <- 42.9_exp(rnorm(nsub,0,.693^2)) V3 <- 56.5_exp(rnorm(nsub,0,.521^2)) Q <- 44.4_exp(rnorm(nsub,0,.807^2)) KA <- 0.447_exp(rnorm(nsub,0,.952^2)) AGE <- 3.8_exp(rnorm(nsub,0,.342^2)) WT <- 15.3*exp(rnorm(nsub,0,.207^2))

theta.all <- cbind(KA=KA, CL=CL, V2=V2, # central Q=Q, V3=V3, # peripheral WT=WT, AGE= AGE) # Covariates

inits <- c(depot=0, centr=0, peri=0)

######################Simulate dosing ########

ev <- eventTable(amount.units='mg', time.units='hours')

Specify Day 1 dosing (3mg/kg)

ev$add.dosing(dose = 3*WT, nbr.doses = 1, dosing.interval = 24)

Add Day-2 and 3 dosing (2mg/kg)

ev$add.dosing(dose = 2_WT, nbr.doses = 1, dosing.interval = 24, start.time = 24) ev$add.dosing(dose = 2_WT, nbr.doses = 1, dosing.interval = 24, start.time = 48)

Specify sampling

ev$add.sampling(0:96)

res <- NULL #Create an empty matrix for storing results

Loop through each row of parameter values and simulate

for (i in 1:nsub) { params <- theta.all[i,] x <- cmt2$run(params, ev, inits = inits) res <- cbind(res,x[,"C2"]) }

Calculate and plot quantiles

res.q.t <- apply(res, 1, quantile, prob = c(.05, .5, .95)) matplot(t(res.q.t), type = "l", lty = c(2,1,2), col = c(2,1,2), ylab = "Aprepitant Conc (ug/mL)", xlab = "Time (hrs)") legend("topright", c("median","5 and 95%"), lty = c(1,2), col = c("black","red"), cex = .8)

Thanks in advance for your help in this regards.

Best Regards, Raj

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/hallowkm/RxODE/issues/6#issuecomment-249044173, or mute the thread https://github.com/notifications/unsubscribe-auth/AMdZdgX3AlMtAbXXD00dI_01po0luK17ks5qsv4ggaJpZM4Jz8c- .

RajuKadam commented 7 years ago

Hi Wenping,

I am not able to find the attachment. Could you please resend the attachment.

Thanks a lot for your help.

Best Regards, Raj

On Thu, Sep 29, 2016 at 10:16 AM, wwang-at-github notifications@github.com wrote:

Hi Raj:

you may find this attached example relevant.

Best, Wenping

On Thu, Sep 22, 2016 at 6:16 PM, RajuKadam notifications@github.com wrote:

Hi,

I am trying to simulate the PK profile for drug-X with variability on PK parameters and covariates (Age and Wt).

Dosing for the Drug-X is body weight normalized (mg/kg).

I am trying to use the WT calculated using mean weight and CV to estimate the body weight normalized dose in dosing events.

When I simulate the PK profile for 100 subjects, my plasma concentrations are getting multiplied by 100 and if I simulate for 1000 subjects plasma concentrations are getting multiplied by 1000.

I am providing my RxODE code below. I think I need to specify the dose somewhere in loop but not able to figure out how to edit the code.

Could you please help in trouble shooting my problem.

Step 1 - Create a model specification (Create ODE file)

ode <- "CL1 = CL_(0.693AGE/(2.4+AGE)+0.42)(WT/70)^0.75; TVV2 = V2(WT/70); TVV3 = V3(WT/70); Q1 = Q_(WT/70)^0.75; C2 = centr/TVV2; C3 = peri/TVV3; d/dt(depot) =-KA_depot; d/dt(centr) = KA_depot - CL1_C2 - Q1_C2 + Q1_C3; d/dt(peri) = Q1_C2 - Q1*C3;"

cmt2 <- RxODE(model = ode, modName = "cmt2", wd = getwd())

Perform simulation 1000 times with variability

nsub <- 1000 CL <- 6.32_exp(rnorm(nsub,0,.569^2)) V2 <- 42.9_exp(rnorm(nsub,0,.693^2)) V3 <- 56.5_exp(rnorm(nsub,0,.521^2)) Q <- 44.4_exp(rnorm(nsub,0,.807^2)) KA <- 0.447_exp(rnorm(nsub,0,.952^2)) AGE <- 3.8_exp(rnorm(nsub,0,.342^2)) WT <- 15.3*exp(rnorm(nsub,0,.207^2))

theta.all <- cbind(KA=KA, CL=CL, V2=V2, # central Q=Q, V3=V3, # peripheral WT=WT, AGE= AGE) # Covariates

inits <- c(depot=0, centr=0, peri=0)

######################Simulate dosing ########

ev <- eventTable(amount.units='mg', time.units='hours')

Specify Day 1 dosing (3mg/kg)

ev$add.dosing(dose = 3*WT, nbr.doses = 1, dosing.interval = 24)

Add Day-2 and 3 dosing (2mg/kg)

ev$add.dosing(dose = 2_WT, nbr.doses = 1, dosing.interval = 24, start.time = 24) ev$add.dosing(dose = 2_WT, nbr.doses = 1, dosing.interval = 24, start.time = 48)

Specify sampling

ev$add.sampling(0:96)

res <- NULL #Create an empty matrix for storing results

Loop through each row of parameter values and simulate

for (i in 1:nsub) { params <- theta.all[i,] x <- cmt2$run(params, ev, inits = inits) res <- cbind(res,x[,"C2"]) }

Calculate and plot quantiles

res.q.t <- apply(res, 1, quantile, prob = c(.05, .5, .95)) matplot(t(res.q.t), type = "l", lty = c(2,1,2), col = c(2,1,2), ylab = "Aprepitant Conc (ug/mL)", xlab = "Time (hrs)") legend("topright", c("median","5 and 95%"), lty = c(1,2), col = c("black","red"), cex = .8)

Thanks in advance for your help in this regards.

Best Regards, Raj

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/hallowkm/RxODE/issues/6#issuecomment-249044173, or mute the thread https://github.com/notifications/unsubscribe- auth/AMdZdgX3AlMtAbXXD00dI_01po0luK17ks5qsv4ggaJpZM4Jz8c- .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hallowkm/RxODE/issues/6#issuecomment-250478688, or mute the thread https://github.com/notifications/unsubscribe-auth/AIkoOZaOKz5qaSBkIcEwzzkujiHGT-AIks5qu8gmgaJpZM4Jz8c- .

wwang-at-github commented 7 years ago

library(RxODE) ode <- " C2 = centr/V2; C3 = peri/V3; d/dt(depot) =-KA_depot; d/dt(centr) = KA_depot - CL_C2 - Q_C2 + Q_C3; d/dt(peri) = Q_C2 - QC3; d/dt(eff) = Kin - Kout(1-C2/(EC50+C2))*eff; " m3 <- RxODE(model = ode, modName = "m3")

system parameters

nsub=100 theta.all <- cbind(KA=2.94E-01, CL=1.86E+01*exp(rnorm(nsub,0,.1)), V2=4.02E+01, Q=1.05E+01, V3=2.97E+02, Kin=1, Kout=1, EC50=200, WT=rnorm(nsub, 70, 10))

init values

inits <- c(0, 0, 0, 1)

dosing & sampling

ev <- eventTable() ev$add.dosing(dose=10000, nbr.doses=10, dosing.interval=12) ev$add.dosing(dose=20000, nbr.doses=5, start.time=120) ev$add.sampling(0:240)

ev$get.EventTable()

simu

obs.rec = ev$get.obs.rec() nobs = sum(obs.rec) cp.all = matrix(NA, nobs, nsub) for (i in 1:nsub) { print(i) theta = theta.all[i,]

dosing & sampling

ev <- eventTable() ev$add.dosing(dose=1000_theta["WT"], nbr.doses=10, dosing.interval=12) ev$add.dosing(dose=2000_theta["WT"], nbr.doses=5, start.time=120) ev$add.sampling(0:240)

x <- m3$run(theta, ev, inits=inits) cp.all[, i] = x[obs.rec, "C2"] } matplot(cp.all, type="l")

calc quantiles

cp.q = matrix(NA, nobs, 3) for (i in 1:nrow(cp.all)) { cp.q[i, ] = quantile(cp.all[i,], prob=c(.05, .5, .95)) } matplot(cp.q, type="l", lty=c(2,1,2), col=c(2,1,2))

short cut

cp.q.t = apply(cp.all, 1, quantile, prob=c(.05, .5, .95)) matplot(t(cp.q.t), type="l", lty=c(2,1,2), col=c(2,1,2))

On Thu, Sep 29, 2016 at 10:21 AM, RajuKadam notifications@github.com wrote:

Hi Wenping,

I am not able to find the attachment. Could you please resend the attachment.

Thanks a lot for your help.

Best Regards, Raj

On Thu, Sep 29, 2016 at 10:16 AM, wwang-at-github < notifications@github.com> wrote:

Hi Raj:

you may find this attached example relevant.

Best, Wenping

On Thu, Sep 22, 2016 at 6:16 PM, RajuKadam notifications@github.com wrote:

Hi,

I am trying to simulate the PK profile for drug-X with variability on PK parameters and covariates (Age and Wt).

Dosing for the Drug-X is body weight normalized (mg/kg).

I am trying to use the WT calculated using mean weight and CV to estimate the body weight normalized dose in dosing events.

When I simulate the PK profile for 100 subjects, my plasma concentrations are getting multiplied by 100 and if I simulate for 1000 subjects plasma concentrations are getting multiplied by 1000.

I am providing my RxODE code below. I think I need to specify the dose somewhere in loop but not able to figure out how to edit the code.

Could you please help in trouble shooting my problem.

Step 1 - Create a model specification (Create ODE file)

ode <- "CL1 = CL_(0.693AGE/(2.4+AGE)+0.42)(WT/70)^0.75; TVV2 = V2(WT/70); TVV3 = V3(WT/70); Q1 = Q_(WT/70)^0.75; C2 = centr/TVV2; C3 = peri/TVV3; d/dt(depot) =-KA_depot; d/dt(centr) = KA_depot - CL1_C2 - Q1_C2 + Q1_C3; d/dt(peri) = Q1_C2 - Q1*C3;"

cmt2 <- RxODE(model = ode, modName = "cmt2", wd = getwd())

Perform simulation 1000 times with variability

nsub <- 1000 CL <- 6.32_exp(rnorm(nsub,0,.569^2)) V2 <- 42.9_exp(rnorm(nsub,0,.693^2)) V3 <- 56.5_exp(rnorm(nsub,0,.521^2)) Q <- 44.4_exp(rnorm(nsub,0,.807^2)) KA <- 0.447_exp(rnorm(nsub,0,.952^2)) AGE <- 3.8_exp(rnorm(nsub,0,.342^2)) WT <- 15.3*exp(rnorm(nsub,0,.207^2))

theta.all <- cbind(KA=KA, CL=CL, V2=V2, # central Q=Q, V3=V3, # peripheral WT=WT, AGE= AGE) # Covariates

inits <- c(depot=0, centr=0, peri=0)

######################Simulate dosing ########

ev <- eventTable(amount.units='mg', time.units='hours')

Specify Day 1 dosing (3mg/kg)

ev$add.dosing(dose = 3*WT, nbr.doses = 1, dosing.interval = 24)

Add Day-2 and 3 dosing (2mg/kg)

ev$add.dosing(dose = 2_WT, nbr.doses = 1, dosing.interval = 24, start.time = 24) ev$add.dosing(dose = 2_WT, nbr.doses = 1, dosing.interval = 24, start.time = 48)

Specify sampling

ev$add.sampling(0:96)

res <- NULL #Create an empty matrix for storing results

Loop through each row of parameter values and simulate

for (i in 1:nsub) { params <- theta.all[i,] x <- cmt2$run(params, ev, inits = inits) res <- cbind(res,x[,"C2"]) }

Calculate and plot quantiles

res.q.t <- apply(res, 1, quantile, prob = c(.05, .5, .95)) matplot(t(res.q.t), type = "l", lty = c(2,1,2), col = c(2,1,2), ylab = "Aprepitant Conc (ug/mL)", xlab = "Time (hrs)") legend("topright", c("median","5 and 95%"), lty = c(1,2), col = c("black","red"), cex = .8)

Thanks in advance for your help in this regards.

Best Regards, Raj

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/hallowkm/RxODE/issues/6#issuecomment-249044173, or mute the thread https://github.com/notifications/unsubscribe- auth/AMdZdgX3AlMtAbXXD00dI_01po0luK17ks5qsv4ggaJpZM4Jz8c- .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hallowkm/RxODE/issues/6#issuecomment-250478688, or mute the thread https://github.com/notifications/unsubscribe-auth/ AIkoOZaOKz5qaSBkIcEwzzkujiHGT-AIks5qu8gmgaJpZM4Jz8c- .

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/hallowkm/RxODE/issues/6#issuecomment-250480413, or mute the thread https://github.com/notifications/unsubscribe-auth/AMdZdvqKNAfE0xHFIDD2xlNvtrPZuD51ks5qu8lzgaJpZM4Jz8c- .

RajuKadam commented 7 years ago

Hi Wenping,

Sorry to bother you again.

I tried to rerun the code you sent but I am getting following error message.

for (i in 1:nsub) { theta = theta.all[i,]

dosing & sampling

ev <- eventTable() ev$add.dosing(dose=1000_theta["WT"], nbr.doses=10, dosing.interval=12) ev$add.dosing(dose=2000_theta["WT"], nbr.doses=5, dosing.interval=12, start.time=120) ev$add.sampling(0:240)

x <- m3$run(theta, ev, inits=inits) cp.all[, i] = x[obs.rec, "C2"] } Error in x[obs.rec, "C2"] : (subscript) logical subscript too long In addition: Warning messages: 1: In data.frame(time = time, evid = wh, amt = dose) : row names were found from a short variable and have been discarded 2: In data.frame(time = time, evid = wh, amt = dose) : row names were found from a short variable and have been discarded

I am getting output in x but not in cp.all. I tried at my best to solve this problem but not able to get the output.

Best Regards, Raj

wwang-at-github commented 7 years ago

R library(RxODE) ode <- " C2 = centr/V2; C3 = peri/V3; d/dt(depot) =-KA_depot; d/dt(centr) = KA_depot - CL_C2 - Q_C2 + Q_C3; d/dt(peri) = Q_C2 - QC3; d/dt(eff) = Kin - Kout(1-C2/(EC50+C2))*eff; " m3 <- RxODE(model = ode, modName = "m3")

system parameters

nsub=100 theta.all <- cbind(KA=2.94E-01, CL=1.86E+01*exp(rnorm(nsub,0,.1)), V2=4.02E+01, Q=1.05E+01, V3=2.97E+02, Kin=1, Kout=1, EC50=200, WT=rnorm(nsub, 70, 10))

init values

inits <- c(0, 0, 0, 1)

dosing & sampling

ev <- eventTable() ev$add.dosing(dose=1000, nbr.doses=10, dosing.interval=12) ev$add.dosing(dose=2000, nbr.doses=5, dosing.interval=24, start.time=120) ev$add.sampling(0:240)

ev$get.EventTable()

simu

obs.rec = ev$get.obs.rec() nobs = sum(obs.rec) cp.all = matrix(NA, nobs, nsub) for (i in 1:nsub) { print(i) theta = theta.all[i,]

dosing & sampling

ev <- eventTable() ev$add.dosing(dose=1000_theta["WT"], nbr.doses=10, dosing.interval=12) ev$add.dosing(dose=2000_theta["WT"], nbr.doses=5, dosing.interval=24, start.time=120) ev$add.sampling(0:240)

x <- m3$run(theta, ev, inits=inits) cp.all[, i] = x[, "C2"] } matplot(cp.all, type="l")

calc quantiles

cp.q = matrix(NA, nobs, 3) for (i in 1:nrow(cp.all)) { cp.q[i, ] = quantile(cp.all[i,], prob=c(.05, .5, .95)) } matplot(cp.q, type="l", lty=c(2,1,2), col=c(2,1,2))

short cut

cp.q.t = apply(cp.all, 1, quantile, prob=c(.05, .5, .95)) matplot(t(cp.q.t), type="l", lty=c(2,1,2), col=c(2,1,2))

On Thu, Sep 29, 2016 at 2:20 PM, RajuKadam notifications@github.com wrote:

Hi Wenping,

Sorry to bother you again.

I tried to rerun the code you sent but I am getting following error message.

for (i in 1:nsub) { theta = theta.all[i,]

dosing & sampling

ev <- eventTable() ev$add.dosing(dose=1000 theta["WT"], nbr.doses=10, dosing.interval=12) ev$add.dosing(dose=2000 theta["WT"], nbr.doses=5, dosing.interval=12, start.time=120) ev$add.sampling(0:240)

x <- m3$run(theta, ev, inits=inits) cp.all[, i] = x[obs.rec, "C2"] } Error in x[obs.rec, "C2"] : (subscript) logical subscript too long In addition: Warning messages: 1: In data.frame(time = time, evid = wh, amt = dose) : row names were found from a short variable and have been discarded 2: In data.frame(time = time, evid = wh, amt = dose) : row names were found from a short variable and have been discarded

I am getting output in x but not in cp.all. I tried at my best to solve this problem but not able to get the output.

Best Regards, Raj

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/hallowkm/RxODE/issues/6#issuecomment-250549134, or mute the thread https://github.com/notifications/unsubscribe-auth/AMdZdiaYej6sg3HKC2gj13H04asBIRc8ks5qvAF6gaJpZM4Jz8c- .

RajuKadam commented 7 years ago

Dear Wenping,

Thanks a lot for your help. Code run perfectly and got the desired output.

Best Regards, Raj