ronkeizer / PKPDsim

R library for simulation of PKPD models [DEPRECATED, see InsightRX/PKPDsim]
Other
21 stars 12 forks source link

Error in code leading to long simulation time - issue closed. #41

Closed melmelie closed 5 years ago

melmelie commented 5 years ago

Hi Ron, This simple 2-CMT simulation is taking forever (> 6 hours at which point I give up). I don't see any reason for this, please advise. Thanks, Mohamed

Parameters

pv <- list(eta1 = 0, eta2 = 0, eta3 = 0, eta4 = 0, KA= 0.991, CL = 3.8, VC = 157, Q = 9.57, VP=263, ALAG = 0.242) # Slower CL/F

Dosing regimen

reg2 <- new_regimen(amt = 1000, interval = 24, n= 40)

Model

pkv <- new_ode_model(code = " CLi = CL exp(eta1) VCi = VC exp(eta2) Qi = Q exp(eta3) VPi = VP exp(eta4) dAdt[1] = -KA A[1] dAdt[2] = KA A[1] -(CLi/VCi) A[2] - (Qi/VCi) A[2] + (Qi/VPi) A[3] dAdt[3] = (Qi/VCi) A[2] - (Qi/VPi) A[3] ", declare_variables = c("CLi", "VCi", "Qi", "VPi"), obs = list(cmt = 2, scale = "VC exp(eta2)"), # Identify which compartment has observation dose = list(cmt = 1), # Identify dosing compartment lagtime = "ALAG" )

Simulation

datv <- sim_ode( ode = "pkv", parameters = pv, regimen = reg2, n = 40, t_obs = c(0, 0.5, 1, 2, 4,8,24,48,96,168,216,480,504,504.5,505506,508,512,528,960), omega = c(0.1, 0 , 0.05, 0 , 0 , 2.5, 0 , 0 , 0 , 0.8), output_include = list("parameters" = TRUE, variables=TRUE), only_obs = TRUE )

melmelie commented 5 years ago

One comma was missing between 505 and 506 leading to long simulation time - apologies. Issue closed.