Open amitvtaneja opened 6 years ago
Dear Amit:
In your example, the 0.09 and 0.25 are the Omegas for the CL and V2, while the 0.08 & 0.08 are the covariance between the two. Note that this is the FULL symmetric matrix. In NONMEM, it only outputs the lower half. In NONMEM, this same matrix would be denoted: $OMEGA BLOCK(2) 0.09 0.08 0.25
Wenping
On Tue, Mar 20, 2018 at 2:07 PM, amitvtaneja notifications@github.com wrote:
Dear Wenping
My query is with reference to the example presented in CPT:PSP Nov 2015 for simulating with variability. In the following example, the 0.09 and 0.08 are the Omegas for the CL and V2, while the 0.08 is the covariance between the two. In this case what is 0.25?
sigma <‐ matrix(c(0.09,0.08,0.08,0.25),2,2) Perhaps you could show how the covariance matrix in NONMEM is structured in this case?
Thanks in advance
Amit Taneja
— 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/19, or mute the thread https://github.com/notifications/unsubscribe-auth/AMdZdvFI3DGoPL-V1Ai5xiyW57pUlaC5ks5tgUV4gaJpZM4SyZLA .
Dear Wenping
I tried implementing 2 models with variability. In the first case I used a dataframe of parameters which was output by NONMEM(patab file). In this case, there is also a difference between using the loop and apply for looping thru individual parameters
In the second case I simulated the parameters from the variance covariance matrix. In both cases, however I get an error. Hereby the respective models with the respective error messages. I do hope you will be able to advise me in this matter. Thanking you in advance
Amit
ode.pk2222 <- "
d/dt(A1) =-K12A1; d/dt(A2) = K12A1 + K32A3 - (K20+K23)A2; d/dt(A3) = K23A2 - K32A3; "
evtab <- eventTable(amount.units="mg", time.units = "hours") ;#evtab$add.dosing(dose=params$DOSE*params$IF1,dosing.interval=24,nbr.doses=84,start.time=0.43)
evtab$add.dosing(dose=unique(params[params$DOSE==50,]$DOSE)mean(params[params$DOSE==50,]$IF1),dosing.interval=24,nbr.doses=84,start.time=0.43) evtab$add.sampling(8324+seq(0,24,l=101))
params[params$DOSE==50,]->p50 ;# empty parameter matrix for storing results res50<-NULL nsub<-32
for (i in 1:nsub) {
param50<-p50[i,]
x<-rxode.model$solve(param50,evtab,rep(0,3) )
res50<-cbind(res,x[,'A2']) }
;## ERROR MESSAGE
;# arguments imply differing number of rows: 1999, 101
;# In rxInits(dll, inits, state, 0) : Assumed order of inputs: A1, A2, A3
;## Use of apply results in a 'strange' output
x<-apply(p50,1,function(th)rxode.model$run(th,evtab,rep(0,3)))
cbind(res50,x)->res50
;### on console
;## Reallocating to 64/128/256
;### output matrix x
;# dim(x)
;## the first few lines of the dataframe of individual parameters
head(p50)
#####################################model 2#####################################
m1 <- RxODE(model = ode)
;# create dosing and observation (sampling) events ;# QD (once daily) dosing, 5 days
qd <- eventTable(amount.units="umg", time.units = "hours") qd$add.dosing(dose=10000, nbr.doses=5, dosing.interval = 168)
qd$add.sampling(seq(from=0, to=2600, by=0.1) )
;# nbr.doses = 2*5, ;# dosing.interval = 12)
;# n subproblems
nsub<-1000 # 1000 subproblems ;# Cl,V2 sigma1<-matrix(c(0.0655334,0,0,0.020843),2,2)
sigma2<-matrix(c(0,0,0,0.077613),2,2) ;# KIn, Kout sigma3<-matrix(c(0,0,0,0.167372),2,2)
;# sample from the covariance matrix mvrnorm(n=nsub,rep(0,2),sigma1)->mv1 mvrnorm(n=nsub,rep(0,2),sigma2)->mv2 mvrnorm(n=nsub,rep(0,2),sigma3)->mv3
params<-cbind(CL=0.19, V2=51.28, Q=0.23, V3=28.69, Kin=0.0007727.09, Kout=0.00077, EC50=5.160.147)
ICL<-params[1]exp(mv1[,1]) IV2<-params[2]exp(mv1[,2]) IQ<-params[3]exp(mv2[,1]) IV3<-params[4]exp(mv2[,2]) IKin<-params[5]exp(mv3[,1]) IKout<-params[6]exp(mv3[,2]) EC50<-rep(params[7],nsub)
params.all<-cbind(CL=ICL,V2=IV2,V3=IV3,Q=IQ,Kin=IKin,Kout=IKout,EC50=EC50) res<-NULL
;## loop thru each row of parameter values
for (i in 1:nsub){
params<-params.all[i,] x<-m1$solve(params,qd,inits=c(0,0,27.09))
res<-cbind(res,x) }
res<-apply(params.all,1,function(theta)m1$run(theta,qd,inits = c(0,0,27.09)))
;## consistent with use of both the loop and the apply function
;# Tried both LSODA and DOP853, but could not solve the system.
;# In rxInits(dll, inits, state, 0) :
Dear Wenping
My query is with reference to the example presented in CPT:PSP Nov 2015 for simulating with variability. In the following example, the 0.09 and 0.08 are the Omegas for the CL and V2, while the 0.08 is the covariance between the two. In this case what is 0.25?
sigma <‐ matrix(c(0.09,0.08,0.08,0.25),2,2) Perhaps you could show how the covariance matrix in NONMEM is structured in this case?
Thanks in advance
Amit Taneja