[Stable]

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")

Arguments

r

An nm object (a simulation run).

FUN

Statistic function accepting a NONMEM dataset data.frame as an argument and returns data.frame with a column "statistic".

...

Additional arguments for FUN.

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 = "DV").

statistic

Character (default = "statistic"). Name of statistic column returned by FUN.

d

Output from ppc_data().

group, var1, var2

Grouping variables for plotting.

Value

The function ppc_data() return a data.frame with observed and predicted statistics. The ppc_*_plot() plotting functions return ggplot

objects.

See also

Examples


## 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()
}