Skip to contents

Generate prediction distribution visualizations from sg_predist_sim() simulation results

Usage

sg_predist_vis(
  fpath_i,
  ds_sim,
  time_col = "TIME",
  name_x = "TIME",
  name_y = NULL,
  dt_obs_fl = FALSE,
  logy = FALSE,
  legend_fl = TRUE,
  pred_interval = "80%"
)

Arguments

fpath_i

String, GFO, or a named list with a GFO component (and optionally GCO). If a string is given, the path to a .RData or .json file with a fit object is expected.

ds_sim

GSO. Data frame with simulation results in long format (columns ID, TIME, VAR, VALUE), typically from sg_predist_sim().

time_col

String. The column to use as a time column. Currently, can be only TIME. Default is TIME.

name_y

Character. Y-axis label. If NULL (default), each plot is labelled with its own output variable (the VAR value, with any _ResErr suffix removed).

dt_obs_fl

Logical. If TRUE, observed data points are overlaid on the simulation plots. Default is FALSE.

logy

Logical. If TRUE, y-axis is displayed on a logarithmic scale. Default is FALSE.

legend_fl

Logical. If FALSE, the legend is hidden. Default is TRUE.

pred_interval

Character. Prediction interval to display. Options are "95%", "90%", "80%", "50%". Default is "80%".

Value

A list of ggplot objects, one per output variable in the simulation dataset.

Examples

# \donttest{
library(rxode2)
fpath_i <- system.file("extdata", "simurg_object", "Warfarin_PK.RData", package = "SimuRg")
#> Warning: cannot open compressed file '/tmp/RtmpLedq7K/temp_libpath8b6abff614d/SimuRg/DESCRIPTION', probable reason 'No such file or directory'
mod_fin <- rxode2({
 # Differential equations
 ka = ka_pop*exp(omega_ka)
 V = V_pop
 Cl = Cl_pop*exp(omega_Cl)
 d/dt(Ad) = -ka * Ad
 d/dt(Ac) = ka * Ad - Cl/V * Ac
 # Concentration calculations
 Cc = Ac / V
})
#>  
#>  
predist_sim <- sg_predist_sim(fpath_i, model =mod_fin, outputs = "Cc")
#> Warning: restarting interrupted promise evaluation
#> Error: cannot open file '/tmp/RtmpLedq7K/temp_libpath8b6abff614d/SimuRg/R/SimuRg.rdb': No such file or directory
predist_vis <- sg_predist_vis(fpath_i,predist_sim)
#> Error: cannot open file '/tmp/RtmpLedq7K/temp_libpath8b6abff614d/SimuRg/R/SimuRg.rdb': No such file or directory
predist_vis
#> Error: object 'predist_vis' not found
# }