Closed TheKazan closed 2 years ago
pmx_mlxtran
can not guess the simulation file . you should set it when you call pmx
or pmx_mlxtran
constructors.
for example:
`pmx_mlxtran(mlxtran_file, sim = pmx_sim(file = vpc_file,irun ="rep",idv="TIME"))
where :
mlxtran
: is the path to your monolox model file
vpc_file
: is the path to your simulation file
take a look at ?pmx_sim
for more details on how to set simulation file.
`
thanks for your answer.
When I look at ?pmx_sim, the teophylline example uses a file "sim.csv" to set the simulation file (with 20 simulated repetitions).
However, for the exported chart data from Monolix, we get 3 files for VPC :
There is no file with the simulated data. Do you know how to export from Monolix a file in the same format as "sim.csv" which then could be used with ggPMX ?
Sorry I can not help. I am not a monolix user. Surely other monloix users will help on how to create a simulation file.
Hello TheKazan,
To get the VPC, you need to provide a simulation file containing (at least) the following columns: ID: individual identifiers REP: simulation replicate number TIME: time DV: dependent variable
Use your preferred simulation software/package to create the simulation dataset (I an provide an example code using simulix, if needed).
library(dplyr) library(mlxR)
myprojfilename <- '...../myprojfile.mlxtran'
mysimfilename <- '...../mysimfile.csv’
mysim <- simulx(project=myprojfilename,nrep=200)
simdata = mysim$y3 #use the variable needed simdata <- simdata %>% left_join(., mysim$originalId) %>% mutate(id = oriId) %>% select(-oriId, -newId) write.csv(mysim$dv, file=mysimfilename, quote=F, row.names = F)
Hello baltcir1,
many thanks for your reply !
Unfortunately I still have troubles to generate VPC plots despite all the steps you described. I've generated a controller object : ctr<- pmx_mlxtran(mlxtran_file, sim = pmx_sim(file = vpc_file,irun ="rep",idv="TIME"))
with vpc_file coming from simulx following your explanation.
When I'm exploring this controller (ctr), it seems that it can't integrate correctly my simulated file ==> ctr[["data"]][["sim"]] is an empty data.frame
I've tried with a monolix model available in the demo ressources and will detail all the steps here, if you could help.
warfarin_model <- '..../monolix2019R2/demos/5.models_for_individual_parameters/5.2.covariate_model/warfarin_covariate3_project.mlxtran'
Generating VPC file
mysim_warfarin <- simulx (project=warfarin_model , nrep=10)
data_id<- as_tibble(mysim_warfarin $originalId)
simdata = mysim_warfarin $concentration simdata <- as_tibble(simdata) simdata$id<-as.integer(simdata$id) simdata<-rename(simdata,newId=id)
simdata<- simdata %>% left_join(data_id) %>% mutate(ID = oriId) %>% select(-oriId, -newId)
write.csv(x = simdata , file = "VPC_warfarin.csv",quote=F, row.names = F)
VPC_file <- '....../VPC_warfarin.csv'
Creating a controller object
ctr<- pmx_mlxtran(warfarin_model , sim = pmx_sim(file =VPC_file,irun ="rep",idv="time"))
==> I get this error use concentration_residuals.txt as residuals file. use concentration_fits.txt as finegrid file . Error in get(ind) : object 'dv' not found
With my own model and dataset, it was this error message: Warning message: In eval(jsub, SDenv, parent.frame()) : NAs introduced by coercion
Hope you can help.
Thanks
Using an already fitted monolix project with pmx_mlxtran(), the controller output does not show any VPC object whereas the VPC files exist in the Monolix project folder. All other diagnostic plots are present in the controller.
I also tried with a random monolix project from the demo of Monolix and I got the same result, no VPC.