Jump to content


Photo

Visual predictive check


  • Please log in to reply
2 replies to this topic

#1 joybaker

joybaker

    Advanced Member

  • Val_Members
  • PipPipPip
  • 45 posts

Posted 22 August 2023 - 08:36 AM

Hi all,

 I used R code in this topic 

Overall Predictive Check - Modelling and Simulation - Certara Forums

to replicate the VPC plot in R and compare with the plot in phoenix

 

They look slightly different. Dose Phoenix further uses any smoothing function for the interval (shade area)?

Attached Thumbnails

  • 1.png
  • 2.png

  • DanielGon, Austingar, Michaelutisy and 11 others like this

#2 kniefort

kniefort

    Member

  • Val_Members
  • PipPip
  • 29 posts

Posted 22 August 2023 - 04:33 PM

For custom VPCs you may want to invest some time in learning the tidyvpc package in R.  
 
You can easily use Phoenix VPC output (as well as RsNLME, NONMEM, any engine really as the only required inputs are the observed data and simulation data)
 
Here's an example of how to use output from a Phoenix VPC run.  You will need to locate the required files in your Phoenix Temporary Output Folder, the path of which can be found in the compiler output text file from the run.
 
 
library(xpose)
 
# Import obs/sim tables from Phoenix Temporary Output Folder
 
obs_data <- read.csv("C:/Users/username/AppData/Local/Temp/Phoenix/DME_PredCheck_11-21-24.845__63bc3ae3-ebfd-452a-b2ab-2dc9ccfd44ee/predcheck0.csv")
sim_data <- read.csv("C:/Users/username/AppData/Local/Temp/Phoenix/DME_PredCheck_11-21-24.845__63bc3ae3-ebfd-452a-b2ab-2dc9ccfd44ee/predout.csv")
 
library(tidyvpc)
vpc <- observed(obs_data, x = IVAR, y = DV) %>%
  simulated(sim_data, ysim = DV) %>%
  stratify(~ Strat1) %>%
  binning(bin = "jenks", nbins = 5) %>%
  vpcstats()
 
plot(vpc)
 
Rplot1.png
 
#to add labels to panels: Need to convert numeric variables to factors with labels
 
obs_data <- obs_data %>%
  mutate(SEXfactor = factor(Strat1, levels=c(0,1), labels=c("M","F")))
 
sim_data <- sim_data %>%
  mutate(SEXfactor = factor(STRAT1, levels=c(0,1), labels=c("M","F")))
 
vpc <- observed(obs_data, x = IVAR, y = DV) %>%
  simulated(sim_data, ysim = DV) %>%
  stratify(~ SEXfactor) %>%
  binning(bin = "jenks", nbins = 5) %>%
  vpcstats()
 
plot(vpc)
 
Rplot2.png
 
# Or use VPCResults User Interface to Explore binning methods
library(Certara.VPCResults)
vpcResultsUI(observed = obs_data, simulated = sim_data)


#3 smouksassi1

smouksassi1

    Advanced Member

  • Val_Members
  • PipPipPip
  • 232 posts
  • LocationMontreal

Posted 22 August 2023 - 05:32 PM

Hi, the old post you referred to is quite old many things changed since.

 

if your design is rich day1, troughs , rich day ss:

 you might want to startify by Visit and then do an interval for the troughs.

this require a good knowledge of R and ggplot2 and not part of automatic plotting in tidyvpc.

 

once you have the intervals computed you can do any plot you want:

 

 

 

 

Attached Thumbnails

  • Picturevpc.png





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users