Skip to contents

Generalized simulations input (GSI) is the set of arguments passed to sg_sim() to define a simulation scenario: model, event table, parameter values, and optional uncertainty or variability matrices. See bundled gsi_pk1c for a complete example.

Format

GSI

A named list (not a formal S3 class) with components matching sg_sim() arguments. When serialized to JSON, the same information may use output instead of outputs and store model as a character string; in R, pass an GMO object to sg_sim().

model

GMO. RxODE2 model (gmo_pk1c in bundled examples).

et

Data frame. Event table; columns such as ID, TIME, AMT, ADDL, II, and covariates (e.g. WT).

stimes

Numeric vector. Output sampling time grid.

outputs

Character vector. Model output names to retain (e.g. "Cc").

covs

Character vector. Covariate column names taken from et.

theta

Named numeric vector. Population parameters on the model scale (ka_pop, Vd_pop, CL_pop, covariate coefficients, …).

thetamat

Numeric matrix. Parameter-estimation covariance for population uncertainty (npop > 1).

omega, sigma

Matrix or NULL. Inter-individual and residual variability; empty when not resampled.

npop, nsub

Integers. Population and subject replicate counts.

byID, byPOP, shared, aggr, addcov, keep, …

Optional sg_sim() controls.

Examples

# \donttest{
names(gsi_pk1c)
#>  [1] "et"       "stimes"   "outputs"  "covs"     "theta"    "thetamat"
#>  [7] "omega"    "sigma"    "npop"     "nsub"     "addcov"  
head(gsi_pk1c$et)
#>   ID TIME AMT ADDL II  WT
#> 1  1    0  10   10 24  60
#> 2  2    0  10   10 24 200
gsi_pk1c$theta
#>      ka_pop      Vd_pop      CL_pop  beta_Vd_WT 
#> -0.03180134  1.03598838  0.24965305  0.02101630 
gsi_pk1c$npop
#> [1] 10
# Pass to sg_sim() together with the GMO:
do.call(sg_sim, c(list(model = gmo_pk1c), gsi_pk1c))
#>  try resetting cache
#>  done
#> Warning: multi-subject simulation without without 'omega'
#> # A tibble: 4,000 × 5
#>     POPN    ID  TIME VAR   VALUE
#>    <dbl> <int> <dbl> <chr> <dbl>
#>  1     1     1 0     Cc    0    
#>  2     1     1 0.603 Cc    0.590
#>  3     1     1 1.21  Cc    0.810
#>  4     1     1 1.81  Cc    0.852
#>  5     1     1 2.41  Cc    0.813
#>  6     1     1 3.02  Cc    0.741
#>  7     1     1 3.62  Cc    0.660
#>  8     1     1 4.22  Cc    0.580
#>  9     1     1 4.82  Cc    0.505
#> 10     1     1 5.43  Cc    0.439
#> # ℹ 3,990 more rows
# }