R/plot_vpc_exactbins.R
plot_vpc_exactbins.Rd
plot_vpc_exactbins()
is a wrapper function for vpc::vpc()
that returns a ggplot2
object.
plot_vpc_exactbins(
sim,
pcvpc = FALSE,
time_vars = c(TIME = "TIME", NTIME = "NTIME"),
output_vars = c(PRED = "PRED", IPRED = "IPRED", SIMDV = "SIMDV", OBSDV = "OBSDV"),
loq = NULL,
strat_var = NULL,
irep_name = "SIM",
min_bin_count = 1,
show_rep = TRUE,
lower_bound = 0,
shown = NULL,
theme = NULL,
timeu = "hours",
n_breaks = 8,
...
)
Input dataset. Must contain the following variables: "ID"
, "TIME"
logical for prediction correction. Default is FALSE
.
Names of actual and nominal time variables. Must be named character vector.
Defaults are "TIME"
and "NTIME"
.
Names of model outputs from model
. Must be named character vector.
Defaults are "PRED"
, "IPRED"
, and "DV"
.
Numeric value of the lower limit of quantification (LLOQ) for the assay. Passed to lloq
argument
of vpc::vpc()
. Specifying this argument implies that OBSDV
is missing in sim
where < LLOQ.
Character string of stratification variable passed to stratify
argument
of vpc::vpc()
. Currently, only a single stratifying variable is supported.
Name of replicate variable in data
. Must be a string. Default is "SIM"
.
Minimum number of quantifiable observations in exact bin for inclusion in binned plot layers. This argument drops small bins from summary statistic calculation but retains these observations in the observed data points.
Display number of replicates as a plot caption. Default is TRUE
.
Lower bound of the dependent variable for prediction correction. Default is 0
.
Named list of logicals specifying which layers to include on the plot. Passed to show
argument of vpc::vpc()
.
Defaults are:
Observed points: obs_dv
= TRUE.
Observed quantiles: obs_ci
= TRUE
Simulated inter-quantile range:pi
= FALSE
Simulated inter-quantile area: pi_as_area
= FALSE
Simulated Quantile CI: pi_ci
= TRUE
Observed Median: obs_median
= TRUE
Simulated Median: sim_median
= FALSE
Simulated Median CI: sim_median_ci
= TRUE
Named list of aesthetic parameters for the plot.Passed to vpc_theme
arumgent of vpc::vpc()
.
Defaults can be obtained by running vpc::new_vpc_theme()
with no arguments.
Character string specifying units for the time variable.
Passed to breaks_time
and assigned to default x-axis label.
Options include:
"hours" (default)
"days"
"weeks"
"months"
Number of breaks requested for x-axis. Default is 5.
Other arguments passed to vpc::vpc()
.
A list containing calculated VPC information (when vpcdb=TRUE
), or a ggplot2 object (default)
model <- model_mread_load(model = "model")
#> Loading model from cache.
simout <- df_mrgsim_replicate(data = data_sad, model = model, replicates = 100,
dv_var = "ODV",
num_vars = c("CMT", "EVID", "MDV", "NTIME", "LLOQ", "WTBL", "FOOD"),
char_vars = c("USUBJID", "PART"),
irep_name = "SIM")
vpc_plot <- plot_vpc_exactbins(
sim = simout,
pcvpc = TRUE,
pi = c(0.05, 0.95),
ci = c(0.05, 0.95),
loq = 1)
#> Joining with `by = join_by(NTIME, CMT)`
#> Joining with `by = join_by(NTIME, CMT)`
#> Prediction-correction cannot be used together with censored data (<LLOQ or >ULOQ). VPC plot will be shown for non-censored data only!