ppc_data(
r,
FUN,
...,
pre_proc = identity,
max_mod_no = NA,
DV = "DV",
statistic = "statistic"
)
ppc_whisker_plot(d, group, var1, var2, statistic = "statistic")
ppc_histogram_plot(d, var1, var2, statistic = "statistic")
An nm object (a simulation run).
Statistic function accepting a NONMEM dataset data.frame
as an
argument and returns data.frame
with a column "statistic"
.
Additional arguments for FUN
.
Function to apply to dataset prior to compute statistics.
Integer. Maximum model number to read (set low for debugging).
Character (default = "DV"
).
Character (default = "statistic"
). Name of statistic column
returned by FUN.
Output from ppc_data()
.
Grouping variables for plotting.
The function ppc_data()
return a data.frame
with observed and
predicted statistics. The ppc_*_plot()
plotting functions return ggplot
objects.
## requires NONMEM to be installed
if (FALSE) {
idEXPstat <- function(d, ...) { ## example individual statistic function
## arg = nonmem dataset data.frame
## return data.frame with statistic column
d %>%
group_by(ID, ...) %>%
filter(is.na(AMT)) %>%
summarise(
AUC = AUC(time = TIME, conc = DV),
CMAX = max(DV, na.rm = TRUE),
TMAX = TIME[which.max(DV)]
) %>%
tidyr::gather(key = "exposure", value = "statistic", AUC:TMAX) %>%
ungroup()
}
EXPstat <- function(d, ...) { ## example summary statistic function
## arg = nonmem dataset data.frame
## return data.frame with statistic column
d %>%
idEXPstat(...) %>% ## reuse idEXPstat for individual stats
## summarise over study and any other variables (...)
group_by(exposure, ...) %>%
summarise(
median = median(statistic, na.rm = TRUE),
cv = 100 * sd(statistic, na.rm = TRUE) / mean(statistic, na.rm = TRUE)
) %>%
tidyr::gather(key = "type", value = "statistic", median:cv)
}
dppc <- m1s %>% ppc_data(EXPstat)
dppc %>% ppc_whisker_plot()
dppc %>% ppc_forest_plot()
}