## Not run: 
# TR = 1000                             # Total number of simulations
# limit_tox <- 10.96                  
# N = 42                         
# param_pk <- c(2, 10, 100)             # PK parameters ka,CL,V
# omega2 <- 0.7                        
# omega_a <- 0                     
# preal <- c(0.001, 0.05, 0.1, 0.2, 0.35, 0.45)         
# time_sampling <- seq(0, 24, length.out=48)     
# sigma2 <- c(rep(0.2, length(time_sampling)), rep(0.2,length(time_sampling)))          
# # sigma2: Additive or proportional error.  
# 
# gen.scen <- scenarios(param_pk,omega2,omega_a,sigma2,preal,limit_tox,time_sampling, N)
# 
# cohort = 1 
# scenarios <- gen.scen   
# d <- scenarios@doses 
# icon <- c(2:6, round(seq(9, 48, ((48-9)/4))))      
# theta <- 0.2                                      
# p_0 = 0                              
# L = 0 
# 
# ##############################################
# ############### Select a model ###############
# ##############################################
# 
# model = pktox        
# betapriors = NULL 
# 
# ################################################
# #### Set the Stan model's options as a list ####
# ################################################
# 
# options <- list(nchains = 4, 
#                 niter = 4000, 
#                 nadapt = 0.9) 
# 
# ############################################
# ############ Run the simulation(s) ############
# ############################################
# 
# results_sim <- nsim(d, N, cohort, icon, theta, p_0, L, model, gen.scen, betapriors, options, TR)
# results_sim
#   ## End(Not run)
Run the code above in your browser using DataLab