Perform visual predictive check for NLME models

vpcmodel(
  model,
  vpcParams,
  params,
  hostPlatform = NULL,
  runInBackground = FALSE,
  ...
)

Arguments

model

PK/PD model class object.

vpcParams

VPC argument setup. See NlmeVpcParams. If missing, default values generated by NlmeVpcParams() are used.

params

Engine argument setup. See engineParams. The following arguments are the subject of interest: sort, ODE, rtolODE, atolODE, maxStepsODE. If missing, default values generated by engineParams(model) are used.

hostPlatform

Host definition for model execution. See NlmeParallelHost. If missing, simple local host is used.

runInBackground

Set to TRUE to run in background and return prompt.

...

Additional class initializer arguments for NlmeVpcParams or NlmeParallelHost, or arguments available inside engineParams functions. If engineParams arguments are supplied through both params argument and additional argument (i.e., ellipsis), then the arguments in params will be ignored and only the additional arguments will be used with warning. If NlmeParallelHost arguments are supplied through both hostPlatform argument and additional argument, then its slots will be overridden by additional arguments. In addition, if NlmeVpcParams arguments are supplied through both vpcParams argument and additional argument, then its slots will be overridden by additional arguments.

Value

if runInBackground is TRUE, it returns job properties. Otherwise,

  • If the function is called in an interactive mode, the resulting simulated tables and summary statistics tables will be loaded and presented as a list;

  • If the function is called in a non-interactive mode, it returns the full paths of the tables generated

Examples

if (FALSE) {

 job <- fitmodel(model)

 # View estimation results
 print(job)

 finalModelVPC <- copyModel(model, acceptAllEffects = TRUE, modelName = "model_VPC")

 # View the model
 print(finalModelVPC)

 # Set up VPC arguments to have PRED outputted to simulation output dataset "predout.csv"
 vpcSetup <- NlmeVpcParams(outputPRED = TRUE)

 # Run VPC using the default host, default values for the relevant NLME engine arguments
 finalVPCJob <- vpcmodel(model = finalModelVPC, vpcParams = vpcSetup)
 # the same as:
 finalVPCJob <- vpcmodel(model = finalModelVPC, outputPRED = TRUE)

 # Simulation input dataset predcheck0.csv
 dt_ObsData <- finalVPCJob$predcheck0.csv

 # Simulation output dataset predout.csv
 # Note: The results corresponding to REPLICATE = -1 are for PRED
 dt_RawSimData <- finalVPCJob$predout.csv
 dt_SimData <- dt_RawSimData[REPLICATE >= 0]

 # Add PRED from REPLICATE = -1 of simulation output dataset to simulation input dataset
 dt_ObsData$PRED <- dt_RawSimData[REPLICATE == -1]$DV

 # tidyvpc package VPC example:
 library(magrittr)
 library(tidyvpc)
 # Create a regular VPC plot with binning method set to be "jenks"
 binned_VPC <- observed(dt_ObsData, x = IVAR, yobs = DV) %>%
  simulated(dt_SimData, ysim = DV) %>%
  binning(bin = "jenks") %>%
  vpcstats()

  plot_binned_VPC <- plot(binned_VPC)

 # Create a pcVPC plot with binning method set to be "jenks"
 binned_pcVPC <- observed(dt_ObsData, x = IVAR, yobs = DV) %>%
 simulated(dt_SimData, ysim = DV) %>%
 binning(bin = "jenks") %>%
 predcorrect(pred = PRED) %>%
 vpcstats()

 plot_binned_pcVPC <- plot(binned_pcVPC)
}