Skip to contents

Estimates the prior distribution of population parameters by Monte Carlo simulations

Usage

poso_simu_pop(
  dat = NULL,
  prior_model = NULL,
  n_simul = 1000,
  return_model = TRUE
)

Arguments

dat

Dataframe. An individual subject dataset following the structure of NONMEM/rxode2 event records.

prior_model

A posologyr prior population pharmacokinetics model, a list of six objects.

n_simul

An integer, the number of simulations to be run. For n_simul =0, all ETAs are set to 0.

return_model

A boolean. Returns a rxode2 model using the simulated ETAs if set to TRUE.

Value

If return_model is set to FALSE, a list of one element: a dataframe $eta of the individual values of ETA. If return_model is set to TRUE, a list of the dataframe of the individual values of ETA, and a rxode2 model using the simulated ETAs.

Examples

# model
mod_run001 <- function() {
  ini({
    THETA_Cl <- 4.0
    THETA_Vc <- 70.0
    THETA_Ka <- 1.0
    ETA_Cl ~ 0.2
    ETA_Vc ~ 0.2
    ETA_Ka ~ 0.2
    prop.sd <- sqrt(0.05)
  })
  model({
    TVCl <- THETA_Cl
    TVVc <- THETA_Vc
    TVKa <- THETA_Ka

    Cl <- TVCl*exp(ETA_Cl)
    Vc <- TVVc*exp(ETA_Vc)
    Ka <- TVKa*exp(ETA_Ka)

    K20 <- Cl/Vc
    Cc <- centr/Vc

    d/dt(depot) = -Ka*depot
    d/dt(centr) = Ka*depot - K20*centr
    Cc ~ prop(prop.sd)
  })
}
# df_patient01: event table for Patient01, following a 30 minutes intravenous
# infusion
df_patient01 <- data.frame(ID=1,
                        TIME=c(0.0,1.0,14.0),
                        DV=c(NA,25.0,5.5),
                        AMT=c(2000,0,0),
                        EVID=c(1,0,0),
                        DUR=c(0.5,NA,NA))
# estimate the prior distribution of population parameters
poso_simu_pop(dat=df_patient01,prior_model=mod_run001,n_simul=100)
#>  
#>  
#>  
#>  
#> $eta
#>           ETA_Cl       ETA_Vc       ETA_Ka
#> 1   -0.356283402 -0.718204842  0.262748840
#> 2    0.181760486  0.034134300 -0.148758525
#> 3    0.496977745  0.262578048 -0.590569407
#> 4   -0.050422960  0.022481073 -0.594248849
#> 5   -0.589944445  0.046335613  0.127644452
#> 6   -0.205528681  0.163884445 -0.267323046
#> 7    0.032184701 -0.416066419 -0.061589229
#> 8    0.251984307 -0.108502985  0.434539666
#> 9    0.360014569 -0.197008524  0.006368876
#> 10   0.748638159 -0.619259579  0.598004141
#> 11  -0.261826386  0.787028980 -0.973551016
#> 12   0.257174673 -0.121258353  0.181363803
#> 13  -0.578536335 -0.439782905  0.385652765
#> 14   0.172137688 -0.152223142 -0.067303297
#> 15   0.063690958 -0.019787337  0.192794594
#> 16  -0.270016327 -0.318032798 -0.135251929
#> 17   0.283652846 -0.067420751  0.179364742
#> 18  -0.615626863  0.410535869 -0.278744098
#> 19  -0.670338610  0.165592949  0.080928687
#> 20   0.153057834  0.258758163 -1.022285571
#> 21   0.289820277 -0.388943160 -0.964969935
#> 22   0.362881603  0.661858040 -0.155690410
#> 23   0.074496536 -0.326060005  0.601478754
#> 24   0.520710920  0.327066294  0.204825494
#> 25  -0.706356273  0.505765094 -0.189318499
#> 26  -0.515482693 -0.048629251 -0.129853314
#> 27  -0.198733238 -0.693697977 -0.366329383
#> 28  -0.226003021 -0.225996607 -0.238593855
#> 29   0.257563215 -0.335390402  0.859965579
#> 30   0.401446594  0.291546870  0.117498688
#> 31  -0.416181135  0.164940227  0.511740593
#> 32   0.184609510  0.386991371 -0.023583874
#> 33  -0.507490185  0.529474161 -0.030670061
#> 34  -0.542411337  0.648319889  0.111987580
#> 35   0.339544687  0.183368625  1.091264519
#> 36  -0.435362477 -0.891098172  0.143370918
#> 37   0.567342932  0.602893000 -0.077783101
#> 38  -0.167167359 -0.338809169  0.401328385
#> 39  -0.807048011 -0.171658988  1.057666291
#> 40   0.594122509 -0.258786483 -0.401453300
#> 41  -0.208117834 -0.385938219 -0.346738675
#> 42  -0.276619517  0.012772765  0.114670671
#> 43   0.369521881  0.385444133 -0.210657640
#> 44  -0.073312195 -0.742860877 -0.283443271
#> 45   0.969763134 -0.419709499 -0.609111991
#> 46  -0.507883003  0.384172350  0.450767165
#> 47  -0.755994965  0.114251662 -0.014825607
#> 48   0.093753606 -0.413170767 -0.765581131
#> 49  -0.445696349 -0.361818583  0.696092200
#> 50  -0.335634683  1.323640599  0.187242097
#> 51   0.778177523 -0.518966870 -0.440444092
#> 52   0.544350606 -0.607969397 -0.007389321
#> 53   0.232865308 -0.467590257  0.333609027
#> 54  -0.348279281 -0.431254088 -0.270891636
#> 55  -0.160277742  0.007030329 -0.122509250
#> 56  -0.850417886 -0.293385455 -0.415629169
#> 57  -0.354029626 -0.133159495 -0.283971372
#> 58  -0.349616857 -0.409964992  0.795757060
#> 59  -0.419375870  0.741272382 -0.286953436
#> 60  -0.294976504 -0.226135319  0.598089542
#> 61   0.504095183 -0.217666300 -0.098950498
#> 62   0.055149663 -0.190465975 -0.317856143
#> 63  -0.747853461 -0.177296321 -0.428659762
#> 64   0.290124270  0.037868767 -0.101023298
#> 65  -0.143907184  0.376518121 -0.413290607
#> 66   0.187080412  0.273033490  0.597583891
#> 67   0.222125540  0.067990507  0.056376377
#> 68  -0.164292808 -0.256574612 -0.266408697
#> 69  -0.142379144  0.106768516  0.098376487
#> 70   0.109333802  0.124287641  0.699968412
#> 71  -0.265077525  0.295265122 -0.726738412
#> 72   0.614862243  0.196987493  0.161421640
#> 73   0.001827896  0.584211584  0.641098420
#> 74   0.143967236 -0.718037903  0.167855246
#> 75  -0.400051420  1.363997222  0.237981818
#> 76  -0.568232591 -0.563574801 -0.408365880
#> 77   0.110920764  1.188663369 -0.059583651
#> 78   0.207406708 -0.076469938 -0.329846165
#> 79  -0.460029531 -0.626673370  0.194879502
#> 80   0.180702754  0.112867673 -0.046181755
#> 81   0.351503098  0.213002290 -0.892943673
#> 82   0.044966527  0.176452176  0.538427307
#> 83   0.640070248  0.519929656 -0.629138997
#> 84   0.298601919  0.626826806 -0.620369265
#> 85   0.793940827 -0.034879168  0.449129974
#> 86  -0.278526497  0.133821297  0.365356962
#> 87   0.361916153 -0.197153272  0.050216099
#> 88  -0.017062638 -0.401052752 -0.155132355
#> 89   0.472322104 -0.591024717 -0.147335267
#> 90  -0.551310497 -0.475133531 -0.732751368
#> 91  -0.139192504  0.019537293  0.242074042
#> 92  -0.020565163 -0.004286516  0.059194027
#> 93   0.664191784 -0.710832879  0.341218330
#> 94  -0.221888659  0.055717941 -0.236692343
#> 95  -0.337818681  0.278295703 -0.255029950
#> 96  -0.214647598  0.108692666 -0.256110331
#> 97   0.096231495 -0.365920056 -0.601794884
#> 98  -0.149768457 -0.132618895 -0.171780765
#> 99   0.668386569  0.101813600 -0.852789433
#> 100 -0.380466741  0.090938681 -0.208283767
#> 
#> $model
#> ── Solved rxode2 object ──
#> ── Parameters ($params): ──
#> # A tibble: 100 × 8
#>    sim.id THETA_Cl THETA_Vc THETA_Ka prop.sd  ETA_Cl  ETA_Vc   ETA_Ka
#>     <int>    <dbl>    <dbl>    <dbl>   <dbl>   <dbl>   <dbl>    <dbl>
#>  1      1        4       70        1   0.224 -0.356  -0.718   0.263  
#>  2      2        4       70        1   0.224  0.182   0.0341 -0.149  
#>  3      3        4       70        1   0.224  0.497   0.263  -0.591  
#>  4      4        4       70        1   0.224 -0.0504  0.0225 -0.594  
#>  5      5        4       70        1   0.224 -0.590   0.0463  0.128  
#>  6      6        4       70        1   0.224 -0.206   0.164  -0.267  
#>  7      7        4       70        1   0.224  0.0322 -0.416  -0.0616 
#>  8      8        4       70        1   0.224  0.252  -0.109   0.435  
#>  9      9        4       70        1   0.224  0.360  -0.197   0.00637
#> 10     10        4       70        1   0.224  0.749  -0.619   0.598  
#> # ℹ 90 more rows
#> ── Initial Conditions ($inits): ──
#> depot centr   AUC 
#>     0     0     0 
#> 
#> Simulation without uncertainty in parameters, omega, or sigma matricies
#> 
#> ── First part of data (object): ──
#> # A tibble: 200 × 14
#>   sim.id  time  TVCl  TVVc  TVKa    Cl    Vc    Ka    K20  rxCc    Cc      depot
#>    <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>  <dbl> <dbl> <dbl>      <dbl>
#> 1      1     1     4    70     1  2.80  34.1 1.30  0.0821 34.8  34.8     7.67e+2
#> 2      1    14     4    70     1  2.80  34.1 1.30  0.0821 20.2  20.2     3.49e-5
#> 3      2     1     4    70     1  4.80  72.4 0.862 0.0662 12.7  12.7     1.06e+3
#> 4      2    14     4    70     1  4.80  72.4 0.862 0.0662 12.0  12.0     1.44e-2
#> 5      3     1     4    70     1  6.57  91.0 0.554 0.0722  7.21  7.21    1.32e+3
#> 6      3    14     4    70     1  6.57  91.0 0.554 0.0722  9.35  9.35    9.87e-1
#> # ℹ 194 more rows
#> # ℹ 2 more variables: centr <dbl>, AUC <dbl>
#>