Skip to contents

Class initializer for arguments of visual predictive check (VPC) runs

Arguments

numReplicates

Integer; Number of replicates to simulate the model

seed

Integer; Random number generator seed

predCorrection

Character; Type of correction to use when calculating a prediction-corrected observation. Options are "none", "proportional", "additive". This option is ignored for discontinuous observed variables (categorical, count, and time-to-event).

predVarCorr

Logical; Set to TRUE to use Prediction Variance Correction. Only applicable to the case where predCorrection is set to either "proportional" or "additive".

outputPRED

Logical; Set to TRUE to include population prediction (PRED) results for continuous observed variables in output.

stratifyColumns

Character or character vector; Names of categorical covariates (up to 3) used to stratify modeling simulation results.

observationVars

NlmeObservationVar class instance or list of these instances

simulationTables

Optional list of simulation tables. NlmeSimTableDef class instance or a list of such instances. Could be generated by tableParams wrapper function or by NlmeSimTableDef class instance initializing directly.

Examples

if (FALSE) { # \dontrun{

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)

# Observation dataset predcheck0.csv
dt_ObsData <- finalVPCJob$predcheck0

# Simulation output dataset predout.csv
dt_SimData <- finalVPCJob$predout

# Add PRED from REPLICATE = 0 of simulation output dataset to observed input dataset
dt_ObsData$PRED <- dt_SimData[REPLICATE == 0]$PRED

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

plot_binned_VPC <- plot(binned_VPC)

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

plot_binned_pcVPC <- plot(binned_pcVPC)
} # }