Open pmpharm opened 2 years ago
Hi,
I believe that all of the plots in Figure S8 of the paper you reference can be created by xpose, which uses the VPC package. Please see: https://uupharmacometrics.github.io/xpose/articles/vpc.html http://vpc.ronkeizer.com/appearance.html
Best regards, Andy
I was a co-author on the MOEV paper and at the time the code of the paper was in the supplemental materials available online (pure from the ground up ggplot2 nothing special, I take good care of informative legends)
later on I co-wrote tidyvpc https://github.com/certara/tidyvpc (where all computation are efficiently done using data.table) I support observation level LLOQ (e.g. different loq by study) and flexible by strata binning method etc. the package has a plot method for automatic plotting but you can write any ggplot2 code that you would like to use.
tidyvpc is software agnostic just need an obstable and a simulation table
Hi,
Appologies for the delay in my response. The representation of the medians for the percentiles of the simulations is not yet implemented in xpose
but given the flexibility of offered by the package it is quite easy to add this layer yourself. I have generated a small example for you. I hope it helps.
library(xpose)
#> Loading required package: ggplot2
#>
#> Attaching package: 'xpose'
#> The following object is masked from 'package:stats':
#>
#> filter
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
## Compute the vpc data
xpdb_vpc <- vpc_data(xpdb_ex_pk, stratify = 'SEX', opt = vpc_opt(n_bins = 7, lloq = 0.1))
#>
#> VPC continuous --------------------
#> 1. Gathering data & settings
#> Using xpdb simulation problem 2 and observation problem 1.
#> Setting stratifying variable to SEX
#> Setting lloq to 0.1.
#>
#> 2. Computing VPC data
#> Configuring and initializing...
#> Stratifying oberved data...
#> Parsing observed data...
#> Filtering rows where EVID not 0
#> Parsing simulated data...
#> Filtering rows where EVID not 0
#> Binning: 0 0.66667 1.25 1.8 3 5 7 9
#> Calculating statistics for simulated data...
#> Calculating statistics for observed data...
#>
#> VPC done
## Extract the vpc data for use outside of the "conventional way"
special_df <- get_special(xpdb_vpc)
#> Returning vpc continuous data from $prob no.3
## Call the VPC function
vpc(xpdb_vpc) +
## Add your layer
geom_line(
data = special_df$vpc_dat,
aes(x = bin_mid, y = med, color = Simulations)) +
## Ensure consistent color scale
scale_color_manual(values = c('steelblue3', 'grey60', 'steelblue3'))
#> Warning: Removed 4 rows containing missing values (`geom_line()`).
#> Warning: Removed 25 rows containing missing values (`geom_point()`).
Created on 2022-10-21 with reprex v2.0.2
According to the recommendations of the Model Evaluation Group of the International Society of Pharmacometrics (ISoP) Best Practice Committee (https://pubmed.ncbi.nlm.nih.gov/27884052/ ), it is suggested that a VPC should have lines showing the percentiles of both observations and predictions. This is important so the percentiles can be compared visually in order to compare the distribution of observed and predicted values. There is an illustration in the Figure S8 of the supplemental material.
If I checked correctly this is not possible yet in the package. My guess so far is that this functionality is available only in Monolix. Would it be possible to implement such functionality?