For VPC with censoring, users can supply additional arguments to
plot.tidyvpcobj
e.g., censoring.type
(options
are 'none'
, 'blq'
, 'alq'
, or
'both'
, defaults to 'none'
) and
censoring.output
(options are 'grid'
or
'list'
, defaults to 'grid'
).
If censoring.output = 'grid'
, the plots will be arranged
into single grid plot. Users may pass additional arguments via ellipsis
to egg::ggarrange
e.g., nrow = 1
,
ncol = 2
in order to customize plots in grid
arrangement.
If censoring.output = 'list'
, the resulting plots will
be returned individually as elements in list.
Example usage is below:
library(tidyvpc)
#> tidyvpc is part of Certara.R!
#> Follow the link below to learn more about PMx R package development at Certara.
#> https://certara.github.io/R-Certara/
obs_data <- obs_data[MDV == 0]
sim_data <- sim_data[MDV == 0]
obs_data$LLOQ <- obs_data[, ifelse(STUDY == "Study A", 50, 25)]
obs_data$ULOQ <- obs_data[, ifelse(STUDY == "Study A", 125, 100)]
vpc <- observed(obs_data, x = TIME, y = DV) |>
simulated(sim_data, y = DV) |>
censoring(blq = DV < LLOQ, lloq = LLOQ, alq = DV > ULOQ, uloq = ULOQ) |>
stratify(~ STUDY) |>
binning(bin = NTIME) |>
vpcstats(qpred = c(0.1, 0.5, 0.9))
If blq data, users may supply
censoring.type = "blq"
:
plot(vpc, censoring.type = "blq", censoring.output = "grid", facet.scales = "fixed")
If alq data, users may supply
censoring.type = "alq"
:
plot(vpc, censoring.type = "alq", censoring.output = "grid", ncol = 2, nrow = 1)
If both blq and alq data, users may supply
censoring.type = "both"
vpc_plots <- plot(vpc, censoring.type = "both", censoring.output = "list")
By default, when censoring.tidyvpcobj
is used, no
percentage blq/alq plots will be returned e.g., default for
censoring.type = 'none'
. If users specify
censoring.type='both'
and only blq censoring was performed,
for example, they will receive an error stating e.g.,
pctalq data.frame was not found in tidyvpcobj. Use censoring() to create censored data for plotting alq
.
The following additional binning methods from classInt
have been made available in tidyvpc
.
see ?classIntervals
‘style’ descriptions for applicable
arguments for each selected binning method.
headtails
observed(obs_data, x = TIME, y = DV) |>
simulated(sim_data, y = DV) |>
binning(bin = "headtails") |>
plot()
Including additional thr
argument.
maximum
observed(obs_data, x = TIME, y = DV) |>
simulated(sim_data, y = DV) |>
binning(bin = "maximum") |>
plot()
Including additional nbins
argument.
Users may now execute predcorrect()
either before, or
after calling binless(loess.ypc=TRUE)
. Previously, you were
required to execute predcorrect()
before
binless(loess.ypc=TRUE)
, otherwise you’d receive an
error.
The following code below produces equivalent output:
observed(obs_data, x = TIME, y = DV ) |>
simulated(sim_data, y = DV) |>
stratify(~ GENDER) |>
predcorrect(pred=PRED) |> #before binless()
binless(loess.ypc=TRUE) |>
vpcstats() |>
plot()
observed(obs_data, x = TIME, y = DV ) |>
simulated(sim_data, y = DV) |>
stratify(~ GENDER) |>
binless(loess.ypc=TRUE) |>
predcorrect(pred=PRED) |> #after binless()
vpcstats() |>
plot()
An overview of updates to plot()
function in
tidyvpc v1.3.0
Set plot output dimensions:
knitr::opts_chunk$set(fig.width=12, fig.height=8, dpi = 300)
We can use facet = TRUE argument to facet continuous VPC by quantile or facet categorical VPC by predicted probability.
Setup categorical VPC.
vpc <- observed(obs_cat_data, x = agemonths, yobs = zlencat) %>%
simulated(sim_cat_data, ysim = DV) %>%
binning(bin = round(agemonths, 0)) %>%
vpcstats(vpc.type = "categorical")
Adjust point size.
plot(vpc, point.size = 4)
Setup continuous VPC.
plot(vpc, point.size = 1.5, point.stroke = 2.5, point.alpha = 0.1, ribbon.alpha = 0.05)
plot(vpc, point.size = 5, point.stroke = 0.3, point.shape = "triangle")
plot(vpc, point.size = 7, point.shape = "square-fill", point.alpha = 0.1, ribbon.alpha = 0.5)