| ppc_data | R Documentation |
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")
r |
An nm object (a simulation run). |
FUN |
Statistic function accepting a NONMEM dataset |
... |
Additional arguments for |
pre_proc |
Function to apply to dataset prior to compute statistics. |
max_mod_no |
Integer. Maximum model number to read (set low for debugging). |
DV |
Character (default = |
statistic |
Character (default = |
d |
Output from |
group, var1, var2 |
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.
nm_render()
## requires NONMEM to be installed
## Not run:
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()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.