Changing rxode2 compartment numbers
-2023-12-03
+2023-12-05
Source:vignettes/rxode2-cmt.Rmd
rxode2-cmt.Rmd
How rxode2 assigns compartment n
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
summary(pbpk)
-#> rxode2 2.0.14.9000 model named rx_a9ab0a308fe15e1ad382edd63f19620d model (ready).
-#> DLL: /tmp/Rtmp5mYcCf/rxode2/rx_a9ab0a308fe15e1ad382edd63f19620d__.rxd/rx_a9ab0a308fe15e1ad382edd63f19620d_.so
+#> rxode2 2.0.14.9000 model named rx_e83f7a9651e77506967130f7b1c210ca model (ready).
+#> DLL: /tmp/RtmpE4aPra/rxode2/rx_e83f7a9651e77506967130f7b1c210ca__.rxd/rx_e83f7a9651e77506967130f7b1c210ca_.so
#> NULL
#>
#> Calculated Variables:
@@ -731,7 +731,7 @@ Appending compartments to the model
ode.1c.ka$simulationModel
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
-#> rxode2 2.0.14.9000 model named rx_a34f770c8ba668b242ec15fd28a802d9 model (ready).
+#> rxode2 2.0.14.9000 model named rx_e282a6cb08725b6bc480b4e3d4df4b56 model (ready).
#> x$state: depot, center
#> x$stateExtra: eff
#> x$params: V, KA, CL
diff --git a/articles/rxode2-covariates.html b/articles/rxode2-covariates.html
index 89b245b0b..1450b00e7 100644
--- a/articles/rxode2-covariates.html
+++ b/articles/rxode2-covariates.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
rxode2 Covariates
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-covariates.Rmd
rxode2-covariates.Rmd
diff --git a/articles/rxode2-data-frame.html b/articles/rxode2-data-frame.html
index 73a97d5b2..76461fe5e 100644
--- a/articles/rxode2-data-frame.html
+++ b/articles/rxode2-data-frame.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
rxode2 Data Frames
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-data-frame.Rmd
rxode2-data-frame.Rmd
diff --git a/articles/rxode2-datasets.html b/articles/rxode2-datasets.html
index b62ea742c..fe67d1ada 100644
--- a/articles/rxode2-datasets.html
+++ b/articles/rxode2-datasets.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
rxode2 Event Types
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-datasets.Rmd
rxode2-datasets.Rmd
diff --git a/articles/rxode2-event-table.html b/articles/rxode2-event-table.html
index d1f676411..bc620b706 100644
--- a/articles/rxode2-event-table.html
+++ b/articles/rxode2-event-table.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
Easy rxode2 Event Tables
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-event-table.Rmd
rxode2-event-table.Rmd
diff --git a/articles/rxode2-event-types.html b/articles/rxode2-event-types.html
index 29fc91536..3ed66b28f 100644
--- a/articles/rxode2-event-types.html
+++ b/articles/rxode2-event-types.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
rxode2 Event Types
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-event-types.Rmd
rxode2-event-types.Rmd
diff --git a/articles/rxode2-events-classic.html b/articles/rxode2-events-classic.html
index b9a59accb..42176da80 100644
--- a/articles/rxode2-events-classic.html
+++ b/articles/rxode2-events-classic.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
Classic rxode2 Events
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-events-classic.Rmd
rxode2-events-classic.Rmd
diff --git a/articles/rxode2-intro.html b/articles/rxode2-intro.html
index ff6fe94ff..9e55143d4 100644
--- a/articles/rxode2-intro.html
+++ b/articles/rxode2-intro.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
Introduction to rxode2
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-intro.Rmd
rxode2-intro.Rmd
diff --git a/articles/rxode2-model-types.html b/articles/rxode2-model-types.html
index c6a45165e..0665d071e 100644
--- a/articles/rxode2-model-types.html
+++ b/articles/rxode2-model-types.html
@@ -162,7 +162,7 @@ Advanced Features, Model Types, Techni
rxode2 additional model types
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-model-types.Rmd
rxode2-model-types.Rmd
@@ -237,18 +237,18 @@ Solved compartment modelsVC or V
),
Peripheral/Tissue (VP
, VT
). While more
translations are available, some example translations are below:
-
-Another popular parameterization is in terms of micro-constants.
+
+Another popular parameterization is in terms of micro-constants.
rxode2 assumes compartment 1
is the central compartment.
The elimination constant would be specified by K
,
Ke
or Kel
. Some example translations are
below:
-
-The last parameterization possible is using alpha
and
+
+The last parameterization possible is using alpha
and
V
and/or A
/B
/C
. Some
example translations are below:
-
-Once the linCmt()
sleuthing is complete, the
+
+Once the linCmt()
sleuthing is complete, the
1
, 2
or 3
compartment model
solution is used as the value of linCmt()
.
The compartments where you can dose in a linear solved system are
diff --git a/articles/rxode2-nesting.html b/articles/rxode2-nesting.html
index bbf9ea12e..04181079c 100644
--- a/articles/rxode2-nesting.html
+++ b/articles/rxode2-nesting.html
@@ -157,7 +157,7 @@
Advanced Features, Model Types, Techni
Nesting levels in rxode2
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-nesting.Rmd
rxode2-nesting.Rmd
@@ -312,24 +312,24 @@ Uncertainty in Model parametersdimnames(tMat) <- list(names(theta), names(theta))
tMat
-#> TKA TCl V2 Q V3
-#> TKA 0.091283564 -0.068572309 -0.021058603 0.051974567 0.035090728
-#> TCl -0.068572309 0.159500450 0.021955940 -0.033815812 0.019583567
-#> V2 -0.021058603 0.021955940 0.038136753 -0.015179898 0.017702364
-#> Q 0.051974567 -0.033815812 -0.015179898 0.179281300 0.084678596
-#> V3 0.035090728 0.019583567 0.017702364 0.084678596 0.094222614
-#> Kin -0.021023944 0.046353050 0.004554589 -0.052996743 -0.044415064
-#> Kout -0.007146270 -0.001840578 0.012059396 -0.006507225 -0.004639813
-#> EC50 0.001406257 -0.055571475 0.003785865 0.032559017 -0.019434394
+#> TKA TCl V2 Q V3
+#> TKA 0.11351272 -0.046152020 0.027935822 0.022304492 -0.01180844
+#> TCl -0.04615202 0.058314039 -0.020962093 -0.002400837 -0.03939416
+#> V2 0.02793582 -0.020962093 0.040095192 -0.032248068 -0.02460253
+#> Q 0.02230449 -0.002400837 -0.032248068 0.100788522 0.02896160
+#> V3 -0.01180844 -0.039394160 -0.024602530 0.028961599 0.17871543
+#> Kin 0.05598072 -0.037818788 0.018273854 0.014698885 0.01211345
+#> Kout 0.04256859 0.028764542 -0.017538342 0.053881910 -0.06229732
+#> EC50 0.03982818 -0.035924606 0.003886435 0.041573070 -0.07322727
#> Kin Kout EC50
-#> TKA -0.021023944 -0.007146270 0.001406257
-#> TCl 0.046353050 -0.001840578 -0.055571475
-#> V2 0.004554589 0.012059396 0.003785865
-#> Q -0.052996743 -0.006507225 0.032559017
-#> V3 -0.044415064 -0.004639813 -0.019434394
-#> Kin 0.097337411 -0.010167878 -0.001557061
-#> Kout -0.010167878 0.027566158 0.019229527
-#> EC50 -0.001557061 0.019229527 0.064498809
+#> TKA 0.055980719 0.042568594 0.039828180
+#> TCl -0.037818788 0.028764542 -0.035924606
+#> V2 0.018273854 -0.017538342 0.003886435
+#> Q 0.014698885 0.053881910 0.041573070
+#> V3 0.012113446 -0.062297320 -0.073227270
+#> Kin 0.157348093 -0.008763337 0.055861453
+#> Kout -0.008763337 0.105270344 0.036356337
+#> EC50 0.055861453 0.036356337 0.161512221
Nesting Variability
@@ -407,16 +407,16 @@ Solving the problem#> # A tibble: 8,000 x 24
#> sim.id id `inv.Cl(inv==1)` `inv.Cl(inv==2)` `inv.Ka(inv==1)`
#> <int> <fct> <dbl> <dbl> <dbl>
-#> 1 1 1 -0.148 -0.132 -0.000571
-#> 2 1 2 -0.148 -0.132 -0.000571
-#> 3 1 3 -0.148 -0.132 -0.000571
-#> 4 1 4 -0.148 -0.132 -0.000571
-#> 5 1 5 -0.148 -0.132 -0.000571
-#> 6 1 6 -0.148 -0.132 -0.000571
-#> 7 1 7 -0.148 -0.132 -0.000571
-#> 8 1 8 -0.148 -0.132 -0.000571
-#> 9 1 9 -0.148 -0.132 -0.000571
-#> 10 1 10 -0.148 -0.132 -0.000571
+#> 1 1 1 -0.0391 -0.0265 -0.00221
+#> 2 1 2 -0.0391 -0.0265 -0.00221
+#> 3 1 3 -0.0391 -0.0265 -0.00221
+#> 4 1 4 -0.0391 -0.0265 -0.00221
+#> 5 1 5 -0.0391 -0.0265 -0.00221
+#> 6 1 6 -0.0391 -0.0265 -0.00221
+#> 7 1 7 -0.0391 -0.0265 -0.00221
+#> 8 1 8 -0.0391 -0.0265 -0.00221
+#> 9 1 9 -0.0391 -0.0265 -0.00221
+#> 10 1 10 -0.0391 -0.0265 -0.00221
#> # i 7,990 more rows
#> # i 19 more variables: `inv.Ka(inv==2)` <dbl>, `eye.Cl(eye==1)` <dbl>,
#> # `eye.Cl(eye==2)` <dbl>, `eye.Ka(eye==1)` <dbl>, `eye.Ka(eye==2)` <dbl>,
@@ -433,17 +433,17 @@ Solving the problem#>
#> -- First part of data (object): --
#> # A tibble: 976,000 x 21
-#> sim.id id time inv.Cl inv.Ka eye.Cl eye.Ka iov.Cl iov.Ka C2 C3
-#> <int> <int> [h] <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
-#> 1 1 1 0 -0.148 -0.000571 0.702 -0.915 0.0816 0.0896 0 0
-#> 2 1 1 0.1 -0.148 -0.000571 -0.277 -0.0671 0.0816 0.0896 1.25 0.00269
-#> 3 1 1 4 -0.148 -0.000571 0.702 -0.915 0.0816 0.0896 39.4 3.93
-#> 4 1 1 4.1 -0.148 -0.000571 -0.277 -0.0671 0.0816 0.0896 49.6 4.04
-#> 5 1 1 8 -0.148 -0.000571 0.702 -0.915 0.0816 0.0896 36.3 7.33
-#> 6 1 1 8.1 -0.148 -0.000571 -0.277 -0.0671 0.0816 0.0896 23.3 7.39
+#> sim.id id time inv.Cl inv.Ka eye.Cl eye.Ka iov.Cl iov.Ka C2
+#> <int> <int> [h] <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
+#> 1 1 1 0 -0.0391 -0.00221 -0.0365 -0.0566 0.0675 -0.0702 0
+#> 2 1 1 0.1 -0.0391 -0.00221 -0.362 0.0975 0.0675 -0.0702 -2.56
+#> 3 1 1 4 -0.0391 -0.00221 -0.0365 -0.0566 0.0675 -0.0702 -81.7
+#> 4 1 1 4.1 -0.0391 -0.00221 -0.362 0.0975 0.0675 -0.0702 -86.0
+#> 5 1 1 8 -0.0391 -0.00221 -0.0365 -0.0566 0.0675 -0.0702 -235.
+#> 6 1 1 8.1 -0.0391 -0.00221 -0.362 0.0975 0.0675 -0.0702 -169.
#> # i 975,994 more rows
-#> # i 10 more variables: CL <dbl>, KA <dbl>, ef0 <dbl>, depot <dbl>, centr <dbl>,
-#> # peri <dbl>, eff <dbl>, occ <fct>, eye <fct>, inv <fct>
+#> # i 11 more variables: C3 <dbl>, CL <dbl>, KA <dbl>, ef0 <dbl>, depot <dbl>,
+#> # centr <dbl>, peri <dbl>, eff <dbl>, occ <fct>, eye <fct>, inv <fct>
There are multiple investigators in a study; Each investigator has a
number of individuals enrolled at their site. rxode2
automatically determines the number of investigators and then will
@@ -462,63 +462,63 @@
Solving the problem
print(head(s$params))
#> sim.id id inv.Cl(inv==1) inv.Cl(inv==2) inv.Ka(inv==1) inv.Ka(inv==2)
-#> 1 1 1 -0.1480315 -0.1323712 -0.0005714332 0.08559259
-#> 2 1 2 -0.1480315 -0.1323712 -0.0005714332 0.08559259
-#> 3 1 3 -0.1480315 -0.1323712 -0.0005714332 0.08559259
-#> 4 1 4 -0.1480315 -0.1323712 -0.0005714332 0.08559259
-#> 5 1 5 -0.1480315 -0.1323712 -0.0005714332 0.08559259
-#> 6 1 6 -0.1480315 -0.1323712 -0.0005714332 0.08559259
+#> 1 1 1 -0.03911994 -0.02646643 -0.00220576 -0.1141159
+#> 2 1 2 -0.03911994 -0.02646643 -0.00220576 -0.1141159
+#> 3 1 3 -0.03911994 -0.02646643 -0.00220576 -0.1141159
+#> 4 1 4 -0.03911994 -0.02646643 -0.00220576 -0.1141159
+#> 5 1 5 -0.03911994 -0.02646643 -0.00220576 -0.1141159
+#> 6 1 6 -0.03911994 -0.02646643 -0.00220576 -0.1141159
#> eye.Cl(eye==1) eye.Cl(eye==2) eye.Ka(eye==1) eye.Ka(eye==2) iov.Cl(occ==1)
-#> 1 0.70186234 -0.27732005 -0.915347545 -0.06709872 0.08164632
-#> 2 0.12461103 -0.22840762 -0.183417034 -0.05335536 0.02906715
-#> 3 -0.11718627 0.08188798 0.009429659 0.15021773 0.24113638
-#> 4 0.06090385 -0.32973251 0.139530066 -0.18749762 0.03151548
-#> 5 0.10903320 0.02315588 -0.279554496 -0.35864036 0.01036085
-#> 6 -0.27158388 -0.15547165 -0.153497112 -0.06469808 0.04908725
-#> iov.Cl(occ==2) iov.Ka(occ==1) iov.Ka(occ==2) V2 V3 TCl
-#> 1 0.294447042 0.089582665 0.13833348 40.31123 296.704 18.12202
-#> 2 -0.018486651 0.004075217 0.10875214 40.31123 296.704 18.12202
-#> 3 0.127857862 -0.060962525 -0.09452202 40.31123 296.704 18.12202
-#> 4 -0.203070657 0.025916649 0.37173955 40.31123 296.704 18.12202
-#> 5 -0.006504903 -0.043367120 -0.12604635 40.31123 296.704 18.12202
-#> 6 0.051101039 -0.097513628 -0.11446093 40.31123 296.704 18.12202
-#> eta.Cl TKA eta.Ka Q Kin Kout EC50
-#> 1 0.18588661 0.1850192 -0.201815537 10.26808 0.7761331 1.285074 200.3064
-#> 2 0.24056866 0.1850192 -0.003196246 10.26808 0.7761331 1.285074 200.3064
-#> 3 0.13228555 0.1850192 -0.629686258 10.26808 0.7761331 1.285074 200.3064
-#> 4 -0.38391078 0.1850192 0.560212037 10.26808 0.7761331 1.285074 200.3064
-#> 5 0.14257398 0.1850192 -0.150690952 10.26808 0.7761331 1.285074 200.3064
-#> 6 0.09652758 0.1850192 -0.549121466 10.26808 0.7761331 1.285074 200.3064
+#> 1 -0.03645376 -0.36231031 -0.05659512 0.09754696 0.067525518
+#> 2 -0.15423162 0.17628371 0.17033619 -0.25543769 0.003339573
+#> 3 0.01370540 -0.12667985 -0.36326997 -0.46382367 -0.040701460
+#> 4 0.20520923 -0.13916146 -0.24406546 0.14638320 0.126635992
+#> 5 0.62095573 0.16708951 -0.03264761 -0.30743926 0.066111000
+#> 6 -0.01113059 0.07142361 0.04510525 -0.09699871 0.007549183
+#> iov.Cl(occ==2) iov.Ka(occ==1) iov.Ka(occ==2) V2 V3 TCl
+#> 1 0.047393997 -0.070219903 -0.075319128 40.22524 297.4692 18.60184
+#> 2 0.044187327 -0.003843144 0.107574203 40.22524 297.4692 18.60184
+#> 3 0.130975748 0.122989836 -0.074852264 40.22524 297.4692 18.60184
+#> 4 -0.084189574 -0.163824725 -0.020576261 40.22524 297.4692 18.60184
+#> 5 0.003705417 0.065585679 0.003578391 40.22524 297.4692 18.60184
+#> 6 -0.038608539 0.161036185 0.144121117 40.22524 297.4692 18.60184
+#> eta.Cl TKA eta.Ka Q Kin Kout EC50
+#> 1 -0.1047263 -0.1221477 -0.08809663 10.26499 1.051154 0.6049542 199.646
+#> 2 0.6465167 -0.1221477 0.02602436 10.26499 1.051154 0.6049542 199.646
+#> 3 -0.4423746 -0.1221477 -0.24399657 10.26499 1.051154 0.6049542 199.646
+#> 4 -0.1156852 -0.1221477 -0.38145785 10.26499 1.051154 0.6049542 199.646
+#> 5 -0.3741853 -0.1221477 0.08673172 10.26499 1.051154 0.6049542 199.646
+#> 6 -0.1652379 -0.1221477 0.17428125 10.26499 1.051154 0.6049542 199.646
#> sim.id id inv.Cl(inv==1) inv.Cl(inv==2) inv.Ka(inv==1) inv.Ka(inv==2)
-#> 1 2 1 0.001613993 -0.1655022 0.1074734 0.02238288
-#> 2 2 2 0.001613993 -0.1655022 0.1074734 0.02238288
-#> 3 2 3 0.001613993 -0.1655022 0.1074734 0.02238288
-#> 4 2 4 0.001613993 -0.1655022 0.1074734 0.02238288
-#> 5 2 5 0.001613993 -0.1655022 0.1074734 0.02238288
-#> 6 2 6 0.001613993 -0.1655022 0.1074734 0.02238288
+#> 1 2 1 0.1016724 -0.05768568 -0.08969302 0.03548156
+#> 2 2 2 0.1016724 -0.05768568 -0.08969302 0.03548156
+#> 3 2 3 0.1016724 -0.05768568 -0.08969302 0.03548156
+#> 4 2 4 0.1016724 -0.05768568 -0.08969302 0.03548156
+#> 5 2 5 0.1016724 -0.05768568 -0.08969302 0.03548156
+#> 6 2 6 0.1016724 -0.05768568 -0.08969302 0.03548156
#> eye.Cl(eye==1) eye.Cl(eye==2) eye.Ka(eye==1) eye.Ka(eye==2) iov.Cl(occ==1)
-#> 1 -0.06492477 0.2103290 -0.258234272 -0.65555476 0.05581626
-#> 2 0.29221373 0.1291948 -0.001047067 -0.06049668 0.18612125
-#> 3 0.18355366 0.2809128 -0.006091777 -0.07121414 -0.07860149
-#> 4 0.51729297 -0.2746913 0.296216014 0.19018619 -0.01220883
-#> 5 0.09854127 0.1244885 0.051972718 0.02492854 -0.05869592
-#> 6 -0.21757059 0.1180519 0.265363855 -0.02517008 0.21103990
+#> 1 0.250679613 0.399887417 -0.18995157 -0.22979544 0.053010451
+#> 2 -0.193811345 -0.006759532 -0.28266541 -0.01564961 0.015378941
+#> 3 0.371815629 -0.399223456 -0.16225912 -0.15531978 -0.042915258
+#> 4 0.079688048 0.133151472 0.05655038 -0.01512107 -0.009710154
+#> 5 0.249691829 0.042461982 -0.02856142 -0.10260240 0.092573502
+#> 6 -0.004927963 0.031402455 -0.12693507 -0.29047920 -0.243391645
#> iov.Cl(occ==2) iov.Ka(occ==1) iov.Ka(occ==2) V2 V3 TCl
-#> 1 0.08770510 -0.1213494181 -0.07194749 40.40494 296.9874 18.59039
-#> 2 -0.06866621 -0.0034025289 0.03800002 40.40494 296.9874 18.59039
-#> 3 -0.12655918 -0.0784557848 0.12632977 40.40494 296.9874 18.59039
-#> 4 -0.03565934 -0.0007239254 -0.16161576 40.40494 296.9874 18.59039
-#> 5 0.02553487 0.1917256083 -0.31148491 40.40494 296.9874 18.59039
-#> 6 0.01985213 -0.0201123515 -0.16279535 40.40494 296.9874 18.59039
-#> eta.Cl TKA eta.Ka Q Kin Kout EC50
-#> 1 -0.30400507 0.1844716 0.11056784 10.33659 1.137549 0.9891969 200.0611
-#> 2 0.49634073 0.1844716 -0.05259496 10.33659 1.137549 0.9891969 200.0611
-#> 3 -0.07096015 0.1844716 -0.10609177 10.33659 1.137549 0.9891969 200.0611
-#> 4 0.08067657 0.1844716 0.25228398 10.33659 1.137549 0.9891969 200.0611
-#> 5 0.24616432 0.1844716 0.01271617 10.33659 1.137549 0.9891969 200.0611
-#> 6 -0.05820859 0.1844716 0.33222285 10.33659 1.137549 0.9891969 200.0611
+#> 1 0.05409047 0.04639233 -0.016095257 40.13468 297.0358 18.65192
+#> 2 0.10716852 -0.19118988 0.031572133 40.13468 297.0358 18.65192
+#> 3 -0.11725361 0.08095280 0.009272479 40.13468 297.0358 18.65192
+#> 4 0.06973915 0.11504560 0.128600039 40.13468 297.0358 18.65192
+#> 5 -0.21141943 -0.13882216 -0.107488100 40.13468 297.0358 18.65192
+#> 6 -0.19620243 0.01039522 -0.073640426 40.13468 297.0358 18.65192
+#> eta.Cl TKA eta.Ka Q Kin Kout EC50
+#> 1 0.073463560 0.2512785 -0.1195763 10.76278 0.3278979 1.321924 199.9834
+#> 2 0.006689739 0.2512785 -0.4004964 10.76278 0.3278979 1.321924 199.9834
+#> 3 0.121008344 0.2512785 0.2765039 10.76278 0.3278979 1.321924 199.9834
+#> 4 -0.277748970 0.2512785 0.2491093 10.76278 0.3278979 1.321924 199.9834
+#> 5 -0.216971611 0.2512785 -0.5772672 10.76278 0.3278979 1.321924 199.9834
+#> 6 -0.345436538 0.2512785 -0.1102403 10.76278 0.3278979 1.321924 199.9834
For between eye variability and between occasion variability each
individual simulates a number of variables that become the between eye
and between occasion variability; In the case of the eye:
diff --git a/articles/rxode2-pipeline.html b/articles/rxode2-pipeline.html
index 668521277..acbb541ea 100644
--- a/articles/rxode2-pipeline.html
+++ b/articles/rxode2-pipeline.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
rxode2 in a pipeline
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-pipeline.Rmd
rxode2-pipeline.Rmd
diff --git a/articles/rxode2-plot.html b/articles/rxode2-plot.html
index 80386a362..f2bc5a5ad 100644
--- a/articles/rxode2-plot.html
+++ b/articles/rxode2-plot.html
@@ -159,7 +159,7 @@ Advanced Features, Model Types, Techni
Matthew
Fidler
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-plot.Rmd
rxode2-plot.Rmd
diff --git a/articles/rxode2-plot_files/figure-html/unnamed-chunk-10-1.png b/articles/rxode2-plot_files/figure-html/unnamed-chunk-10-1.png
index 4488265db..bd0d09772 100644
Binary files a/articles/rxode2-plot_files/figure-html/unnamed-chunk-10-1.png and b/articles/rxode2-plot_files/figure-html/unnamed-chunk-10-1.png differ
diff --git a/articles/rxode2-plot_files/figure-html/unnamed-chunk-6-1.png b/articles/rxode2-plot_files/figure-html/unnamed-chunk-6-1.png
index b2e76dca3..02d5dca91 100644
Binary files a/articles/rxode2-plot_files/figure-html/unnamed-chunk-6-1.png and b/articles/rxode2-plot_files/figure-html/unnamed-chunk-6-1.png differ
diff --git a/articles/rxode2-plot_files/figure-html/unnamed-chunk-7-1.png b/articles/rxode2-plot_files/figure-html/unnamed-chunk-7-1.png
index 64b3cd09c..08167a148 100644
Binary files a/articles/rxode2-plot_files/figure-html/unnamed-chunk-7-1.png and b/articles/rxode2-plot_files/figure-html/unnamed-chunk-7-1.png differ
diff --git a/articles/rxode2-plot_files/figure-html/unnamed-chunk-8-1.png b/articles/rxode2-plot_files/figure-html/unnamed-chunk-8-1.png
index 11b757c6f..5a23368d2 100644
Binary files a/articles/rxode2-plot_files/figure-html/unnamed-chunk-8-1.png and b/articles/rxode2-plot_files/figure-html/unnamed-chunk-8-1.png differ
diff --git a/articles/rxode2-prior-data.html b/articles/rxode2-prior-data.html
index 3bf855491..8e775c13d 100644
--- a/articles/rxode2-prior-data.html
+++ b/articles/rxode2-prior-data.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
Using Prior Data for ODE solving
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-prior-data.Rmd
rxode2-prior-data.Rmd
@@ -242,33 +242,33 @@ Using prior data for solving#> ── Solved rxode2 object ──
#> ── Parameters ($params): ──
#> # A tibble: 12 × 7
-#> id tka tcl tv eta.ka eta.cl eta.v
-#> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
-#> 1 1 0.451 1.02 3.45 -0.781 0.0848 -0.154
-#> 2 2 0.451 1.02 3.45 -0.557 -0.116 -0.351
-#> 3 3 0.451 1.02 3.45 -0.170 -0.748 0.187
-#> 4 4 0.451 1.02 3.45 -0.382 -0.158 0.222
-#> 5 5 0.451 1.02 3.45 -0.161 -0.536 0.198
-#> 6 6 0.451 1.02 3.45 -0.405 0.0630 -0.159
-#> 7 7 0.451 1.02 3.45 0.216 0.476 -0.375
-#> 8 8 0.451 1.02 3.45 -0.630 0.000678 0.0844
-#> 9 9 0.451 1.02 3.45 1.05 -0.0449 -0.0207
-#> 10 10 0.451 1.02 3.45 0.918 0.250 -0.199
-#> 11 11 0.451 1.02 3.45 0.698 -0.119 -0.0334
-#> 12 12 0.451 1.02 3.45 0.103 -0.148 -0.208
+#> id tka tcl tv eta.ka eta.cl eta.v
+#> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
+#> 1 1 0.451 1.02 3.45 -0.111 1.08 0.0949
+#> 2 2 0.451 1.02 3.45 0.790 -0.884 0.294
+#> 3 3 0.451 1.02 3.45 0.592 -0.0302 -0.325
+#> 4 4 0.451 1.02 3.45 -1.55 0.183 0.430
+#> 5 5 0.451 1.02 3.45 -0.895 -0.608 0.0572
+#> 6 6 0.451 1.02 3.45 0.422 -0.362 -0.0614
+#> 7 7 0.451 1.02 3.45 0.0178 -0.000737 -0.338
+#> 8 8 0.451 1.02 3.45 -0.852 0.0517 -0.115
+#> 9 9 0.451 1.02 3.45 0.970 1.31 -0.0144
+#> 10 10 0.451 1.02 3.45 -0.0596 0.0197 0.465
+#> 11 11 0.451 1.02 3.45 1.23 0.483 0.104
+#> 12 12 0.451 1.02 3.45 2.27 0.178 -0.0347
#> ── Initial Conditions ($inits): ──
#> depot center
#> 0 0
#> ── First part of data (object): ──
#> # A tibble: 132 × 8
-#> id time ka cl v cp depot center
-#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
-#> 1 1 0 0.719 3.01 27.0 0 320. 0
-#> 2 1 0.25 0.719 3.01 27.0 1.92 267. 51.9
-#> 3 1 0.57 0.719 3.01 27.0 3.86 212. 104.
-#> 4 1 1.12 0.719 3.01 27.0 6.12 143. 165.
-#> 5 1 2.02 0.719 3.01 27.0 7.92 74.9 214.
-#> 6 1 3.82 0.719 3.01 27.0 8.27 20.5 223.
+#> id time ka cl v cp depot center
+#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
+#> 1 1 0 1.41 8.13 34.6 0 320. 0
+#> 2 1 0.25 1.41 8.13 34.6 2.66 225. 91.9
+#> 3 1 0.57 1.41 8.13 34.6 4.73 144. 164.
+#> 4 1 1.12 1.41 8.13 34.6 6.23 66.3 216.
+#> 5 1 2.02 1.41 8.13 34.6 6.26 18.7 217.
+#> 6 1 3.82 1.41 8.13 34.6 4.47 1.49 155.
#> # ℹ 126 more rows
## Of course the fasest way to solve if you don't care about the rxode2 extra parameters is
@@ -280,33 +280,33 @@ Using prior data for solving## solved data
dplyr::as_tibble(solveData)
#> # A tibble: 132 × 8
-#> id time ka cl v cp depot center
-#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
-#> 1 1 0 1.43 2.37 20.9 0 320. 0
-#> 2 1 0.25 1.43 2.37 20.9 4.54 224. 94.9
-#> 3 1 0.57 1.43 2.37 20.9 8.24 141. 172.
-#> 4 1 1.12 1.43 2.37 20.9 11.3 64.3 236.
-#> 5 1 2.02 1.43 2.37 20.9 12.3 17.7 257.
-#> 6 1 3.82 1.43 2.37 20.9 10.7 1.34 224.
-#> 7 1 5.1 1.43 2.37 20.9 9.32 0.215 195.
-#> 8 1 7.03 1.43 2.37 20.9 7.49 0.0135 157.
-#> 9 1 9.05 1.43 2.37 20.9 5.96 0.000750 125.
-#> 10 1 12.1 1.43 2.37 20.9 4.21 0.00000922 88.0
+#> id time ka cl v cp depot center
+#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
+#> 1 1 0 1.71 1.89 30.2 0 320. 0
+#> 2 1 0.25 1.71 1.89 30.2 3.67 208. 111.
+#> 3 1 0.57 1.71 1.89 30.2 6.48 120. 195.
+#> 4 1 1.12 1.71 1.89 30.2 8.65 46.9 261.
+#> 5 1 2.02 1.71 1.89 30.2 9.36 10.0 282.
+#> 6 1 3.82 1.71 1.89 30.2 8.65 0.458 261.
+#> 7 1 5.1 1.71 1.89 30.2 7.99 0.0510 241.
+#> 8 1 7.03 1.71 1.89 30.2 7.08 0.00187 214.
+#> 9 1 9.05 1.71 1.89 30.2 6.24 0.0000585 188.
+#> 10 1 12.1 1.71 1.89 30.2 5.14 0.000000303 155.
#> # ℹ 122 more rows
data.table::data.table(solveData)
-#> id time ka cl v cp depot center
-#> 1: 1 0.00 1.432501 2.368460 20.90624 0.000000 3.199920e+02 0.00000
-#> 2: 1 0.25 1.432501 2.368460 20.90624 4.538880 2.236698e+02 94.89089
-#> 3: 1 0.57 1.432501 2.368460 20.90624 8.235471 1.414251e+02 172.17270
-#> 4: 1 1.12 1.432501 2.368460 20.90624 11.299036 6.432153e+01 236.22032
-#> 5: 1 2.02 1.432501 2.368460 20.90624 12.300463 1.771909e+01 257.15637
-#> ---
-#> 128: 12 5.07 1.848827 1.806708 33.37071 7.521671 2.723616e-02 251.00351
-#> 129: 12 7.07 1.848827 1.806708 33.37071 6.750496 6.749527e-04 225.26884
-#> 130: 12 9.03 1.848827 1.806708 33.37071 6.070879 1.801074e-05 202.58956
-#> 131: 12 12.05 1.848827 1.806708 33.37071 5.155165 6.836463e-08 172.03152
-#> 132: 12 24.15 1.848827 1.806708 33.37071 2.677546 -1.208373e-09 89.35161
+#> id time ka cl v cp depot center
+#> 1: 1 0.00 1.7144281 1.894881 30.15945 0.000000 3.199920e+02 0.00000
+#> 2: 1 0.25 1.7144281 1.894881 30.15945 3.667532 2.084479e+02 110.61077
+#> 3: 1 0.57 1.7144281 1.894881 30.15945 6.481148 1.204305e+02 195.46789
+#> 4: 1 1.12 1.7144281 1.894881 30.15945 8.650838 4.690556e+01 260.90455
+#> 5: 1 2.02 1.7144281 1.894881 30.15945 9.355834 1.002568e+01 282.16685
+#> ---
+#> 128: 12 5.07 0.9835705 2.109641 29.75338 8.027812 2.189436e+00 238.85453
+#> 129: 12 7.07 0.9835705 2.109641 29.75338 7.024162 3.062054e-01 208.99254
+#> 130: 12 9.03 0.9835705 2.109641 29.75338 6.120830 4.454303e-02 182.11538
+#> 131: 12 12.05 0.9835705 2.109641 29.75338 4.942216 2.284322e-03 147.04762
+#> 132: 12 24.15 0.9835705 2.109641 29.75338 2.095704 1.520669e-08 62.35429
diff --git a/articles/rxode2-prior-data_files/figure-html/unnamed-chunk-5-1.png b/articles/rxode2-prior-data_files/figure-html/unnamed-chunk-5-1.png
index ca81c5f1d..41f808f5e 100644
Binary files a/articles/rxode2-prior-data_files/figure-html/unnamed-chunk-5-1.png and b/articles/rxode2-prior-data_files/figure-html/unnamed-chunk-5-1.png differ
diff --git a/articles/rxode2-rxUse.html b/articles/rxode2-rxUse.html
index f73eb96e6..70f365d00 100644
--- a/articles/rxode2-rxUse.html
+++ b/articles/rxode2-rxUse.html
@@ -159,7 +159,7 @@ Advanced Features, Model Types, Techni
Matthew
Fidler
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-rxUse.Rmd
rxode2-rxUse.Rmd
diff --git a/articles/rxode2-shiny.html b/articles/rxode2-shiny.html
index ab1697abd..9eef362d8 100644
--- a/articles/rxode2-shiny.html
+++ b/articles/rxode2-shiny.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
rxode2 and Shiny
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-shiny.Rmd
rxode2-shiny.Rmd
diff --git a/articles/rxode2-sim-var.html b/articles/rxode2-sim-var.html
index 1303db964..7d4c6e74e 100644
--- a/articles/rxode2-sim-var.html
+++ b/articles/rxode2-sim-var.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
rxode2 Simulation
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-sim-var.Rmd
rxode2-sim-var.Rmd
diff --git a/articles/rxode2-single-subject.html b/articles/rxode2-single-subject.html
index ca355d563..1408b4dfe 100644
--- a/articles/rxode2-single-subject.html
+++ b/articles/rxode2-single-subject.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
Single Subject ODE solving -- differences from multiple subject
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-single-subject.Rmd
rxode2-single-subject.Rmd
diff --git a/articles/rxode2-speed.html b/articles/rxode2-speed.html
index 694b4f841..e7669db17 100644
--- a/articles/rxode2-speed.html
+++ b/articles/rxode2-speed.html
@@ -159,7 +159,7 @@ Advanced Features, Model Types, Techni
Matthew
Fidler
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-speed.Rmd
rxode2-speed.Rmd
@@ -262,8 +262,8 @@ A note about t
output. You can see the differences below:
summary(mod1$simulationModel)
-#> rxode2 2.0.14.9000 model named rx_f6df81dba92d362c7c658b7dd040332b model (✔ ready).
-#> DLL: /tmp/Rtmp5mYcCf/rxode2/rx_f6df81dba92d362c7c658b7dd040332b__.rxd/rx_f6df81dba92d362c7c658b7dd040332b_.so
+#> rxode2 2.0.14.9000 model named rx_4080a1bccb3d88a72efd4eb95d275c3f model (✔ ready).
+#> DLL: /tmp/RtmpE4aPra/rxode2/rx_4080a1bccb3d88a72efd4eb95d275c3f__.rxd/rx_4080a1bccb3d88a72efd4eb95d275c3f_.so
#> NULL
#>
#> Calculated Variables:
@@ -281,8 +281,8 @@ A note about t
#> })
summary(mod1$simulationIniModel)
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
-#> rxode2 2.0.14.9000 model named rx_6a9a6e920d2935cba8f2ef73c0cfff04 model (✔ ready).
-#> DLL: /tmp/Rtmp5mYcCf/rxode2/rx_6a9a6e920d2935cba8f2ef73c0cfff04__.rxd/rx_6a9a6e920d2935cba8f2ef73c0cfff04_.so
+#> rxode2 2.0.14.9000 model named rx_79be712c1b8cfdbd11414aac387b190c model (✔ ready).
+#> DLL: /tmp/RtmpE4aPra/rxode2/rx_79be712c1b8cfdbd11414aac387b190c__.rxd/rx_79be712c1b8cfdbd11414aac387b190c_.so
#> NULL
#>
#> Calculated Variables:
@@ -308,8 +308,8 @@ A note about t
#> })
summary(mod2f$simulationModel)
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
-#> rxode2 2.0.14.9000 model named rx_2084cc55ccb1d18e4ccfa62790e1b6c6 model (✔ ready).
-#> DLL: /tmp/Rtmp5mYcCf/rxode2/rx_2084cc55ccb1d18e4ccfa62790e1b6c6__.rxd/rx_2084cc55ccb1d18e4ccfa62790e1b6c6_.so
+#> rxode2 2.0.14.9000 model named rx_39f78bb08fb42ed8474af31e234006ed model (✔ ready).
+#> DLL: /tmp/RtmpE4aPra/rxode2/rx_39f78bb08fb42ed8474af31e234006ed__.rxd/rx_39f78bb08fb42ed8474af31e234006ed_.so
#> NULL
#>
#> Calculated Variables:
@@ -365,8 +365,8 @@ A note about t
#> })
summary(mod2f$simulationIniModel)
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
-#> rxode2 2.0.14.9000 model named rx_1915c92e164f682e9bc352ac7211dc46 model (✔ ready).
-#> DLL: /tmp/Rtmp5mYcCf/rxode2/rx_1915c92e164f682e9bc352ac7211dc46__.rxd/rx_1915c92e164f682e9bc352ac7211dc46_.so
+#> rxode2 2.0.14.9000 model named rx_5453804681c56967a6be1d8cd0005130 model (✔ ready).
+#> DLL: /tmp/RtmpE4aPra/rxode2/rx_5453804681c56967a6be1d8cd0005130__.rxd/rx_5453804681c56967a6be1d8cd0005130_.so
#> NULL
#>
#> Calculated Variables:
@@ -552,10 +552,10 @@ Compare the times between all
print(bench)
#> Unit: milliseconds
#> expr min lq mean median uq max
-#> runFor() 274.52428 280.08363 288.84306 282.51682 285.47158 417.21426
-#> runSapply() 274.58491 281.29385 292.28574 283.44581 288.11469 420.43549
-#> runSingleThread() 28.13222 28.37132 29.85955 28.58462 28.80817 48.79048
-#> run2Thread() 16.78064 17.41015 18.47267 17.65783 17.96191 27.98068
+#> runFor() 271.77932 277.34620 284.72932 279.38768 282.35578 326.61336
+#> runSapply() 273.07732 277.02475 288.05530 279.45924 283.12016 398.42309
+#> runSingleThread() 27.44159 27.56624 28.56416 27.68545 27.97961 47.53934
+#> run2Thread() 16.31126 16.55615 18.04028 16.70647 17.06553 27.88397
#> neval
#> 100
#> 100
@@ -582,10 +582,10 @@ Compare the times between all
print(bench)
#> Unit: milliseconds
#> expr min lq mean median uq max neval
-#> runThread(1) 28.10950 28.39885 29.47866 29.60013 29.77615 40.06624 100
-#> runThread(2) 16.86474 17.50823 19.40572 17.87759 18.27338 30.41207 100
-#> runThread(3) 18.45526 19.11944 19.94110 19.68277 20.13565 26.65370 100
-#> runThread(4) 16.20638 16.49846 19.26556 17.16621 18.25278 37.58492 100
+#> runThread(1) 27.52315 27.74998 28.83332 28.43341 29.14889 37.38419 100
+#> runThread(2) 16.35291 16.88591 19.05743 17.39389 19.59169 28.23953 100
+#> runThread(3) 17.63698 18.94453 19.71197 19.56353 20.12006 25.34988 100
+#> runThread(4) 15.90711 16.26722 18.68598 16.79267 17.36888 41.41148 100
autoplot(bench)
@@ -674,8 +674,8 @@ Increasing speed with compiler o
print(bench)
#> Unit: milliseconds
#> expr min lq mean median uq max neval
-#> standardCompile 198.4301 316.9086 326.3612 321.0555 338.1012 398.3201 100
-#> fastCompile 191.7812 319.8152 327.5245 323.8790 334.6548 385.4462 100
+#> standardCompile 191.6286 306.4533 312.6785 309.1190 317.2356 362.8603 100
+#> fastCompile 190.9105 304.4759 309.0352 305.7667 310.6558 355.6306 100
autoplot(bench)
@@ -769,7 +769,7 @@ A real life exampleStoplapply <- Sys.time()
print(Stoplapply - Startlapply)
-#> Time difference of 13.77648 secs
+#> Time difference of 12.40183 secs
By applying some of the new parallel solving concepts you can simply
run the same simulation both with less code and faster:
@@ -810,7 +810,7 @@ A real life exampleres <- rxSolve(rx, ev, omega=omega, returnType="data.table")
endParallel <- Sys.time()
print(endParallel - startParallel)
-#> Time difference of 0.1125503 secs
+#> Time difference of 0.1078572 secs
You can see a striking time difference between the two methods; A few
things to keep in mind:
@@ -878,7 +878,7 @@ Session Information#>
#> loaded via a namespace (and not attached):
#> [1] gtable_0.3.4 xfun_0.41 bslib_0.6.1
-#> [4] RApiSerialize_0.1.2 lattice_0.21-9 vctrs_0.6.4
+#> [4] RApiSerialize_0.1.2 lattice_0.21-9 vctrs_0.6.5
#> [7] tools_4.3.2 generics_0.1.3 tibble_3.2.1
#> [10] symengine_0.2.2 fansi_1.0.5 highr_0.10
#> [13] pkgconfig_2.0.3 checkmate_2.3.0 desc_1.4.2
@@ -890,17 +890,17 @@ Session Information#> [31] crayon_1.5.2 jquerylib_0.1.4 cachem_1.0.8
#> [34] nlme_3.1-163 tidyselect_1.2.0 digest_0.6.33
#> [37] lotri_0.4.4 stringi_1.8.2 dplyr_1.1.4
-#> [40] purrr_1.0.2 rxode2ll_2.0.11.9000 rprojroot_2.0.4
-#> [43] fastmap_1.1.1 grid_4.3.2 colorspace_2.1-0
-#> [46] rxode2parse_2.0.17 cli_3.6.1 dparser_1.3.1-11
-#> [49] magrittr_2.0.3 utf8_1.2.4 withr_2.5.2
-#> [52] scales_1.3.0 backports_1.4.1 rmarkdown_2.25
-#> [55] ragg_1.2.6 stringfish_0.16.0 memoise_2.0.1
-#> [58] evaluate_0.23 knitr_1.45 rex_1.2.1
-#> [61] rxode2et_2.0.11 rxode2random_2.0.12 PreciseSums_0.6
-#> [64] rlang_1.1.2 Rcpp_1.0.11 glue_1.6.2
-#> [67] jsonlite_1.8.7 R6_2.5.1 systemfonts_1.0.5
-#> [70] fs_1.6.3 units_0.8-5
+#> [40] purrr_1.0.2 labeling_0.4.3 rxode2ll_2.0.11.9000
+#> [43] rprojroot_2.0.4 fastmap_1.1.1 grid_4.3.2
+#> [46] colorspace_2.1-0 rxode2parse_2.0.17 cli_3.6.1
+#> [49] dparser_1.3.1-11 magrittr_2.0.3 utf8_1.2.4
+#> [52] withr_2.5.2 scales_1.3.0 backports_1.4.1
+#> [55] rmarkdown_2.25 ragg_1.2.6 stringfish_0.16.0
+#> [58] memoise_2.0.1 evaluate_0.23 knitr_1.45
+#> [61] rex_1.2.1 rxode2et_2.0.11 rxode2random_2.0.12
+#> [64] PreciseSums_0.6 rlang_1.1.2 Rcpp_1.0.11
+#> [67] glue_1.6.2 jsonlite_1.8.7 R6_2.5.1
+#> [70] systemfonts_1.0.5 fs_1.6.3 units_0.8-5
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
summary(pbpk)
#> rxode2 2.0.14.9000 model named rx_a9ab0a308fe15e1ad382edd63f19620d model (ready).
-#> DLL: /tmp/Rtmp5mYcCf/rxode2/rx_a9ab0a308fe15e1ad382edd63f19620d__.rxd/rx_a9ab0a308fe15e1ad382edd63f19620d_.so
+#> rxode2 2.0.14.9000 model named rx_e83f7a9651e77506967130f7b1c210ca model (ready).
+#> DLL: /tmp/RtmpE4aPra/rxode2/rx_e83f7a9651e77506967130f7b1c210ca__.rxd/rx_e83f7a9651e77506967130f7b1c210ca_.so
#> NULL
#>
#> Calculated Variables:
@@ -731,7 +731,7 @@ Appending compartments to the model
ode.1c.ka$simulationModel
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
-#> rxode2 2.0.14.9000 model named rx_a34f770c8ba668b242ec15fd28a802d9 model (ready).
+#> rxode2 2.0.14.9000 model named rx_e282a6cb08725b6bc480b4e3d4df4b56 model (ready).
#> x$state: depot, center
#> x$stateExtra: eff
#> x$params: V, KA, CL
diff --git a/articles/rxode2-covariates.html b/articles/rxode2-covariates.html
index 89b245b0b..1450b00e7 100644
--- a/articles/rxode2-covariates.html
+++ b/articles/rxode2-covariates.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
rxode2 Covariates
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-covariates.Rmd
rxode2-covariates.Rmd
diff --git a/articles/rxode2-data-frame.html b/articles/rxode2-data-frame.html
index 73a97d5b2..76461fe5e 100644
--- a/articles/rxode2-data-frame.html
+++ b/articles/rxode2-data-frame.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
rxode2 Data Frames
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-data-frame.Rmd
rxode2-data-frame.Rmd
diff --git a/articles/rxode2-datasets.html b/articles/rxode2-datasets.html
index b62ea742c..fe67d1ada 100644
--- a/articles/rxode2-datasets.html
+++ b/articles/rxode2-datasets.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
rxode2 Event Types
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-datasets.Rmd
rxode2-datasets.Rmd
diff --git a/articles/rxode2-event-table.html b/articles/rxode2-event-table.html
index d1f676411..bc620b706 100644
--- a/articles/rxode2-event-table.html
+++ b/articles/rxode2-event-table.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
Easy rxode2 Event Tables
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-event-table.Rmd
rxode2-event-table.Rmd
diff --git a/articles/rxode2-event-types.html b/articles/rxode2-event-types.html
index 29fc91536..3ed66b28f 100644
--- a/articles/rxode2-event-types.html
+++ b/articles/rxode2-event-types.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
rxode2 Event Types
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-event-types.Rmd
rxode2-event-types.Rmd
diff --git a/articles/rxode2-events-classic.html b/articles/rxode2-events-classic.html
index b9a59accb..42176da80 100644
--- a/articles/rxode2-events-classic.html
+++ b/articles/rxode2-events-classic.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
Classic rxode2 Events
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-events-classic.Rmd
rxode2-events-classic.Rmd
diff --git a/articles/rxode2-intro.html b/articles/rxode2-intro.html
index ff6fe94ff..9e55143d4 100644
--- a/articles/rxode2-intro.html
+++ b/articles/rxode2-intro.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
Introduction to rxode2
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-intro.Rmd
rxode2-intro.Rmd
diff --git a/articles/rxode2-model-types.html b/articles/rxode2-model-types.html
index c6a45165e..0665d071e 100644
--- a/articles/rxode2-model-types.html
+++ b/articles/rxode2-model-types.html
@@ -162,7 +162,7 @@ Advanced Features, Model Types, Techni
rxode2 additional model types
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-model-types.Rmd
rxode2-model-types.Rmd
@@ -237,18 +237,18 @@ Solved compartment modelsVC or V
),
Peripheral/Tissue (VP
, VT
). While more
translations are available, some example translations are below:
-
-Another popular parameterization is in terms of micro-constants.
+
+Another popular parameterization is in terms of micro-constants.
rxode2 assumes compartment 1
is the central compartment.
The elimination constant would be specified by K
,
Ke
or Kel
. Some example translations are
below:
-
-The last parameterization possible is using alpha
and
+
+The last parameterization possible is using alpha
and
V
and/or A
/B
/C
. Some
example translations are below:
-
-Once the linCmt()
sleuthing is complete, the
+
+Once the linCmt()
sleuthing is complete, the
1
, 2
or 3
compartment model
solution is used as the value of linCmt()
.
The compartments where you can dose in a linear solved system are
diff --git a/articles/rxode2-nesting.html b/articles/rxode2-nesting.html
index bbf9ea12e..04181079c 100644
--- a/articles/rxode2-nesting.html
+++ b/articles/rxode2-nesting.html
@@ -157,7 +157,7 @@
Advanced Features, Model Types, Techni
Nesting levels in rxode2
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-nesting.Rmd
rxode2-nesting.Rmd
@@ -312,24 +312,24 @@ Uncertainty in Model parametersdimnames(tMat) <- list(names(theta), names(theta))
tMat
-#> TKA TCl V2 Q V3
-#> TKA 0.091283564 -0.068572309 -0.021058603 0.051974567 0.035090728
-#> TCl -0.068572309 0.159500450 0.021955940 -0.033815812 0.019583567
-#> V2 -0.021058603 0.021955940 0.038136753 -0.015179898 0.017702364
-#> Q 0.051974567 -0.033815812 -0.015179898 0.179281300 0.084678596
-#> V3 0.035090728 0.019583567 0.017702364 0.084678596 0.094222614
-#> Kin -0.021023944 0.046353050 0.004554589 -0.052996743 -0.044415064
-#> Kout -0.007146270 -0.001840578 0.012059396 -0.006507225 -0.004639813
-#> EC50 0.001406257 -0.055571475 0.003785865 0.032559017 -0.019434394
+#> TKA TCl V2 Q V3
+#> TKA 0.11351272 -0.046152020 0.027935822 0.022304492 -0.01180844
+#> TCl -0.04615202 0.058314039 -0.020962093 -0.002400837 -0.03939416
+#> V2 0.02793582 -0.020962093 0.040095192 -0.032248068 -0.02460253
+#> Q 0.02230449 -0.002400837 -0.032248068 0.100788522 0.02896160
+#> V3 -0.01180844 -0.039394160 -0.024602530 0.028961599 0.17871543
+#> Kin 0.05598072 -0.037818788 0.018273854 0.014698885 0.01211345
+#> Kout 0.04256859 0.028764542 -0.017538342 0.053881910 -0.06229732
+#> EC50 0.03982818 -0.035924606 0.003886435 0.041573070 -0.07322727
#> Kin Kout EC50
-#> TKA -0.021023944 -0.007146270 0.001406257
-#> TCl 0.046353050 -0.001840578 -0.055571475
-#> V2 0.004554589 0.012059396 0.003785865
-#> Q -0.052996743 -0.006507225 0.032559017
-#> V3 -0.044415064 -0.004639813 -0.019434394
-#> Kin 0.097337411 -0.010167878 -0.001557061
-#> Kout -0.010167878 0.027566158 0.019229527
-#> EC50 -0.001557061 0.019229527 0.064498809
+#> TKA 0.055980719 0.042568594 0.039828180
+#> TCl -0.037818788 0.028764542 -0.035924606
+#> V2 0.018273854 -0.017538342 0.003886435
+#> Q 0.014698885 0.053881910 0.041573070
+#> V3 0.012113446 -0.062297320 -0.073227270
+#> Kin 0.157348093 -0.008763337 0.055861453
+#> Kout -0.008763337 0.105270344 0.036356337
+#> EC50 0.055861453 0.036356337 0.161512221
Nesting Variability
@@ -407,16 +407,16 @@ Solving the problem#> # A tibble: 8,000 x 24
#> sim.id id `inv.Cl(inv==1)` `inv.Cl(inv==2)` `inv.Ka(inv==1)`
#> <int> <fct> <dbl> <dbl> <dbl>
-#> 1 1 1 -0.148 -0.132 -0.000571
-#> 2 1 2 -0.148 -0.132 -0.000571
-#> 3 1 3 -0.148 -0.132 -0.000571
-#> 4 1 4 -0.148 -0.132 -0.000571
-#> 5 1 5 -0.148 -0.132 -0.000571
-#> 6 1 6 -0.148 -0.132 -0.000571
-#> 7 1 7 -0.148 -0.132 -0.000571
-#> 8 1 8 -0.148 -0.132 -0.000571
-#> 9 1 9 -0.148 -0.132 -0.000571
-#> 10 1 10 -0.148 -0.132 -0.000571
+#> 1 1 1 -0.0391 -0.0265 -0.00221
+#> 2 1 2 -0.0391 -0.0265 -0.00221
+#> 3 1 3 -0.0391 -0.0265 -0.00221
+#> 4 1 4 -0.0391 -0.0265 -0.00221
+#> 5 1 5 -0.0391 -0.0265 -0.00221
+#> 6 1 6 -0.0391 -0.0265 -0.00221
+#> 7 1 7 -0.0391 -0.0265 -0.00221
+#> 8 1 8 -0.0391 -0.0265 -0.00221
+#> 9 1 9 -0.0391 -0.0265 -0.00221
+#> 10 1 10 -0.0391 -0.0265 -0.00221
#> # i 7,990 more rows
#> # i 19 more variables: `inv.Ka(inv==2)` <dbl>, `eye.Cl(eye==1)` <dbl>,
#> # `eye.Cl(eye==2)` <dbl>, `eye.Ka(eye==1)` <dbl>, `eye.Ka(eye==2)` <dbl>,
@@ -433,17 +433,17 @@ Solving the problem#>
#> -- First part of data (object): --
#> # A tibble: 976,000 x 21
-#> sim.id id time inv.Cl inv.Ka eye.Cl eye.Ka iov.Cl iov.Ka C2 C3
-#> <int> <int> [h] <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
-#> 1 1 1 0 -0.148 -0.000571 0.702 -0.915 0.0816 0.0896 0 0
-#> 2 1 1 0.1 -0.148 -0.000571 -0.277 -0.0671 0.0816 0.0896 1.25 0.00269
-#> 3 1 1 4 -0.148 -0.000571 0.702 -0.915 0.0816 0.0896 39.4 3.93
-#> 4 1 1 4.1 -0.148 -0.000571 -0.277 -0.0671 0.0816 0.0896 49.6 4.04
-#> 5 1 1 8 -0.148 -0.000571 0.702 -0.915 0.0816 0.0896 36.3 7.33
-#> 6 1 1 8.1 -0.148 -0.000571 -0.277 -0.0671 0.0816 0.0896 23.3 7.39
+#> sim.id id time inv.Cl inv.Ka eye.Cl eye.Ka iov.Cl iov.Ka C2
+#> <int> <int> [h] <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
+#> 1 1 1 0 -0.0391 -0.00221 -0.0365 -0.0566 0.0675 -0.0702 0
+#> 2 1 1 0.1 -0.0391 -0.00221 -0.362 0.0975 0.0675 -0.0702 -2.56
+#> 3 1 1 4 -0.0391 -0.00221 -0.0365 -0.0566 0.0675 -0.0702 -81.7
+#> 4 1 1 4.1 -0.0391 -0.00221 -0.362 0.0975 0.0675 -0.0702 -86.0
+#> 5 1 1 8 -0.0391 -0.00221 -0.0365 -0.0566 0.0675 -0.0702 -235.
+#> 6 1 1 8.1 -0.0391 -0.00221 -0.362 0.0975 0.0675 -0.0702 -169.
#> # i 975,994 more rows
-#> # i 10 more variables: CL <dbl>, KA <dbl>, ef0 <dbl>, depot <dbl>, centr <dbl>,
-#> # peri <dbl>, eff <dbl>, occ <fct>, eye <fct>, inv <fct>
+#> # i 11 more variables: C3 <dbl>, CL <dbl>, KA <dbl>, ef0 <dbl>, depot <dbl>,
+#> # centr <dbl>, peri <dbl>, eff <dbl>, occ <fct>, eye <fct>, inv <fct>
There are multiple investigators in a study; Each investigator has a
number of individuals enrolled at their site. rxode2
automatically determines the number of investigators and then will
@@ -462,63 +462,63 @@
Solving the problem
print(head(s$params))
#> sim.id id inv.Cl(inv==1) inv.Cl(inv==2) inv.Ka(inv==1) inv.Ka(inv==2)
-#> 1 1 1 -0.1480315 -0.1323712 -0.0005714332 0.08559259
-#> 2 1 2 -0.1480315 -0.1323712 -0.0005714332 0.08559259
-#> 3 1 3 -0.1480315 -0.1323712 -0.0005714332 0.08559259
-#> 4 1 4 -0.1480315 -0.1323712 -0.0005714332 0.08559259
-#> 5 1 5 -0.1480315 -0.1323712 -0.0005714332 0.08559259
-#> 6 1 6 -0.1480315 -0.1323712 -0.0005714332 0.08559259
+#> 1 1 1 -0.03911994 -0.02646643 -0.00220576 -0.1141159
+#> 2 1 2 -0.03911994 -0.02646643 -0.00220576 -0.1141159
+#> 3 1 3 -0.03911994 -0.02646643 -0.00220576 -0.1141159
+#> 4 1 4 -0.03911994 -0.02646643 -0.00220576 -0.1141159
+#> 5 1 5 -0.03911994 -0.02646643 -0.00220576 -0.1141159
+#> 6 1 6 -0.03911994 -0.02646643 -0.00220576 -0.1141159
#> eye.Cl(eye==1) eye.Cl(eye==2) eye.Ka(eye==1) eye.Ka(eye==2) iov.Cl(occ==1)
-#> 1 0.70186234 -0.27732005 -0.915347545 -0.06709872 0.08164632
-#> 2 0.12461103 -0.22840762 -0.183417034 -0.05335536 0.02906715
-#> 3 -0.11718627 0.08188798 0.009429659 0.15021773 0.24113638
-#> 4 0.06090385 -0.32973251 0.139530066 -0.18749762 0.03151548
-#> 5 0.10903320 0.02315588 -0.279554496 -0.35864036 0.01036085
-#> 6 -0.27158388 -0.15547165 -0.153497112 -0.06469808 0.04908725
-#> iov.Cl(occ==2) iov.Ka(occ==1) iov.Ka(occ==2) V2 V3 TCl
-#> 1 0.294447042 0.089582665 0.13833348 40.31123 296.704 18.12202
-#> 2 -0.018486651 0.004075217 0.10875214 40.31123 296.704 18.12202
-#> 3 0.127857862 -0.060962525 -0.09452202 40.31123 296.704 18.12202
-#> 4 -0.203070657 0.025916649 0.37173955 40.31123 296.704 18.12202
-#> 5 -0.006504903 -0.043367120 -0.12604635 40.31123 296.704 18.12202
-#> 6 0.051101039 -0.097513628 -0.11446093 40.31123 296.704 18.12202
-#> eta.Cl TKA eta.Ka Q Kin Kout EC50
-#> 1 0.18588661 0.1850192 -0.201815537 10.26808 0.7761331 1.285074 200.3064
-#> 2 0.24056866 0.1850192 -0.003196246 10.26808 0.7761331 1.285074 200.3064
-#> 3 0.13228555 0.1850192 -0.629686258 10.26808 0.7761331 1.285074 200.3064
-#> 4 -0.38391078 0.1850192 0.560212037 10.26808 0.7761331 1.285074 200.3064
-#> 5 0.14257398 0.1850192 -0.150690952 10.26808 0.7761331 1.285074 200.3064
-#> 6 0.09652758 0.1850192 -0.549121466 10.26808 0.7761331 1.285074 200.3064
+#> 1 -0.03645376 -0.36231031 -0.05659512 0.09754696 0.067525518
+#> 2 -0.15423162 0.17628371 0.17033619 -0.25543769 0.003339573
+#> 3 0.01370540 -0.12667985 -0.36326997 -0.46382367 -0.040701460
+#> 4 0.20520923 -0.13916146 -0.24406546 0.14638320 0.126635992
+#> 5 0.62095573 0.16708951 -0.03264761 -0.30743926 0.066111000
+#> 6 -0.01113059 0.07142361 0.04510525 -0.09699871 0.007549183
+#> iov.Cl(occ==2) iov.Ka(occ==1) iov.Ka(occ==2) V2 V3 TCl
+#> 1 0.047393997 -0.070219903 -0.075319128 40.22524 297.4692 18.60184
+#> 2 0.044187327 -0.003843144 0.107574203 40.22524 297.4692 18.60184
+#> 3 0.130975748 0.122989836 -0.074852264 40.22524 297.4692 18.60184
+#> 4 -0.084189574 -0.163824725 -0.020576261 40.22524 297.4692 18.60184
+#> 5 0.003705417 0.065585679 0.003578391 40.22524 297.4692 18.60184
+#> 6 -0.038608539 0.161036185 0.144121117 40.22524 297.4692 18.60184
+#> eta.Cl TKA eta.Ka Q Kin Kout EC50
+#> 1 -0.1047263 -0.1221477 -0.08809663 10.26499 1.051154 0.6049542 199.646
+#> 2 0.6465167 -0.1221477 0.02602436 10.26499 1.051154 0.6049542 199.646
+#> 3 -0.4423746 -0.1221477 -0.24399657 10.26499 1.051154 0.6049542 199.646
+#> 4 -0.1156852 -0.1221477 -0.38145785 10.26499 1.051154 0.6049542 199.646
+#> 5 -0.3741853 -0.1221477 0.08673172 10.26499 1.051154 0.6049542 199.646
+#> 6 -0.1652379 -0.1221477 0.17428125 10.26499 1.051154 0.6049542 199.646
#> sim.id id inv.Cl(inv==1) inv.Cl(inv==2) inv.Ka(inv==1) inv.Ka(inv==2)
-#> 1 2 1 0.001613993 -0.1655022 0.1074734 0.02238288
-#> 2 2 2 0.001613993 -0.1655022 0.1074734 0.02238288
-#> 3 2 3 0.001613993 -0.1655022 0.1074734 0.02238288
-#> 4 2 4 0.001613993 -0.1655022 0.1074734 0.02238288
-#> 5 2 5 0.001613993 -0.1655022 0.1074734 0.02238288
-#> 6 2 6 0.001613993 -0.1655022 0.1074734 0.02238288
+#> 1 2 1 0.1016724 -0.05768568 -0.08969302 0.03548156
+#> 2 2 2 0.1016724 -0.05768568 -0.08969302 0.03548156
+#> 3 2 3 0.1016724 -0.05768568 -0.08969302 0.03548156
+#> 4 2 4 0.1016724 -0.05768568 -0.08969302 0.03548156
+#> 5 2 5 0.1016724 -0.05768568 -0.08969302 0.03548156
+#> 6 2 6 0.1016724 -0.05768568 -0.08969302 0.03548156
#> eye.Cl(eye==1) eye.Cl(eye==2) eye.Ka(eye==1) eye.Ka(eye==2) iov.Cl(occ==1)
-#> 1 -0.06492477 0.2103290 -0.258234272 -0.65555476 0.05581626
-#> 2 0.29221373 0.1291948 -0.001047067 -0.06049668 0.18612125
-#> 3 0.18355366 0.2809128 -0.006091777 -0.07121414 -0.07860149
-#> 4 0.51729297 -0.2746913 0.296216014 0.19018619 -0.01220883
-#> 5 0.09854127 0.1244885 0.051972718 0.02492854 -0.05869592
-#> 6 -0.21757059 0.1180519 0.265363855 -0.02517008 0.21103990
+#> 1 0.250679613 0.399887417 -0.18995157 -0.22979544 0.053010451
+#> 2 -0.193811345 -0.006759532 -0.28266541 -0.01564961 0.015378941
+#> 3 0.371815629 -0.399223456 -0.16225912 -0.15531978 -0.042915258
+#> 4 0.079688048 0.133151472 0.05655038 -0.01512107 -0.009710154
+#> 5 0.249691829 0.042461982 -0.02856142 -0.10260240 0.092573502
+#> 6 -0.004927963 0.031402455 -0.12693507 -0.29047920 -0.243391645
#> iov.Cl(occ==2) iov.Ka(occ==1) iov.Ka(occ==2) V2 V3 TCl
-#> 1 0.08770510 -0.1213494181 -0.07194749 40.40494 296.9874 18.59039
-#> 2 -0.06866621 -0.0034025289 0.03800002 40.40494 296.9874 18.59039
-#> 3 -0.12655918 -0.0784557848 0.12632977 40.40494 296.9874 18.59039
-#> 4 -0.03565934 -0.0007239254 -0.16161576 40.40494 296.9874 18.59039
-#> 5 0.02553487 0.1917256083 -0.31148491 40.40494 296.9874 18.59039
-#> 6 0.01985213 -0.0201123515 -0.16279535 40.40494 296.9874 18.59039
-#> eta.Cl TKA eta.Ka Q Kin Kout EC50
-#> 1 -0.30400507 0.1844716 0.11056784 10.33659 1.137549 0.9891969 200.0611
-#> 2 0.49634073 0.1844716 -0.05259496 10.33659 1.137549 0.9891969 200.0611
-#> 3 -0.07096015 0.1844716 -0.10609177 10.33659 1.137549 0.9891969 200.0611
-#> 4 0.08067657 0.1844716 0.25228398 10.33659 1.137549 0.9891969 200.0611
-#> 5 0.24616432 0.1844716 0.01271617 10.33659 1.137549 0.9891969 200.0611
-#> 6 -0.05820859 0.1844716 0.33222285 10.33659 1.137549 0.9891969 200.0611
+#> 1 0.05409047 0.04639233 -0.016095257 40.13468 297.0358 18.65192
+#> 2 0.10716852 -0.19118988 0.031572133 40.13468 297.0358 18.65192
+#> 3 -0.11725361 0.08095280 0.009272479 40.13468 297.0358 18.65192
+#> 4 0.06973915 0.11504560 0.128600039 40.13468 297.0358 18.65192
+#> 5 -0.21141943 -0.13882216 -0.107488100 40.13468 297.0358 18.65192
+#> 6 -0.19620243 0.01039522 -0.073640426 40.13468 297.0358 18.65192
+#> eta.Cl TKA eta.Ka Q Kin Kout EC50
+#> 1 0.073463560 0.2512785 -0.1195763 10.76278 0.3278979 1.321924 199.9834
+#> 2 0.006689739 0.2512785 -0.4004964 10.76278 0.3278979 1.321924 199.9834
+#> 3 0.121008344 0.2512785 0.2765039 10.76278 0.3278979 1.321924 199.9834
+#> 4 -0.277748970 0.2512785 0.2491093 10.76278 0.3278979 1.321924 199.9834
+#> 5 -0.216971611 0.2512785 -0.5772672 10.76278 0.3278979 1.321924 199.9834
+#> 6 -0.345436538 0.2512785 -0.1102403 10.76278 0.3278979 1.321924 199.9834
For between eye variability and between occasion variability each
individual simulates a number of variables that become the between eye
and between occasion variability; In the case of the eye:
diff --git a/articles/rxode2-pipeline.html b/articles/rxode2-pipeline.html
index 668521277..acbb541ea 100644
--- a/articles/rxode2-pipeline.html
+++ b/articles/rxode2-pipeline.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
rxode2 in a pipeline
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-pipeline.Rmd
rxode2-pipeline.Rmd
diff --git a/articles/rxode2-plot.html b/articles/rxode2-plot.html
index 80386a362..f2bc5a5ad 100644
--- a/articles/rxode2-plot.html
+++ b/articles/rxode2-plot.html
@@ -159,7 +159,7 @@ Advanced Features, Model Types, Techni
Matthew
Fidler
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-plot.Rmd
rxode2-plot.Rmd
diff --git a/articles/rxode2-plot_files/figure-html/unnamed-chunk-10-1.png b/articles/rxode2-plot_files/figure-html/unnamed-chunk-10-1.png
index 4488265db..bd0d09772 100644
Binary files a/articles/rxode2-plot_files/figure-html/unnamed-chunk-10-1.png and b/articles/rxode2-plot_files/figure-html/unnamed-chunk-10-1.png differ
diff --git a/articles/rxode2-plot_files/figure-html/unnamed-chunk-6-1.png b/articles/rxode2-plot_files/figure-html/unnamed-chunk-6-1.png
index b2e76dca3..02d5dca91 100644
Binary files a/articles/rxode2-plot_files/figure-html/unnamed-chunk-6-1.png and b/articles/rxode2-plot_files/figure-html/unnamed-chunk-6-1.png differ
diff --git a/articles/rxode2-plot_files/figure-html/unnamed-chunk-7-1.png b/articles/rxode2-plot_files/figure-html/unnamed-chunk-7-1.png
index 64b3cd09c..08167a148 100644
Binary files a/articles/rxode2-plot_files/figure-html/unnamed-chunk-7-1.png and b/articles/rxode2-plot_files/figure-html/unnamed-chunk-7-1.png differ
diff --git a/articles/rxode2-plot_files/figure-html/unnamed-chunk-8-1.png b/articles/rxode2-plot_files/figure-html/unnamed-chunk-8-1.png
index 11b757c6f..5a23368d2 100644
Binary files a/articles/rxode2-plot_files/figure-html/unnamed-chunk-8-1.png and b/articles/rxode2-plot_files/figure-html/unnamed-chunk-8-1.png differ
diff --git a/articles/rxode2-prior-data.html b/articles/rxode2-prior-data.html
index 3bf855491..8e775c13d 100644
--- a/articles/rxode2-prior-data.html
+++ b/articles/rxode2-prior-data.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
Using Prior Data for ODE solving
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-prior-data.Rmd
rxode2-prior-data.Rmd
@@ -242,33 +242,33 @@ Using prior data for solving#> ── Solved rxode2 object ──
#> ── Parameters ($params): ──
#> # A tibble: 12 × 7
-#> id tka tcl tv eta.ka eta.cl eta.v
-#> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
-#> 1 1 0.451 1.02 3.45 -0.781 0.0848 -0.154
-#> 2 2 0.451 1.02 3.45 -0.557 -0.116 -0.351
-#> 3 3 0.451 1.02 3.45 -0.170 -0.748 0.187
-#> 4 4 0.451 1.02 3.45 -0.382 -0.158 0.222
-#> 5 5 0.451 1.02 3.45 -0.161 -0.536 0.198
-#> 6 6 0.451 1.02 3.45 -0.405 0.0630 -0.159
-#> 7 7 0.451 1.02 3.45 0.216 0.476 -0.375
-#> 8 8 0.451 1.02 3.45 -0.630 0.000678 0.0844
-#> 9 9 0.451 1.02 3.45 1.05 -0.0449 -0.0207
-#> 10 10 0.451 1.02 3.45 0.918 0.250 -0.199
-#> 11 11 0.451 1.02 3.45 0.698 -0.119 -0.0334
-#> 12 12 0.451 1.02 3.45 0.103 -0.148 -0.208
+#> id tka tcl tv eta.ka eta.cl eta.v
+#> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
+#> 1 1 0.451 1.02 3.45 -0.111 1.08 0.0949
+#> 2 2 0.451 1.02 3.45 0.790 -0.884 0.294
+#> 3 3 0.451 1.02 3.45 0.592 -0.0302 -0.325
+#> 4 4 0.451 1.02 3.45 -1.55 0.183 0.430
+#> 5 5 0.451 1.02 3.45 -0.895 -0.608 0.0572
+#> 6 6 0.451 1.02 3.45 0.422 -0.362 -0.0614
+#> 7 7 0.451 1.02 3.45 0.0178 -0.000737 -0.338
+#> 8 8 0.451 1.02 3.45 -0.852 0.0517 -0.115
+#> 9 9 0.451 1.02 3.45 0.970 1.31 -0.0144
+#> 10 10 0.451 1.02 3.45 -0.0596 0.0197 0.465
+#> 11 11 0.451 1.02 3.45 1.23 0.483 0.104
+#> 12 12 0.451 1.02 3.45 2.27 0.178 -0.0347
#> ── Initial Conditions ($inits): ──
#> depot center
#> 0 0
#> ── First part of data (object): ──
#> # A tibble: 132 × 8
-#> id time ka cl v cp depot center
-#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
-#> 1 1 0 0.719 3.01 27.0 0 320. 0
-#> 2 1 0.25 0.719 3.01 27.0 1.92 267. 51.9
-#> 3 1 0.57 0.719 3.01 27.0 3.86 212. 104.
-#> 4 1 1.12 0.719 3.01 27.0 6.12 143. 165.
-#> 5 1 2.02 0.719 3.01 27.0 7.92 74.9 214.
-#> 6 1 3.82 0.719 3.01 27.0 8.27 20.5 223.
+#> id time ka cl v cp depot center
+#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
+#> 1 1 0 1.41 8.13 34.6 0 320. 0
+#> 2 1 0.25 1.41 8.13 34.6 2.66 225. 91.9
+#> 3 1 0.57 1.41 8.13 34.6 4.73 144. 164.
+#> 4 1 1.12 1.41 8.13 34.6 6.23 66.3 216.
+#> 5 1 2.02 1.41 8.13 34.6 6.26 18.7 217.
+#> 6 1 3.82 1.41 8.13 34.6 4.47 1.49 155.
#> # ℹ 126 more rows
## Of course the fasest way to solve if you don't care about the rxode2 extra parameters is
@@ -280,33 +280,33 @@ Using prior data for solving## solved data
dplyr::as_tibble(solveData)
#> # A tibble: 132 × 8
-#> id time ka cl v cp depot center
-#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
-#> 1 1 0 1.43 2.37 20.9 0 320. 0
-#> 2 1 0.25 1.43 2.37 20.9 4.54 224. 94.9
-#> 3 1 0.57 1.43 2.37 20.9 8.24 141. 172.
-#> 4 1 1.12 1.43 2.37 20.9 11.3 64.3 236.
-#> 5 1 2.02 1.43 2.37 20.9 12.3 17.7 257.
-#> 6 1 3.82 1.43 2.37 20.9 10.7 1.34 224.
-#> 7 1 5.1 1.43 2.37 20.9 9.32 0.215 195.
-#> 8 1 7.03 1.43 2.37 20.9 7.49 0.0135 157.
-#> 9 1 9.05 1.43 2.37 20.9 5.96 0.000750 125.
-#> 10 1 12.1 1.43 2.37 20.9 4.21 0.00000922 88.0
+#> id time ka cl v cp depot center
+#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
+#> 1 1 0 1.71 1.89 30.2 0 320. 0
+#> 2 1 0.25 1.71 1.89 30.2 3.67 208. 111.
+#> 3 1 0.57 1.71 1.89 30.2 6.48 120. 195.
+#> 4 1 1.12 1.71 1.89 30.2 8.65 46.9 261.
+#> 5 1 2.02 1.71 1.89 30.2 9.36 10.0 282.
+#> 6 1 3.82 1.71 1.89 30.2 8.65 0.458 261.
+#> 7 1 5.1 1.71 1.89 30.2 7.99 0.0510 241.
+#> 8 1 7.03 1.71 1.89 30.2 7.08 0.00187 214.
+#> 9 1 9.05 1.71 1.89 30.2 6.24 0.0000585 188.
+#> 10 1 12.1 1.71 1.89 30.2 5.14 0.000000303 155.
#> # ℹ 122 more rows
data.table::data.table(solveData)
-#> id time ka cl v cp depot center
-#> 1: 1 0.00 1.432501 2.368460 20.90624 0.000000 3.199920e+02 0.00000
-#> 2: 1 0.25 1.432501 2.368460 20.90624 4.538880 2.236698e+02 94.89089
-#> 3: 1 0.57 1.432501 2.368460 20.90624 8.235471 1.414251e+02 172.17270
-#> 4: 1 1.12 1.432501 2.368460 20.90624 11.299036 6.432153e+01 236.22032
-#> 5: 1 2.02 1.432501 2.368460 20.90624 12.300463 1.771909e+01 257.15637
-#> ---
-#> 128: 12 5.07 1.848827 1.806708 33.37071 7.521671 2.723616e-02 251.00351
-#> 129: 12 7.07 1.848827 1.806708 33.37071 6.750496 6.749527e-04 225.26884
-#> 130: 12 9.03 1.848827 1.806708 33.37071 6.070879 1.801074e-05 202.58956
-#> 131: 12 12.05 1.848827 1.806708 33.37071 5.155165 6.836463e-08 172.03152
-#> 132: 12 24.15 1.848827 1.806708 33.37071 2.677546 -1.208373e-09 89.35161
+#> id time ka cl v cp depot center
+#> 1: 1 0.00 1.7144281 1.894881 30.15945 0.000000 3.199920e+02 0.00000
+#> 2: 1 0.25 1.7144281 1.894881 30.15945 3.667532 2.084479e+02 110.61077
+#> 3: 1 0.57 1.7144281 1.894881 30.15945 6.481148 1.204305e+02 195.46789
+#> 4: 1 1.12 1.7144281 1.894881 30.15945 8.650838 4.690556e+01 260.90455
+#> 5: 1 2.02 1.7144281 1.894881 30.15945 9.355834 1.002568e+01 282.16685
+#> ---
+#> 128: 12 5.07 0.9835705 2.109641 29.75338 8.027812 2.189436e+00 238.85453
+#> 129: 12 7.07 0.9835705 2.109641 29.75338 7.024162 3.062054e-01 208.99254
+#> 130: 12 9.03 0.9835705 2.109641 29.75338 6.120830 4.454303e-02 182.11538
+#> 131: 12 12.05 0.9835705 2.109641 29.75338 4.942216 2.284322e-03 147.04762
+#> 132: 12 24.15 0.9835705 2.109641 29.75338 2.095704 1.520669e-08 62.35429
diff --git a/articles/rxode2-prior-data_files/figure-html/unnamed-chunk-5-1.png b/articles/rxode2-prior-data_files/figure-html/unnamed-chunk-5-1.png
index ca81c5f1d..41f808f5e 100644
Binary files a/articles/rxode2-prior-data_files/figure-html/unnamed-chunk-5-1.png and b/articles/rxode2-prior-data_files/figure-html/unnamed-chunk-5-1.png differ
diff --git a/articles/rxode2-rxUse.html b/articles/rxode2-rxUse.html
index f73eb96e6..70f365d00 100644
--- a/articles/rxode2-rxUse.html
+++ b/articles/rxode2-rxUse.html
@@ -159,7 +159,7 @@ Advanced Features, Model Types, Techni
Matthew
Fidler
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-rxUse.Rmd
rxode2-rxUse.Rmd
diff --git a/articles/rxode2-shiny.html b/articles/rxode2-shiny.html
index ab1697abd..9eef362d8 100644
--- a/articles/rxode2-shiny.html
+++ b/articles/rxode2-shiny.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
rxode2 and Shiny
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-shiny.Rmd
rxode2-shiny.Rmd
diff --git a/articles/rxode2-sim-var.html b/articles/rxode2-sim-var.html
index 1303db964..7d4c6e74e 100644
--- a/articles/rxode2-sim-var.html
+++ b/articles/rxode2-sim-var.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
rxode2 Simulation
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-sim-var.Rmd
rxode2-sim-var.Rmd
diff --git a/articles/rxode2-single-subject.html b/articles/rxode2-single-subject.html
index ca355d563..1408b4dfe 100644
--- a/articles/rxode2-single-subject.html
+++ b/articles/rxode2-single-subject.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
Single Subject ODE solving -- differences from multiple subject
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-single-subject.Rmd
rxode2-single-subject.Rmd
diff --git a/articles/rxode2-speed.html b/articles/rxode2-speed.html
index 694b4f841..e7669db17 100644
--- a/articles/rxode2-speed.html
+++ b/articles/rxode2-speed.html
@@ -159,7 +159,7 @@ Advanced Features, Model Types, Techni
Matthew
Fidler
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-speed.Rmd
rxode2-speed.Rmd
@@ -262,8 +262,8 @@ A note about t
output. You can see the differences below:
summary(mod1$simulationModel)
-#> rxode2 2.0.14.9000 model named rx_f6df81dba92d362c7c658b7dd040332b model (✔ ready).
-#> DLL: /tmp/Rtmp5mYcCf/rxode2/rx_f6df81dba92d362c7c658b7dd040332b__.rxd/rx_f6df81dba92d362c7c658b7dd040332b_.so
+#> rxode2 2.0.14.9000 model named rx_4080a1bccb3d88a72efd4eb95d275c3f model (✔ ready).
+#> DLL: /tmp/RtmpE4aPra/rxode2/rx_4080a1bccb3d88a72efd4eb95d275c3f__.rxd/rx_4080a1bccb3d88a72efd4eb95d275c3f_.so
#> NULL
#>
#> Calculated Variables:
@@ -281,8 +281,8 @@ A note about t
#> })
summary(mod1$simulationIniModel)
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
-#> rxode2 2.0.14.9000 model named rx_6a9a6e920d2935cba8f2ef73c0cfff04 model (✔ ready).
-#> DLL: /tmp/Rtmp5mYcCf/rxode2/rx_6a9a6e920d2935cba8f2ef73c0cfff04__.rxd/rx_6a9a6e920d2935cba8f2ef73c0cfff04_.so
+#> rxode2 2.0.14.9000 model named rx_79be712c1b8cfdbd11414aac387b190c model (✔ ready).
+#> DLL: /tmp/RtmpE4aPra/rxode2/rx_79be712c1b8cfdbd11414aac387b190c__.rxd/rx_79be712c1b8cfdbd11414aac387b190c_.so
#> NULL
#>
#> Calculated Variables:
@@ -308,8 +308,8 @@ A note about t
#> })
summary(mod2f$simulationModel)
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
-#> rxode2 2.0.14.9000 model named rx_2084cc55ccb1d18e4ccfa62790e1b6c6 model (✔ ready).
-#> DLL: /tmp/Rtmp5mYcCf/rxode2/rx_2084cc55ccb1d18e4ccfa62790e1b6c6__.rxd/rx_2084cc55ccb1d18e4ccfa62790e1b6c6_.so
+#> rxode2 2.0.14.9000 model named rx_39f78bb08fb42ed8474af31e234006ed model (✔ ready).
+#> DLL: /tmp/RtmpE4aPra/rxode2/rx_39f78bb08fb42ed8474af31e234006ed__.rxd/rx_39f78bb08fb42ed8474af31e234006ed_.so
#> NULL
#>
#> Calculated Variables:
@@ -365,8 +365,8 @@ A note about t
#> })
summary(mod2f$simulationIniModel)
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
-#> rxode2 2.0.14.9000 model named rx_1915c92e164f682e9bc352ac7211dc46 model (✔ ready).
-#> DLL: /tmp/Rtmp5mYcCf/rxode2/rx_1915c92e164f682e9bc352ac7211dc46__.rxd/rx_1915c92e164f682e9bc352ac7211dc46_.so
+#> rxode2 2.0.14.9000 model named rx_5453804681c56967a6be1d8cd0005130 model (✔ ready).
+#> DLL: /tmp/RtmpE4aPra/rxode2/rx_5453804681c56967a6be1d8cd0005130__.rxd/rx_5453804681c56967a6be1d8cd0005130_.so
#> NULL
#>
#> Calculated Variables:
@@ -552,10 +552,10 @@ Compare the times between all
print(bench)
#> Unit: milliseconds
#> expr min lq mean median uq max
-#> runFor() 274.52428 280.08363 288.84306 282.51682 285.47158 417.21426
-#> runSapply() 274.58491 281.29385 292.28574 283.44581 288.11469 420.43549
-#> runSingleThread() 28.13222 28.37132 29.85955 28.58462 28.80817 48.79048
-#> run2Thread() 16.78064 17.41015 18.47267 17.65783 17.96191 27.98068
+#> runFor() 271.77932 277.34620 284.72932 279.38768 282.35578 326.61336
+#> runSapply() 273.07732 277.02475 288.05530 279.45924 283.12016 398.42309
+#> runSingleThread() 27.44159 27.56624 28.56416 27.68545 27.97961 47.53934
+#> run2Thread() 16.31126 16.55615 18.04028 16.70647 17.06553 27.88397
#> neval
#> 100
#> 100
@@ -582,10 +582,10 @@ Compare the times between all
print(bench)
#> Unit: milliseconds
#> expr min lq mean median uq max neval
-#> runThread(1) 28.10950 28.39885 29.47866 29.60013 29.77615 40.06624 100
-#> runThread(2) 16.86474 17.50823 19.40572 17.87759 18.27338 30.41207 100
-#> runThread(3) 18.45526 19.11944 19.94110 19.68277 20.13565 26.65370 100
-#> runThread(4) 16.20638 16.49846 19.26556 17.16621 18.25278 37.58492 100
+#> runThread(1) 27.52315 27.74998 28.83332 28.43341 29.14889 37.38419 100
+#> runThread(2) 16.35291 16.88591 19.05743 17.39389 19.59169 28.23953 100
+#> runThread(3) 17.63698 18.94453 19.71197 19.56353 20.12006 25.34988 100
+#> runThread(4) 15.90711 16.26722 18.68598 16.79267 17.36888 41.41148 100
autoplot(bench)
@@ -674,8 +674,8 @@ Increasing speed with compiler o
print(bench)
#> Unit: milliseconds
#> expr min lq mean median uq max neval
-#> standardCompile 198.4301 316.9086 326.3612 321.0555 338.1012 398.3201 100
-#> fastCompile 191.7812 319.8152 327.5245 323.8790 334.6548 385.4462 100
+#> standardCompile 191.6286 306.4533 312.6785 309.1190 317.2356 362.8603 100
+#> fastCompile 190.9105 304.4759 309.0352 305.7667 310.6558 355.6306 100
autoplot(bench)
@@ -769,7 +769,7 @@ A real life exampleStoplapply <- Sys.time()
print(Stoplapply - Startlapply)
-#> Time difference of 13.77648 secs
+#> Time difference of 12.40183 secs
By applying some of the new parallel solving concepts you can simply
run the same simulation both with less code and faster:
@@ -810,7 +810,7 @@ A real life exampleres <- rxSolve(rx, ev, omega=omega, returnType="data.table")
endParallel <- Sys.time()
print(endParallel - startParallel)
-#> Time difference of 0.1125503 secs
+#> Time difference of 0.1078572 secs
You can see a striking time difference between the two methods; A few
things to keep in mind:
@@ -878,7 +878,7 @@ Session Information#>
#> loaded via a namespace (and not attached):
#> [1] gtable_0.3.4 xfun_0.41 bslib_0.6.1
-#> [4] RApiSerialize_0.1.2 lattice_0.21-9 vctrs_0.6.4
+#> [4] RApiSerialize_0.1.2 lattice_0.21-9 vctrs_0.6.5
#> [7] tools_4.3.2 generics_0.1.3 tibble_3.2.1
#> [10] symengine_0.2.2 fansi_1.0.5 highr_0.10
#> [13] pkgconfig_2.0.3 checkmate_2.3.0 desc_1.4.2
@@ -890,17 +890,17 @@ Session Information#> [31] crayon_1.5.2 jquerylib_0.1.4 cachem_1.0.8
#> [34] nlme_3.1-163 tidyselect_1.2.0 digest_0.6.33
#> [37] lotri_0.4.4 stringi_1.8.2 dplyr_1.1.4
-#> [40] purrr_1.0.2 rxode2ll_2.0.11.9000 rprojroot_2.0.4
-#> [43] fastmap_1.1.1 grid_4.3.2 colorspace_2.1-0
-#> [46] rxode2parse_2.0.17 cli_3.6.1 dparser_1.3.1-11
-#> [49] magrittr_2.0.3 utf8_1.2.4 withr_2.5.2
-#> [52] scales_1.3.0 backports_1.4.1 rmarkdown_2.25
-#> [55] ragg_1.2.6 stringfish_0.16.0 memoise_2.0.1
-#> [58] evaluate_0.23 knitr_1.45 rex_1.2.1
-#> [61] rxode2et_2.0.11 rxode2random_2.0.12 PreciseSums_0.6
-#> [64] rlang_1.1.2 Rcpp_1.0.11 glue_1.6.2
-#> [67] jsonlite_1.8.7 R6_2.5.1 systemfonts_1.0.5
-#> [70] fs_1.6.3 units_0.8-5
+#> [40] purrr_1.0.2 labeling_0.4.3 rxode2ll_2.0.11.9000
+#> [43] rprojroot_2.0.4 fastmap_1.1.1 grid_4.3.2
+#> [46] colorspace_2.1-0 rxode2parse_2.0.17 cli_3.6.1
+#> [49] dparser_1.3.1-11 magrittr_2.0.3 utf8_1.2.4
+#> [52] withr_2.5.2 scales_1.3.0 backports_1.4.1
+#> [55] rmarkdown_2.25 ragg_1.2.6 stringfish_0.16.0
+#> [58] memoise_2.0.1 evaluate_0.23 knitr_1.45
+#> [61] rex_1.2.1 rxode2et_2.0.11 rxode2random_2.0.12
+#> [64] PreciseSums_0.6 rlang_1.1.2 Rcpp_1.0.11
+#> [67] glue_1.6.2 jsonlite_1.8.7 R6_2.5.1
+#> [70] systemfonts_1.0.5 fs_1.6.3 units_0.8-5
Advanced Features, Model Types, Techni
rxode2 Transit Compartment Models
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-transit-compartments.Rmd
rxode2-transit-compartments.Rmd
diff --git a/articles/rxode2-wt.html b/articles/rxode2-wt.html
index d7c89fbc5..c74ad3d75 100644
--- a/articles/rxode2-wt.html
+++ b/articles/rxode2-wt.html
@@ -157,7 +157,7 @@ Advanced Features, Model Types, Techni
Weight Based Dosing in rxode2
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-wt.Rmd
rxode2-wt.Rmd
diff --git a/pkgdown.yml b/pkgdown.yml
index bd1d197dc..8a8cb5636 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -26,7 +26,7 @@ articles:
rxode2-transit-compartments: rxode2-transit-compartments.html
rxode2-tutorials: rxode2-tutorials.html
rxode2-wt: rxode2-wt.html
-last_built: 2023-12-03T18:44Z
+last_built: 2023-12-05T02:05Z
urls:
reference: https://nlmixr2.github.io/rxode2/reference
article: https://nlmixr2.github.io/rxode2/articles
diff --git a/reference/binomProbs.html b/reference/binomProbs.html
index ba7c2f274..ffcc048bc 100644
--- a/reference/binomProbs.html
+++ b/reference/binomProbs.html
@@ -282,21 +282,21 @@ Examplesx<- rbinom(7001, p=0.375, size=1)
binomProbs(x)
#> 2.5% 5% 50% 95% 97.5%
-#> 0.3738971 0.3757100 0.3852307 0.3948400 0.3966901
+#> 0.3659484 0.3677527 0.3772318 0.3868058 0.3886499
# you can also use the prediction interval
# \donttest{
binomProbs(x, pred=TRUE)
#> 2.5% 5% 50% 95% 97.5%
-#> 0.3690901 0.3718040 0.3852307 0.3988002 0.4013712
+#> 0.3612341 0.3638052 0.3772318 0.3906585 0.3933724
# }
# Can get some extra statistics if you request onlyProbs=FALSE
binomProbs(x, onlyProbs=FALSE)
#> mean var sd n 2.5% 5%
-#> 0.3852307 0.2368280 0.4866498 7001.0000000 0.3738971 0.3757100
+#> 0.3772318 0.2349280 0.4846937 7001.0000000 0.3659484 0.3677527
#> 50% 95% 97.5%
-#> 0.3852307 0.3948400 0.3966901
+#> 0.3772318 0.3868058 0.3886499
x[2] <- NA_real_
@@ -306,7 +306,7 @@ Examples
binomProbs(x, na.rm=TRUE)
#> 2.5% 5% 50% 95% 97.5%
-#> 0.3739510 0.3757641 0.3852857 0.3948960 0.3967463
+#> 0.3660012 0.3678056 0.3772857 0.3868606 0.3887049
diff --git a/reference/dot-rxWithWd.html b/reference/dot-rxWithWd.html
index ef964da61..75af46bce 100644
--- a/reference/dot-rxWithWd.html
+++ b/reference/dot-rxWithWd.html
@@ -161,7 +161,7 @@ Examples.rxWithWd(tempdir(), {
getwd()
})
-#> [1] "/tmp/Rtmp5mYcCf"
+#> [1] "/tmp/RtmpE4aPra"
getwd()
#> [1] "/home/runner/work/rxode2/rxode2/docs/reference"
diff --git a/reference/meanProbs.html b/reference/meanProbs.html
index 9a08016fa..566544ae7 100644
--- a/reference/meanProbs.html
+++ b/reference/meanProbs.html
@@ -242,19 +242,19 @@ Examples
quantile(x<- rnorm(1001))
#> 0% 25% 50% 75% 100%
-#> -3.28115118 -0.64967840 0.01886107 0.62753823 3.55800202
+#> -3.30482225 -0.64751787 0.02337307 0.69544173 3.24026140
meanProbs(x)
#> 0% 25% 50% 75% 100%
-#> -3.281151178 -0.013258178 0.007595896 0.028449971 3.558002015
+#> -3.304822248 -0.002713307 0.018660300 0.040033906 3.240261399
# Can get some extra statistics if you request onlyProbs=FALSE
meanProbs(x, onlyProbs=FALSE)
#> mean var sd min max
-#> 7.595896e-03 9.562010e-01 9.778553e-01 -3.281151e+00 3.558002e+00
+#> 1.866030e-02 1.004438e+00 1.002216e+00 -3.304822e+00 3.240261e+00
#> n 0% 25% 50% 75%
-#> 1.001000e+03 -3.281151e+00 -1.325818e-02 7.595896e-03 2.844997e-02
+#> 1.001000e+03 -3.304822e+00 -2.713307e-03 1.866030e-02 4.003391e-02
#> 100%
-#> 3.558002e+00
+#> 3.240261e+00
x[2] <- NA_real_
@@ -263,16 +263,16 @@ Examples#> NA NA NA NA NA NA NA NA NA NA NA
quantile(x<- rnorm(42))
-#> 0% 25% 50% 75% 100%
-#> -1.9668767 -0.4992812 -0.2195001 0.5324541 1.8118113
+#> 0% 25% 50% 75% 100%
+#> -2.73283522 -0.36100321 0.09095168 0.78967253 2.43692472
meanProbs(x)
-#> 0% 25% 50% 75% 100%
-#> -1.96687675 -0.17059232 -0.08068784 0.00921664 1.81181134
+#> 0% 25% 50% 75% 100%
+#> -2.732835219 0.004803845 0.115537240 0.226270634 2.436924721
meanProbs(x, useT=FALSE)
#> 0% 25% 50% 75% 100%
-#> -1.966876746 -0.169795557 -0.080687839 0.008419878 1.811811339
+#> -2.732835219 0.005785199 0.115537240 0.225289281 2.436924721
rxode2 Transit Compartment Models
-2023-12-03
+2023-12-05
Source:vignettes/rxode2-transit-compartments.Rmd
rxode2-transit-compartments.Rmd
Advanced Features, Model Types, Techni
Weight Based Dosing in rxode2
- 2023-12-03
+ 2023-12-05
Source: vignettes/rxode2-wt.Rmd
rxode2-wt.Rmd
diff --git a/pkgdown.yml b/pkgdown.yml
index bd1d197dc..8a8cb5636 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -26,7 +26,7 @@ articles:
rxode2-transit-compartments: rxode2-transit-compartments.html
rxode2-tutorials: rxode2-tutorials.html
rxode2-wt: rxode2-wt.html
-last_built: 2023-12-03T18:44Z
+last_built: 2023-12-05T02:05Z
urls:
reference: https://nlmixr2.github.io/rxode2/reference
article: https://nlmixr2.github.io/rxode2/articles
diff --git a/reference/binomProbs.html b/reference/binomProbs.html
index ba7c2f274..ffcc048bc 100644
--- a/reference/binomProbs.html
+++ b/reference/binomProbs.html
@@ -282,21 +282,21 @@ Examplesx<- rbinom(7001, p=0.375, size=1)
binomProbs(x)
#> 2.5% 5% 50% 95% 97.5%
-#> 0.3738971 0.3757100 0.3852307 0.3948400 0.3966901
+#> 0.3659484 0.3677527 0.3772318 0.3868058 0.3886499
# you can also use the prediction interval
# \donttest{
binomProbs(x, pred=TRUE)
#> 2.5% 5% 50% 95% 97.5%
-#> 0.3690901 0.3718040 0.3852307 0.3988002 0.4013712
+#> 0.3612341 0.3638052 0.3772318 0.3906585 0.3933724
# }
# Can get some extra statistics if you request onlyProbs=FALSE
binomProbs(x, onlyProbs=FALSE)
#> mean var sd n 2.5% 5%
-#> 0.3852307 0.2368280 0.4866498 7001.0000000 0.3738971 0.3757100
+#> 0.3772318 0.2349280 0.4846937 7001.0000000 0.3659484 0.3677527
#> 50% 95% 97.5%
-#> 0.3852307 0.3948400 0.3966901
+#> 0.3772318 0.3868058 0.3886499
x[2] <- NA_real_
@@ -306,7 +306,7 @@ Examples
binomProbs(x, na.rm=TRUE)
#> 2.5% 5% 50% 95% 97.5%
-#> 0.3739510 0.3757641 0.3852857 0.3948960 0.3967463
+#> 0.3660012 0.3678056 0.3772857 0.3868606 0.3887049
Weight Based Dosing in rxode2
-2023-12-03
+2023-12-05
Source:vignettes/rxode2-wt.Rmd
rxode2-wt.Rmd
Examplesx<- rbinom(7001, p=0.375, size=1)
binomProbs(x)
#> 2.5% 5% 50% 95% 97.5%
-#> 0.3738971 0.3757100 0.3852307 0.3948400 0.3966901
+#> 0.3659484 0.3677527 0.3772318 0.3868058 0.3886499
# you can also use the prediction interval
# \donttest{
binomProbs(x, pred=TRUE)
#> 2.5% 5% 50% 95% 97.5%
-#> 0.3690901 0.3718040 0.3852307 0.3988002 0.4013712
+#> 0.3612341 0.3638052 0.3772318 0.3906585 0.3933724
# }
# Can get some extra statistics if you request onlyProbs=FALSE
binomProbs(x, onlyProbs=FALSE)
#> mean var sd n 2.5% 5%
-#> 0.3852307 0.2368280 0.4866498 7001.0000000 0.3738971 0.3757100
+#> 0.3772318 0.2349280 0.4846937 7001.0000000 0.3659484 0.3677527
#> 50% 95% 97.5%
-#> 0.3852307 0.3948400 0.3966901
+#> 0.3772318 0.3868058 0.3886499
x[2] <- NA_real_
@@ -306,7 +306,7 @@ Examples
binomProbs(x, na.rm=TRUE)
#> 2.5% 5% 50% 95% 97.5%
-#> 0.3739510 0.3757641 0.3852857 0.3948960 0.3967463
+#> 0.3660012 0.3678056 0.3772857 0.3868606 0.3887049
Examples.rxWithWd(tempdir(), {
getwd()
})
-#> [1] "/tmp/Rtmp5mYcCf"
+#> [1] "/tmp/RtmpE4aPra"
getwd()
#> [1] "/home/runner/work/rxode2/rxode2/docs/reference"
diff --git a/reference/meanProbs.html b/reference/meanProbs.html
index 9a08016fa..566544ae7 100644
--- a/reference/meanProbs.html
+++ b/reference/meanProbs.html
@@ -242,19 +242,19 @@ Examples
quantile(x<- rnorm(1001))
#> 0% 25% 50% 75% 100%
-#> -3.28115118 -0.64967840 0.01886107 0.62753823 3.55800202
+#> -3.30482225 -0.64751787 0.02337307 0.69544173 3.24026140
meanProbs(x)
#> 0% 25% 50% 75% 100%
-#> -3.281151178 -0.013258178 0.007595896 0.028449971 3.558002015
+#> -3.304822248 -0.002713307 0.018660300 0.040033906 3.240261399
# Can get some extra statistics if you request onlyProbs=FALSE
meanProbs(x, onlyProbs=FALSE)
#> mean var sd min max
-#> 7.595896e-03 9.562010e-01 9.778553e-01 -3.281151e+00 3.558002e+00
+#> 1.866030e-02 1.004438e+00 1.002216e+00 -3.304822e+00 3.240261e+00
#> n 0% 25% 50% 75%
-#> 1.001000e+03 -3.281151e+00 -1.325818e-02 7.595896e-03 2.844997e-02
+#> 1.001000e+03 -3.304822e+00 -2.713307e-03 1.866030e-02 4.003391e-02
#> 100%
-#> 3.558002e+00
+#> 3.240261e+00
x[2] <- NA_real_
@@ -263,16 +263,16 @@ Examples#> NA NA NA NA NA NA NA NA NA NA NA
quantile(x<- rnorm(42))
-#> 0% 25% 50% 75% 100%
-#> -1.9668767 -0.4992812 -0.2195001 0.5324541 1.8118113
+#> 0% 25% 50% 75% 100%
+#> -2.73283522 -0.36100321 0.09095168 0.78967253 2.43692472
meanProbs(x)
-#> 0% 25% 50% 75% 100%
-#> -1.96687675 -0.17059232 -0.08068784 0.00921664 1.81181134
+#> 0% 25% 50% 75% 100%
+#> -2.732835219 0.004803845 0.115537240 0.226270634 2.436924721
meanProbs(x, useT=FALSE)
#> 0% 25% 50% 75% 100%
-#> -1.966876746 -0.169795557 -0.080687839 0.008419878 1.811811339
+#> -2.732835219 0.005785199 0.115537240 0.225289281 2.436924721
quantile(x<- rnorm(1001))
#> 0% 25% 50% 75% 100%
-#> -3.28115118 -0.64967840 0.01886107 0.62753823 3.55800202
+#> -3.30482225 -0.64751787 0.02337307 0.69544173 3.24026140
meanProbs(x)
#> 0% 25% 50% 75% 100%
-#> -3.281151178 -0.013258178 0.007595896 0.028449971 3.558002015
+#> -3.304822248 -0.002713307 0.018660300 0.040033906 3.240261399
# Can get some extra statistics if you request onlyProbs=FALSE
meanProbs(x, onlyProbs=FALSE)
#> mean var sd min max
-#> 7.595896e-03 9.562010e-01 9.778553e-01 -3.281151e+00 3.558002e+00
+#> 1.866030e-02 1.004438e+00 1.002216e+00 -3.304822e+00 3.240261e+00
#> n 0% 25% 50% 75%
-#> 1.001000e+03 -3.281151e+00 -1.325818e-02 7.595896e-03 2.844997e-02
+#> 1.001000e+03 -3.304822e+00 -2.713307e-03 1.866030e-02 4.003391e-02
#> 100%
-#> 3.558002e+00
+#> 3.240261e+00
x[2] <- NA_real_
@@ -263,16 +263,16 @@ Examples#> NA NA NA NA NA NA NA NA NA NA NA
quantile(x<- rnorm(42))
-#> 0% 25% 50% 75% 100%
-#> -1.9668767 -0.4992812 -0.2195001 0.5324541 1.8118113
+#> 0% 25% 50% 75% 100%
+#> -2.73283522 -0.36100321 0.09095168 0.78967253 2.43692472
meanProbs(x)
-#> 0% 25% 50% 75% 100%
-#> -1.96687675 -0.17059232 -0.08068784 0.00921664 1.81181134
+#> 0% 25% 50% 75% 100%
+#> -2.732835219 0.004803845 0.115537240 0.226270634 2.436924721
meanProbs(x, useT=FALSE)
#> 0% 25% 50% 75% 100%
-#> -1.966876746 -0.169795557 -0.080687839 0.008419878 1.811811339
+#> -2.732835219 0.005785199 0.115537240 0.225289281 2.436924721
&\?kM74x&aCSxMtAirlXP<~u1Js:!4iYpntMd8U55Ci90m3qe!@9Ji{$;e3X4/#7(\"c0&Examples#>
#>
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’
-#> rxode2 2.0.14.9000 model named rx_52a5d1114b53421aed312ebdf3abe7cd model (✔ ready).
+#> rxode2 2.0.14.9000 model named rx_0880cdc591fefe9a89dde9de3f818227 model (✔ ready).
#> $state: depot, gut, center, effect
#> $stateExtra: cp
#> $params: tktr, tka, tcl, tv, prop.err, pkadd.err, temax, tec50, tkout, te0, pdadd.err, eta.ktr, eta.ka, eta.cl, eta.v, eta.emax, eta.ec50, eta.kout, eta.e0, CMT, rxerr.cp, rxerr.effect
diff --git a/reference/rxExpandGrid.html b/reference/rxExpandGrid.html
index 7d900a2d2..ecc24f649 100644
--- a/reference/rxExpandGrid.html
+++ b/reference/rxExpandGrid.html
@@ -858,12 +858,12 @@
Examples# \donttest{
microbenchmark::microbenchmark(rxExpandGrid(letters, letters), expand.grid.jc(letters, letters))
#> Unit: microseconds
-#> expr min lq mean median uq
-#> rxExpandGrid(letters, letters) 12.263 13.48 91.33827 14.2965 17.357
-#> expand.grid.jc(letters, letters) 16.321 18.60 162.97514 20.3730 24.681
+#> expr min lq mean median uq
+#> rxExpandGrid(letters, letters) 12.023 13.771 228.9854 14.822 16.8110
+#> expand.grid.jc(letters, letters) 16.180 19.020 135.6250 19.963 21.4745
#> max neval
-#> 3741.396 100
-#> 5425.877 100
+#> 6240.360 100
+#> 5785.992 100
# }
diff --git a/reference/rxPp.html b/reference/rxPp.html
index b974aae55..f3d9036a4 100644
--- a/reference/rxPp.html
+++ b/reference/rxPp.html
@@ -205,20 +205,20 @@
Examples
diff --git a/reference/rxbeta.html b/reference/rxbeta.html
index 7e53e8146..35c7af41d 100644
--- a/reference/rxbeta.html
+++ b/reference/rxbeta.html
@@ -198,14 +198,14 @@
## Sample homogenous Poisson process of rate 1/10
rxPp(10, 1 / 10)
-#> [1] 18.93600 21.67070 30.84482 43.10839 49.88171 50.75515 56.16018 66.34298
-#> [9] 68.21307 72.08121
+#> [1] 0.5701758 73.8620553 104.4945637 107.1778288 121.8564366 125.0992650
+#> [7] 131.9167584 142.7961327 144.5936749 152.2237570
## Sample inhomogenous Poisson rate of 1/10
rxPp(10, 1 / 10, gamma = 2, tmax = 100)
-#> [1] 37.32268 38.39451 43.24945 54.97146 63.91661 64.51948 83.71702
+#> [1] 30.30979 30.64828 48.97978 56.89256 64.02384 88.53280 100.00000
#> [8] 100.00000 100.00000 100.00000
## Typically the Poisson process times are in a sequential order,
## using randomOrder gives the Poisson process in random order
rxPp(10, 1 / 10, gamma = 2, tmax = 10, randomOrder = TRUE)
-#> [1] 10.000000 10.000000 10.000000 10.000000 6.404146 10.000000 10.000000
+#> [1] 10.000000 9.139927 10.000000 10.000000 10.000000 10.000000 10.000000
#> [8] 10.000000 10.000000 10.000000
## This uses an arbitrary function to sample a non-homogenous Poisson process
@@ -226,8 +226,8 @@
ExamplesrxPp(10, 1 / 10, prob = function(x) {
1/(1+abs(x))
})
-#> [1] 0.2547337 72.0536559 124.8809951 148.2475850 169.0849918 237.2689041
-#> [7] 284.3323111 367.2268875 469.0227415 571.2076937
+#> [1] 16.58519 30.37519 43.27762 93.07972 135.65231 320.61128 336.34648
+#> [8] 386.49854 437.12274 510.10131
Examples## Use threefry engine
rxbeta(0.5, 0.5, n = 10) # with rxbeta you have to explicitly state n
-#> [1] 0.61256385 0.95659136 0.32289892 0.52233890 0.01206682 0.71233613
-#> [7] 0.32491188 0.10032406 0.76644895 0.99376087
+#> [1] 0.784493851 0.296006530 0.551910687 0.521853750 0.009849611 0.152798780
+#> [7] 0.170215392 0.382603646 0.733622593 0.026310204
rxbeta(5, 1, n = 10, ncores = 2) # You can parallelize the simulation using openMP
-#> [1] 0.9851563 0.9725293 0.9042127 0.9865854 0.9489828 0.5984205 0.9254081
-#> [8] 0.8383715 0.9205569 0.8818575
+#> [1] 0.8735074 0.9639497 0.8539438 0.9281824 0.9436429 0.7196456 0.5533208
+#> [8] 0.9102915 0.7199071 0.9281879
rxbeta(1, 3)
-#> [1] 0.6132583
+#> [1] 0.4107307
## This example uses `rxbeta` directly in the model
diff --git a/reference/rxbinom.html b/reference/rxbinom.html
index f5a18fcf8..f87960079 100644
--- a/reference/rxbinom.html
+++ b/reference/rxbinom.html
@@ -201,12 +201,12 @@
Examples## Use threefry engine
rxbinom(10, 0.9, n = 10) # with rxbinom you have to explicitly state n
-#> [1] 10 10 9 10 10 9 10 9 10 8
+#> [1] 9 10 9 9 10 10 10 9 9 7
rxbinom(3, 0.5, n = 10, ncores = 2) # You can parallelize the simulation using openMP
-#> [1] 1 2 2 2 2 1 1 3 1 2
+#> [1] 2 3 2 1 2 1 0 2 2 1
rxbinom(4, 0.7)
-#> [1] 3
+#> [1] 4
## This example uses `rxbinom` directly in the model
diff --git a/reference/rxcauchy.html b/reference/rxcauchy.html
index 4723206fa..f51f97a07 100644
--- a/reference/rxcauchy.html
+++ b/reference/rxcauchy.html
@@ -198,14 +198,14 @@
Examples## Use threefry engine
rxcauchy(0, 1, n = 10) # with rxcauchy you have to explicitly state n
-#> [1] 0.1644802 0.2434156 -0.5803273 -0.1497825 0.5875718 -0.2982908
-#> [7] 0.2765044 0.2627788 3.8264021 2.4581234
+#> [1] 1.7369933 -0.7363301 0.5324674 -0.9627300 0.4319649 0.2118852
+#> [7] -1.2523023 0.1736379 -0.8610094 4.0505503
rxcauchy(0.5, n = 10, ncores = 2) # You can parallelize the simulation using openMP
-#> [1] 8.30241550 -0.17111777 -0.77751888 6.22115541 1.11155059 0.90462673
-#> [7] -0.05510078 1.06100413 -0.11989468 4.29015906
+#> [1] 9.08693997 -0.26876664 -7.53902519 2.34870794 0.02557870
+#> [6] -0.09921134 2.65220948 -19.67405428 1.05188193 0.52344647
rxcauchy(3)
-#> [1] 2.516797
+#> [1] 6.256354
## This example uses `rxcauchy` directly in the model
diff --git a/reference/rxchisq.html b/reference/rxchisq.html
index 2cb5db920..2e4edaac3 100644
--- a/reference/rxchisq.html
+++ b/reference/rxchisq.html
@@ -198,14 +198,14 @@
Examples## Use threefry engine
rxchisq(0.5, n = 10) # with rxchisq you have to explicitly state n
-#> [1] 2.310187e-02 2.286699e-01 1.008278e+00 3.249175e-01 1.249023e-01
-#> [6] 8.649681e-05 1.332756e-01 1.703558e-01 3.529797e-02 2.665971e+00
+#> [1] 7.528668e-07 1.497853e-04 6.039532e-02 3.130318e-01 7.899314e-02
+#> [6] 4.500540e-02 1.817131e-02 3.972515e+00 4.798631e-01 3.415090e-04
rxchisq(5, n = 10, ncores = 2) # You can parallelize the simulation using openMP
-#> [1] 2.187886 6.215064 4.177953 1.091942 4.264671 7.787320 0.599340 3.688743
-#> [9] 3.710716 5.132875
+#> [1] 2.1259165 4.3665040 6.2372948 0.2318207 8.6361393 16.8627292
+#> [7] 10.8384131 6.5560334 0.5157812 2.7690857
rxchisq(1)
-#> [1] 3.21248
+#> [1] 1.123005
## This example uses `rxchisq` directly in the model
diff --git a/reference/rxexp.html b/reference/rxexp.html
index 0aaeb4180..b9f5db6ec 100644
--- a/reference/rxexp.html
+++ b/reference/rxexp.html
@@ -198,14 +198,14 @@
Examples## Use threefry engine
rxexp(0.5, n = 10) # with rxexp you have to explicitly state n
-#> [1] 1.49562611 0.48404608 0.51967744 0.18006209 2.26226454 2.52627915
-#> [7] 1.00640529 1.40211015 1.04958466 0.07007609
+#> [1] 8.68525395 0.02841823 0.48235555 1.17509369 0.06255837 0.12580220
+#> [7] 6.35140324 0.03454828 1.66467220 1.94038215
rxexp(5, n = 10, ncores = 2) # You can parallelize the simulation using openMP
-#> [1] 0.37785437 0.02748907 0.09579784 0.05564028 0.11824330 0.06890514
-#> [7] 0.50897733 0.36541471 0.10764909 0.02474404
+#> [1] 0.50502738 0.16194936 0.40749768 0.06140727 0.58053100 0.32011411
+#> [7] 0.19783159 0.05296362 0.03715771 0.01727186
rxexp(1)
-#> [1] 0.2423548
+#> [1] 1.814893
## This example uses `rxexp` directly in the model
diff --git a/reference/rxf.html b/reference/rxf.html
index db1cb4c52..ac67f4000 100644
--- a/reference/rxf.html
+++ b/reference/rxf.html
@@ -198,14 +198,14 @@
Examples## Use threefry engine
rxf(0.5, 0.5, n = 10) # with rxf you have to explicitly state n
-#> [1] 4.037080e-01 3.457026e-01 1.085570e-01 3.290106e-02 5.247368e-02
-#> [6] 6.352759e-03 7.755671e-04 2.885006e-02 1.030124e+02 1.394790e+00
+#> [1] 8.053532e+02 1.635277e+00 1.074846e+01 1.036680e+03 9.585714e-04
+#> [6] 4.080682e+03 1.032219e-05 2.807805e-03 3.587782e+02 1.086265e+06
rxf(5, 1, n = 10, ncores = 2) # You can parallelize the simulation using openMP
-#> [1] 4.9124673 0.1829827 1.5836474 604.1020412 1.8645373 1.2419200
-#> [7] 0.3959299 26.5240496 72.1796495 0.4620785
+#> [1] 84.2121598 1.7834747 13.7453108 0.4575579 17.1190847 0.8292197
+#> [7] 0.8654965 30.8167589 1.5460264 0.2697773
rxf(1, 3)
-#> [1] 0.02806037
+#> [1] 0.4481127
## This example uses `rxf` directly in the model
diff --git a/reference/rxgamma.html b/reference/rxgamma.html
index 1f9830c85..411459ac7 100644
--- a/reference/rxgamma.html
+++ b/reference/rxgamma.html
@@ -203,14 +203,14 @@
Examples## Use threefry engine
rxgamma(0.5, n = 10) # with rxgamma you have to explicitly state n
-#> [1] 0.191500260 1.195977770 1.058202845 0.396370419 0.001000177 0.002588980
-#> [7] 0.290771395 0.792979300 0.144634255 0.190147938
+#> [1] 0.043859780 0.055044616 0.000201218 0.672940330 0.362039192 3.129973535
+#> [7] 0.538047012 2.252902212 0.002540171 0.112699943
rxgamma(5, n = 10, ncores = 2) # You can parallelize the simulation using openMP
-#> [1] 4.861405 6.657920 5.685291 5.677182 2.882887 5.450076 4.226290 8.298452
-#> [9] 2.042800 6.243997
+#> [1] 2.767184 6.585920 5.954000 7.941399 3.720405 7.397351 4.760076
+#> [8] 11.198800 2.383453 1.728093
rxgamma(1)
-#> [1] 0.8378115
+#> [1] 0.7060747
## This example uses `rxbeta` directly in the model
diff --git a/reference/rxgeom.html b/reference/rxgeom.html
index f5bed6f7e..56a8d581c 100644
--- a/reference/rxgeom.html
+++ b/reference/rxgeom.html
@@ -198,9 +198,9 @@
Examples## Use threefry engine
rxgeom(0.5, n = 10) # with rxgeom you have to explicitly state n
-#> [1] 0 3 0 1 3 0 0 1 1 0
+#> [1] 1 1 2 4 1 0 0 0 1 2
rxgeom(0.25, n = 10, ncores = 2) # You can parallelize the simulation using openMP
-#> [1] 0 2 9 13 1 6 0 2 2 4
+#> [1] 3 1 4 2 7 1 0 7 1 9
rxgeom(0.75)
#> [1] 0
diff --git a/reference/rxnbinom.html b/reference/rxnbinom.html
index e723858df..a2e78842d 100644
--- a/reference/rxnbinom.html
+++ b/reference/rxnbinom.html
@@ -215,16 +215,16 @@
Examples## Use threefry engine
rxnbinom(10, 0.9, n = 10) # with rxbinom you have to explicitly state n
-#> [1] 9 9 9 10 10 8 10 9 10 8
+#> [1] 10 9 9 8 9 9 10 8 9 10
rxnbinom(3, 0.5, n = 10, ncores = 2) # You can parallelize the simulation using openMP
-#> [1] 3 3 2 2 3 3 1 3 2 2
+#> [1] 3 2 3 3 2 3 2 3 2 3
rxnbinom(4, 0.7)
-#> [1] 4
+#> [1] 3
# use mu parameter
rxnbinomMu(40, 40, n=10)
-#> [1] 16 17 23 17 19 19 17 26 17 22
+#> [1] 23 20 25 20 15 22 24 20 21 28
## This example uses `rxbinom` directly in the model
diff --git a/reference/rxnormV.html b/reference/rxnormV.html
index 4140cf595..026b12e1f 100644
--- a/reference/rxnormV.html
+++ b/reference/rxnormV.html
@@ -174,14 +174,14 @@
Examples## Use threefry engine
rxnorm(n = 10) # with rxnorm you have to explicitly state n
-#> [1] -0.6141332 2.3030155 -1.7186259 -0.7631888 0.2029468 -0.2502248
-#> [7] -0.9783538 0.5826871 1.5570847 0.5158808
+#> [1] 0.01105464 -0.54974295 1.37336559 -1.36043671 0.77494884 -0.16480674
+#> [7] 0.32020604 -0.16634653 1.41632663 -0.53713222
rxnorm(n = 10, ncores = 2) # You can parallelize the simulation using openMP
-#> [1] 0.41338141 -0.69976340 -0.00912879 0.94741545 0.58323139 0.69856060
-#> [7] 0.60435496 0.32519946 0.70639696 -0.16936886
+#> [1] 1.1184500 -0.8526931 0.7268394 -1.4552502 -1.5051733 0.2544870
+#> [7] 1.7404664 -0.3929185 -0.1143912 1.4980343
rxnorm(2, 3) ## The first 2 arguments are the mean and standard deviation
-#> [1] 6.234379
+#> [1] 5.197369
## This example uses `rxnorm` directly in the model
diff --git a/reference/rxode2.html b/reference/rxode2.html
index 6643b48d8..74fe8f796 100644
--- a/reference/rxode2.html
+++ b/reference/rxode2.html
@@ -457,14 +457,14 @@
Details
creates a parsed
rxode2
ui that can be translated to the rxode2
compilation model.
mod$simulationModel
## rxode2 2.0.14.9000 model named rx_0beb7cac1558d255bf1dcab2e4b4e4cd model (ready).
+## rxode2 2.0.14.9000 model named rx_9140ece6c151a5d4341598adc0f7f3b6 model (ready).
## x$state: depot, center
## x$stateExtra: cp
## x$params: tka, tcl, tv, add.sd, eta.ka, eta.cl, eta.v, rxerr.cp
## x$lhs: ka, cl, v, cp, ipredSim, sim
# or
mod$simulationIniModel
-## rxode2 2.0.14.9000 model named rx_e62e09f9f1f76ce371e52ab9dcb7c2d3 model (ready).
+## rxode2 2.0.14.9000 model named rx_3696701c79e711bcf4b2c8ac921b3f65 model (ready).
## x$state: depot, center
## x$stateExtra: cp
## x$params: tka, tcl, tv, add.sd, eta.ka, eta.cl, eta.v, rxerr.cp
diff --git a/reference/rxord.html b/reference/rxord.html
index c61fce673..dfd9b45f7 100644
--- a/reference/rxord.html
+++ b/reference/rxord.html
@@ -166,7 +166,7 @@ Examples
# This will give values 1, and 2
rxord(0.5)
-#> [1] 2
+#> [1] 1
rxord(0.5)
#> [1] 1
rxord(0.5)
@@ -176,11 +176,11 @@ Examples
# This will give values 1, 2 and 3
rxord(0.3, 0.3)
-#> [1] 3
+#> [1] 1
rxord(0.3, 0.3)
-#> [1] 2
+#> [1] 1
rxord(0.3, 0.3)
-#> [1] 3
+#> [1] 1
diff --git a/reference/rxpois.html b/reference/rxpois.html
index 22fa0e1d2..e36e0c1e8 100644
--- a/reference/rxpois.html
+++ b/reference/rxpois.html
@@ -196,12 +196,12 @@ Examples## Use threefry engine
rxpois(lambda = 3, n = 10) # with rxpois you have to explicitly state n
-#> [1] 3 2 3 5 4 2 2 1 2 4
+#> [1] 1 1 0 1 0 2 2 2 1 4
rxpois(lambda = 3, n = 10, ncores = 2) # You can parallelize the simulation using openMP
-#> [1] 2 2 6 2 2 1 1 5 2 4
+#> [1] 2 2 5 3 3 0 0 1 2 3
rxpois(4) ## The first arguments are the lambda parameter
-#> [1] 7
+#> [1] 5
## This example uses `rxpois` directly in the model
diff --git a/reference/rxt.html b/reference/rxt.html
index 29f72634c..f5dbd93e3 100644
--- a/reference/rxt.html
+++ b/reference/rxt.html
@@ -198,14 +198,14 @@ Examples
## Use threefry engine
rxt(df = 3, n = 10) # with rxt you have to explicitly state n
-#> [1] 0.49044056 1.31473984 -1.29037841 -0.17827791 -0.56329858 -0.05167765
-#> [7] 0.07173967 1.05863937 -0.74012208 0.97434322
+#> [1] -0.27533205 0.16987712 -1.44064210 0.26573813 -0.37880422 -0.87165052
+#> [7] 0.94421751 0.40845487 -0.06274707 -0.65578169
rxt(df = 3, n = 10, ncores = 2) # You can parallelize the simulation using openMP
-#> [1] -1.1107060 0.4738709 2.1796410 -0.1982536 0.2557368 -1.1334266
-#> [7] -0.4955298 1.6012658 -1.2723270 -0.7666190
+#> [1] 1.2611401 0.3975395 -0.8158363 2.1554785 0.7705704 -0.1143120
+#> [7] -1.2696606 0.2708562 -0.5476388 0.3682381
rxt(4) ## The first argument is the df parameter
-#> [1] -0.1434868
+#> [1] -1.039091
## This example uses `rxt` directly in the model
diff --git a/reference/rxunif.html b/reference/rxunif.html
index 3466345bb..b8c0e22d5 100644
--- a/reference/rxunif.html
+++ b/reference/rxunif.html
@@ -198,14 +198,14 @@ Examples## Use threefry engine
rxunif(min = 0, max = 4, n = 10) # with rxunif you have to explicitly state n
-#> [1] 0.1530827 0.8740226 1.8486475 0.3448814 2.6474502 3.2558084 0.5356620
-#> [8] 0.1813933 2.8321254 2.9741605
+#> [1] 0.4527454 1.7683930 0.1392899 0.8990940 1.4880774 3.5644872 1.8764023
+#> [8] 2.8519888 1.1861644 2.2704878
rxunif(min = 0, max = 4, n = 10, ncores = 2) # You can parallelize the simulation using openMP
-#> [1] 3.1881895 0.1793713 0.2222520 2.1451290 2.6473330 2.2915590 1.8058082
-#> [8] 2.2102317 2.8491653 2.6998586
+#> [1] 2.8524719 1.5717112 0.5053201 3.3363144 1.6218466 2.6841560 0.7430128
+#> [8] 3.1866707 2.1994361 2.4901727
rxunif()
-#> [1] 0.7594209
+#> [1] 0.9986261
## This example uses `rxunif` directly in the model
diff --git a/reference/rxweibull.html b/reference/rxweibull.html
index 8d7824350..fbc46ad44 100644
--- a/reference/rxweibull.html
+++ b/reference/rxweibull.html
@@ -199,16 +199,16 @@ Examples
# with rxweibull you have to explicitly state n
rxweibull(shape = 1, scale = 4, n = 10)
-#> [1] 8.9610282 2.1611027 1.6626086 6.1282000 2.6237191 1.4050116 1.2233588
-#> [8] 0.6829067 2.3943587 8.8938917
+#> [1] 0.7914593 7.5460043 0.9170091 6.9688595 13.1454457 2.4192041
+#> [7] 2.5445330 12.5438265 5.8722630 2.8298588
# You can parallelize the simulation using openMP
rxweibull(shape = 1, scale = 4, n = 10, ncores = 2)
-#> [1] 2.558566 7.455413 10.910622 5.250092 3.347362 23.839085 2.775451
-#> [8] 3.396665 30.672131 4.165322
+#> [1] 6.1521667 3.0892045 14.5856226 3.8571543 3.7445101 2.7905825
+#> [7] 12.2757245 17.5894493 0.8241811 1.4306115
rxweibull(3)
-#> [1] 1.187545
+#> [1] 1.023258
## This example uses `rxweibull` directly in the model
diff --git a/search.json b/search.json
index 0d00dd1f6..9a14afe6b 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":"https://nlmixr2.github.io/rxode2/articles/Integrating-User-Defined-Functions-into-rxode2.html","id":"user-defined-functions","dir":"Articles","previous_headings":"","what":"User Defined Functions","title":"Integrating User Defined Functions into rxode2","text":"defining models may wished write small R function make function integrate rxode2 somehow. article discusses 2 ways : R-based user function can loaded simple function certain circumstances translated C run efficiently C function define integrate code","code":"library(rxode2) #> rxode2 2.0.14.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()`"},{"path":"https://nlmixr2.github.io/rxode2/articles/Integrating-User-Defined-Functions-into-rxode2.html","id":"r-based-user-functions","dir":"Articles","previous_headings":"","what":"R based user functions","title":"Integrating User Defined Functions into rxode2","text":"R-based user function convenient include ODE, slower done written C , C++ compiled language. requested github appropriate example; However, use simple example simply illustrate concepts. Now ODE compiled R functions called solving ODE. Since calling R, forces parallization turned since R single-threaded. also takes time solve since shuttling back forth R C. Lets see simple function performs: terribly bad, even though shuffling R C. can make better converting functions C: C version almost twice fast R version. may noticed conversion also created C versions first derivative. done automatically gives just C versions function, C versions derivatives registers rxode2. allows C versions work rxode2 nlmixr2 models. function setup advance allow type conversion. general derivatives calculated return() statement user defined function. means simply let R return last value instead explictly calling return(). Many people prefer method coding. Even return function, function converted C. github issue, used function convert derivatives: still helpful functions early returns, nlmixr2 models requiring derivatives calculated non-optimized finite differences occurs. gets internals rxode2 nlmixr2 can see easily calculating derivatives: Whereas originally defined function newAbs() use new derivatives calculated well: circumstances, conversion C possible, though can still use R function. requirements R functions integrated rxode2 system: function must set number arguments, variable arguments like f(…) currently allowed. function given argument single number, function return single number requirements met can use R function rxode2. Additional requirements conversion C include: functions use within R function must understood available rxode2. Practically speaking fun2() refers fun1(), fun1() must changed C code available rxode2 changing function fun2() C. functions can include /else assignments simple return statements (either returning value value line ). Special R control structures functions (like lapply) present. function refer package functions mentioned, return() statement present, derivative C functions rxode2’s derivative table updated.","code":"newAbs <- function(x) { if (x < 0) { -x } else { x } } f <- rxode2({ a <- newAbs(time) }) #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ e <- et(-10, 10, length.out=40) mb1 <- microbenchmark::microbenchmark(withoutC=suppressWarnings(rxSolve(f,e))) library(ggplot2) autoplot(mb1) + rxTheme() # Create C functions automatically with `rxFun()` rxFun(newAbs) #> → finding duplicate expressions in d(newAbs)/d(x)... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → optimizing duplicate expressions in d(newAbs)/d(x)... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> converted R function 'newAbs' to C (will now use in rxode2) #> converted R function 'rx_newAbs_d_x' to C (will now use in rxode2) #> Added derivative table for 'newAbs' # Recompile to use the C functions # Note it would recompile anyway if you didn't do this step, # it just makes sure that it doesn't recompile every step in # the benchmark f <- rxode2({ a <- newAbs(time) }) #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ mb2 <- microbenchmark::microbenchmark(withC=rxSolve(f,e, cores=1)) mb <- rbind(mb1, mb2) autoplot(mb) + rxTheme() + xgxr::xgx_scale_y_log10() #> Scale for y is already present. #> Adding another scale for y, which will replace the existing scale. print(mb) #> Unit: milliseconds #> expr min lq mean median uq max neval #> withoutC 7.760670 7.850127 8.865908 7.943766 8.381508 18.791067 100 #> withC 2.065371 2.116055 2.459296 2.209885 2.731708 7.061306 100 # Light f_R <- function(actRad, k_0, a_k) { photfac <- a_k * actRad + k_0 if (photfac > 1) { photfac = 1 } return(photfac) } rxFun(f_R) #> function contains return statement; derivatives not calculated #> converted R function 'f_R' to C (will now use in rxode2) rxFromSE(\"Derivative(f_R(actRad, k_0, a_k),k_0)\") #> [1] \"(f_R(actRad,(k_0)+6.05545445239334e-06,a_k)-f_R(actRad,k_0,a_k))/6.05545445239334e-06\" rxFromSE(\"Derivative(newAbs(x),x)\") #> [1] \"rx_newAbs_d_x(x)\""},{"path":"https://nlmixr2.github.io/rxode2/articles/Integrating-User-Defined-Functions-into-rxode2.html","id":"c-based-functions","dir":"Articles","previous_headings":"","what":"C based functions","title":"Integrating User Defined Functions into rxode2","text":"can add C functions directly rxode2 well using rxFun(): wanted also use C functions expressions derivatives using rxD() function: Removing function rxRmFun() also remove derivative table:","code":"fun <- \" double fun(double a, double b, double c) { return a*a+b*a+c; } \" ## C-code for function rxFun(\"fun\", c(\"a\", \"b\", \"c\"), fun) rxD(\"fun\", list( function(a, b, c) { # derivative of arg1: a paste0(\"2*\", a, \"+\", b) }, function(a, b, c) { # derivative of arg2: b return(a) }, function(a, b, c) { # derivative of arg3: c return(\"0.0\") } )) rxRmFun(\"fun\")"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-cmt.html","id":"how-rxode2-assigns-compartment-numbers","dir":"Articles","previous_headings":"","what":"How rxode2 assigns compartment numbers","title":"Changing rxode2 compartment numbers","text":"rxode2 automatically assigns compartment numbers parsing. example, Mavoglurant PBPK model following model may used: look printout, can see rxode2 assigned compartment number(s) can also see classic rxode2 model. case use summary() function: case, Venous_Blood assigned compartment 15. Figuring can inconvenient also lead re-numbering compartment simulation estimation datasets. easy probably clearer specify compartment name, tools support compartment numbers. Therefore, way number compartment easily can lead less data modification multiple tools.","code":"library(rxode2) #> rxode2 2.0.14.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()` pbpk <- function() { model({ KbBR = exp(lKbBR) KbMU = exp(lKbMU) KbAD = exp(lKbAD) CLint= exp(lCLint + eta.LClint) KbBO = exp(lKbBO) KbRB = exp(lKbRB) ## Regional blood flows # Cardiac output (L/h) from White et al (1968) CO = (187.00*WT^0.81)*60/1000 QHT = 4.0 *CO/100 QBR = 12.0*CO/100 QMU = 17.0*CO/100 QAD = 5.0 *CO/100 QSK = 5.0 *CO/100 QSP = 3.0 *CO/100 QPA = 1.0 *CO/100 QLI = 25.5*CO/100 QST = 1.0 *CO/100 QGU = 14.0*CO/100 # Hepatic artery blood flow QHA = QLI - (QSP + QPA + QST + QGU) QBO = 5.0 *CO/100 QKI = 19.0*CO/100 QRB = CO - (QHT + QBR + QMU + QAD + QSK + QLI + QBO + QKI) QLU = QHT + QBR + QMU + QAD + QSK + QLI + QBO + QKI + QRB ## Organs' volumes = organs' weights / organs' density VLU = (0.76 *WT/100)/1.051 VHT = (0.47 *WT/100)/1.030 VBR = (2.00 *WT/100)/1.036 VMU = (40.00*WT/100)/1.041 VAD = (21.42*WT/100)/0.916 VSK = (3.71 *WT/100)/1.116 VSP = (0.26 *WT/100)/1.054 VPA = (0.14 *WT/100)/1.045 VLI = (2.57 *WT/100)/1.040 VST = (0.21 *WT/100)/1.050 VGU = (1.44 *WT/100)/1.043 VBO = (14.29*WT/100)/1.990 VKI = (0.44 *WT/100)/1.050 VAB = (2.81 *WT/100)/1.040 VVB = (5.62 *WT/100)/1.040 VRB = (3.86 *WT/100)/1.040 ## Fixed parameters BP = 0.61 # Blood:plasma partition coefficient fup = 0.028 # Fraction unbound in plasma fub = fup/BP # Fraction unbound in blood KbLU = exp(0.8334) KbHT = exp(1.1205) KbSK = exp(-.5238) KbSP = exp(0.3224) KbPA = exp(0.3224) KbLI = exp(1.7604) KbST = exp(0.3224) KbGU = exp(1.2026) KbKI = exp(1.3171) ##----------------------------------------- S15 = VVB*BP/1000 C15 = Venous_Blood/S15 ##----------------------------------------- d/dt(Lungs) = QLU*(Venous_Blood/VVB - Lungs/KbLU/VLU) d/dt(Heart) = QHT*(Arterial_Blood/VAB - Heart/KbHT/VHT) d/dt(Brain) = QBR*(Arterial_Blood/VAB - Brain/KbBR/VBR) d/dt(Muscles) = QMU*(Arterial_Blood/VAB - Muscles/KbMU/VMU) d/dt(Adipose) = QAD*(Arterial_Blood/VAB - Adipose/KbAD/VAD) d/dt(Skin) = QSK*(Arterial_Blood/VAB - Skin/KbSK/VSK) d/dt(Spleen) = QSP*(Arterial_Blood/VAB - Spleen/KbSP/VSP) d/dt(Pancreas) = QPA*(Arterial_Blood/VAB - Pancreas/KbPA/VPA) d/dt(Liver) = QHA*Arterial_Blood/VAB + QSP*Spleen/KbSP/VSP + QPA*Pancreas/KbPA/VPA + QST*Stomach/KbST/VST + QGU*Gut/KbGU/VGU - CLint*fub*Liver/KbLI/VLI - QLI*Liver/KbLI/VLI d/dt(Stomach) = QST*(Arterial_Blood/VAB - Stomach/KbST/VST) d/dt(Gut) = QGU*(Arterial_Blood/VAB - Gut/KbGU/VGU) d/dt(Bones) = QBO*(Arterial_Blood/VAB - Bones/KbBO/VBO) d/dt(Kidneys) = QKI*(Arterial_Blood/VAB - Kidneys/KbKI/VKI) d/dt(Arterial_Blood) = QLU*(Lungs/KbLU/VLU - Arterial_Blood/VAB) d/dt(Venous_Blood) = QHT*Heart/KbHT/VHT + QBR*Brain/KbBR/VBR + QMU*Muscles/KbMU/VMU + QAD*Adipose/KbAD/VAD + QSK*Skin/KbSK/VSK + QLI*Liver/KbLI/VLI + QBO*Bones/KbBO/VBO + QKI*Kidneys/KbKI/VKI + QRB*Rest_of_Body/KbRB/VRB - QLU*Venous_Blood/VVB d/dt(Rest_of_Body) = QRB*(Arterial_Blood/VAB - Rest_of_Body/KbRB/VRB) }) } pbpk <- pbpk() print(pbpk) #> -- rxode2-based free-form 16-cmt ODE model ------------------------------------- #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 Lungs #> 2 2 Heart #> 3 3 Brain #> 4 4 Muscles #> 5 5 Adipose #> 6 6 Skin #> 7 7 Spleen #> 8 8 Pancreas #> 9 9 Liver #> 10 10 Stomach #> 11 11 Gut #> 12 12 Bones #> 13 13 Kidneys #> 14 14 Arterial_Blood #> 15 15 Venous_Blood #> 16 16 Rest_of_Body #> -- Model (Normalized Syntax): -- #> function() { #> model({ #> KbBR = exp(lKbBR) #> KbMU = exp(lKbMU) #> KbAD = exp(lKbAD) #> CLint = exp(lCLint + eta.LClint) #> KbBO = exp(lKbBO) #> KbRB = exp(lKbRB) #> CO = (187 * WT^0.81) * 60/1000 #> QHT = 4 * CO/100 #> QBR = 12 * CO/100 #> QMU = 17 * CO/100 #> QAD = 5 * CO/100 #> QSK = 5 * CO/100 #> QSP = 3 * CO/100 #> QPA = 1 * CO/100 #> QLI = 25.5 * CO/100 #> QST = 1 * CO/100 #> QGU = 14 * CO/100 #> QHA = QLI - (QSP + QPA + QST + QGU) #> QBO = 5 * CO/100 #> QKI = 19 * CO/100 #> QRB = CO - (QHT + QBR + QMU + QAD + QSK + QLI + QBO + #> QKI) #> QLU = QHT + QBR + QMU + QAD + QSK + QLI + QBO + QKI + #> QRB #> VLU = (0.76 * WT/100)/1.051 #> VHT = (0.47 * WT/100)/1.03 #> VBR = (2 * WT/100)/1.036 #> VMU = (40 * WT/100)/1.041 #> VAD = (21.42 * WT/100)/0.916 #> VSK = (3.71 * WT/100)/1.116 #> VSP = (0.26 * WT/100)/1.054 #> VPA = (0.14 * WT/100)/1.045 #> VLI = (2.57 * WT/100)/1.04 #> VST = (0.21 * WT/100)/1.05 #> VGU = (1.44 * WT/100)/1.043 #> VBO = (14.29 * WT/100)/1.99 #> VKI = (0.44 * WT/100)/1.05 #> VAB = (2.81 * WT/100)/1.04 #> VVB = (5.62 * WT/100)/1.04 #> VRB = (3.86 * WT/100)/1.04 #> BP = 0.61 #> fup = 0.028 #> fub = fup/BP #> KbLU = exp(0.8334) #> KbHT = exp(1.1205) #> KbSK = exp(-0.5238) #> KbSP = exp(0.3224) #> KbPA = exp(0.3224) #> KbLI = exp(1.7604) #> KbST = exp(0.3224) #> KbGU = exp(1.2026) #> KbKI = exp(1.3171) #> S15 = VVB * BP/1000 #> C15 = Venous_Blood/S15 #> d/dt(Lungs) = QLU * (Venous_Blood/VVB - Lungs/KbLU/VLU) #> d/dt(Heart) = QHT * (Arterial_Blood/VAB - Heart/KbHT/VHT) #> d/dt(Brain) = QBR * (Arterial_Blood/VAB - Brain/KbBR/VBR) #> d/dt(Muscles) = QMU * (Arterial_Blood/VAB - Muscles/KbMU/VMU) #> d/dt(Adipose) = QAD * (Arterial_Blood/VAB - Adipose/KbAD/VAD) #> d/dt(Skin) = QSK * (Arterial_Blood/VAB - Skin/KbSK/VSK) #> d/dt(Spleen) = QSP * (Arterial_Blood/VAB - Spleen/KbSP/VSP) #> d/dt(Pancreas) = QPA * (Arterial_Blood/VAB - Pancreas/KbPA/VPA) #> d/dt(Liver) = QHA * Arterial_Blood/VAB + QSP * Spleen/KbSP/VSP + #> QPA * Pancreas/KbPA/VPA + QST * Stomach/KbST/VST + #> QGU * Gut/KbGU/VGU - CLint * fub * Liver/KbLI/VLI - #> QLI * Liver/KbLI/VLI #> d/dt(Stomach) = QST * (Arterial_Blood/VAB - Stomach/KbST/VST) #> d/dt(Gut) = QGU * (Arterial_Blood/VAB - Gut/KbGU/VGU) #> d/dt(Bones) = QBO * (Arterial_Blood/VAB - Bones/KbBO/VBO) #> d/dt(Kidneys) = QKI * (Arterial_Blood/VAB - Kidneys/KbKI/VKI) #> d/dt(Arterial_Blood) = QLU * (Lungs/KbLU/VLU - Arterial_Blood/VAB) #> d/dt(Venous_Blood) = QHT * Heart/KbHT/VHT + QBR * Brain/KbBR/VBR + #> QMU * Muscles/KbMU/VMU + QAD * Adipose/KbAD/VAD + #> QSK * Skin/KbSK/VSK + QLI * Liver/KbLI/VLI + QBO * #> Bones/KbBO/VBO + QKI * Kidneys/KbKI/VKI + QRB * Rest_of_Body/KbRB/VRB - #> QLU * Venous_Blood/VVB #> d/dt(Rest_of_Body) = QRB * (Arterial_Blood/VAB - Rest_of_Body/KbRB/VRB) #> }) #> } pbpk <- pbpk$simulationModel #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ summary(pbpk) #> rxode2 2.0.14.9000 model named rx_a9ab0a308fe15e1ad382edd63f19620d model (ready). #> DLL: /tmp/Rtmp5mYcCf/rxode2/rx_a9ab0a308fe15e1ad382edd63f19620d__.rxd/rx_a9ab0a308fe15e1ad382edd63f19620d_.so #> NULL #> #> Calculated Variables: #> [1] \"KbBR\" \"KbMU\" \"KbAD\" \"CLint\" \"KbBO\" \"KbRB\" \"CO\" \"QHT\" \"QBR\" #> [10] \"QMU\" \"QAD\" \"QSK\" \"QSP\" \"QPA\" \"QLI\" \"QST\" \"QGU\" \"QHA\" #> [19] \"QBO\" \"QKI\" \"QRB\" \"QLU\" \"VLU\" \"VHT\" \"VBR\" \"VMU\" \"VAD\" #> [28] \"VSK\" \"VSP\" \"VPA\" \"VLI\" \"VST\" \"VGU\" \"VBO\" \"VKI\" \"VAB\" #> [37] \"VVB\" \"VRB\" \"fub\" \"KbLU\" \"KbHT\" \"KbSK\" \"KbSP\" \"KbPA\" \"KbLI\" #> [46] \"KbST\" \"KbGU\" \"KbKI\" \"S15\" \"C15\" #> -- rxode2 Model Syntax -- #> rxode2({ #> param(lKbBR, lKbMU, lKbAD, lCLint, eta.LClint, lKbBO, lKbRB, #> WT) #> KbBR = exp(lKbBR) #> KbMU = exp(lKbMU) #> KbAD = exp(lKbAD) #> CLint = exp(lCLint + eta.LClint) #> KbBO = exp(lKbBO) #> KbRB = exp(lKbRB) #> CO = (187 * WT^0.81) * 60/1000 #> QHT = 4 * CO/100 #> QBR = 12 * CO/100 #> QMU = 17 * CO/100 #> QAD = 5 * CO/100 #> QSK = 5 * CO/100 #> QSP = 3 * CO/100 #> QPA = 1 * CO/100 #> QLI = 25.5 * CO/100 #> QST = 1 * CO/100 #> QGU = 14 * CO/100 #> QHA = QLI - (QSP + QPA + QST + QGU) #> QBO = 5 * CO/100 #> QKI = 19 * CO/100 #> QRB = CO - (QHT + QBR + QMU + QAD + QSK + QLI + QBO + QKI) #> QLU = QHT + QBR + QMU + QAD + QSK + QLI + QBO + QKI + QRB #> VLU = (0.76 * WT/100)/1.051 #> VHT = (0.47 * WT/100)/1.03 #> VBR = (2 * WT/100)/1.036 #> VMU = (40 * WT/100)/1.041 #> VAD = (21.42 * WT/100)/0.916 #> VSK = (3.71 * WT/100)/1.116 #> VSP = (0.26 * WT/100)/1.054 #> VPA = (0.14 * WT/100)/1.045 #> VLI = (2.57 * WT/100)/1.04 #> VST = (0.21 * WT/100)/1.05 #> VGU = (1.44 * WT/100)/1.043 #> VBO = (14.29 * WT/100)/1.99 #> VKI = (0.44 * WT/100)/1.05 #> VAB = (2.81 * WT/100)/1.04 #> VVB = (5.62 * WT/100)/1.04 #> VRB = (3.86 * WT/100)/1.04 #> BP = 0.61 #> fup = 0.028 #> fub = fup/BP #> KbLU = exp(0.8334) #> KbHT = exp(1.1205) #> KbSK = exp(-0.5238) #> KbSP = exp(0.3224) #> KbPA = exp(0.3224) #> KbLI = exp(1.7604) #> KbST = exp(0.3224) #> KbGU = exp(1.2026) #> KbKI = exp(1.3171) #> S15 = VVB * BP/1000 #> C15 = Venous_Blood/S15 #> d/dt(Lungs) = QLU * (Venous_Blood/VVB - Lungs/KbLU/VLU) #> d/dt(Heart) = QHT * (Arterial_Blood/VAB - Heart/KbHT/VHT) #> d/dt(Brain) = QBR * (Arterial_Blood/VAB - Brain/KbBR/VBR) #> d/dt(Muscles) = QMU * (Arterial_Blood/VAB - Muscles/KbMU/VMU) #> d/dt(Adipose) = QAD * (Arterial_Blood/VAB - Adipose/KbAD/VAD) #> d/dt(Skin) = QSK * (Arterial_Blood/VAB - Skin/KbSK/VSK) #> d/dt(Spleen) = QSP * (Arterial_Blood/VAB - Spleen/KbSP/VSP) #> d/dt(Pancreas) = QPA * (Arterial_Blood/VAB - Pancreas/KbPA/VPA) #> d/dt(Liver) = QHA * Arterial_Blood/VAB + QSP * Spleen/KbSP/VSP + #> QPA * Pancreas/KbPA/VPA + QST * Stomach/KbST/VST + QGU * #> Gut/KbGU/VGU - CLint * fub * Liver/KbLI/VLI - QLI * Liver/KbLI/VLI #> d/dt(Stomach) = QST * (Arterial_Blood/VAB - Stomach/KbST/VST) #> d/dt(Gut) = QGU * (Arterial_Blood/VAB - Gut/KbGU/VGU) #> d/dt(Bones) = QBO * (Arterial_Blood/VAB - Bones/KbBO/VBO) #> d/dt(Kidneys) = QKI * (Arterial_Blood/VAB - Kidneys/KbKI/VKI) #> d/dt(Arterial_Blood) = QLU * (Lungs/KbLU/VLU - Arterial_Blood/VAB) #> d/dt(Venous_Blood) = QHT * Heart/KbHT/VHT + QBR * Brain/KbBR/VBR + #> QMU * Muscles/KbMU/VMU + QAD * Adipose/KbAD/VAD + QSK * #> Skin/KbSK/VSK + QLI * Liver/KbLI/VLI + QBO * Bones/KbBO/VBO + #> QKI * Kidneys/KbKI/VKI + QRB * Rest_of_Body/KbRB/VRB - #> QLU * Venous_Blood/VVB #> d/dt(Rest_of_Body) = QRB * (Arterial_Blood/VAB - Rest_of_Body/KbRB/VRB) #> })"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-cmt.html","id":"changing-compartment-numbers-by-pre-declaring-the-compartments","dir":"Articles","previous_headings":"","what":"Changing compartment numbers by pre-declaring the compartments","title":"Changing rxode2 compartment numbers","text":"add compartments rxode2 model order desire simply need pre-declare compartments cmt. example specifying Venous_Blood Skin 1st 2nd compartments, respectively, simple: can see change simple printout first two compartments Venous_Blood followed Skin.","code":"pbpk2 <- function() { model({ ## Now this is the first compartment, ie cmt=1 cmt(Venous_Blood) ## Skin may be a compartment you wish to dose to as well, ## so it is now cmt=2 cmt(Skin) KbBR = exp(lKbBR) KbMU = exp(lKbMU) KbAD = exp(lKbAD) CLint= exp(lCLint + eta.LClint) KbBO = exp(lKbBO) KbRB = exp(lKbRB) ## Regional blood flows # Cardiac output (L/h) from White et al (1968)m CO = (187.00*WT^0.81)*60/1000; QHT = 4.0 *CO/100; QBR = 12.0*CO/100; QMU = 17.0*CO/100; QAD = 5.0 *CO/100; QSK = 5.0 *CO/100; QSP = 3.0 *CO/100; QPA = 1.0 *CO/100; QLI = 25.5*CO/100; QST = 1.0 *CO/100; QGU = 14.0*CO/100; QHA = QLI - (QSP + QPA + QST + QGU); # Hepatic artery blood flow QBO = 5.0 *CO/100; QKI = 19.0*CO/100; QRB = CO - (QHT + QBR + QMU + QAD + QSK + QLI + QBO + QKI); QLU = QHT + QBR + QMU + QAD + QSK + QLI + QBO + QKI + QRB; ## Organs' volumes = organs' weights / organs' density VLU = (0.76 *WT/100)/1.051; VHT = (0.47 *WT/100)/1.030; VBR = (2.00 *WT/100)/1.036; VMU = (40.00*WT/100)/1.041; VAD = (21.42*WT/100)/0.916; VSK = (3.71 *WT/100)/1.116; VSP = (0.26 *WT/100)/1.054; VPA = (0.14 *WT/100)/1.045; VLI = (2.57 *WT/100)/1.040; VST = (0.21 *WT/100)/1.050; VGU = (1.44 *WT/100)/1.043; VBO = (14.29*WT/100)/1.990; VKI = (0.44 *WT/100)/1.050; VAB = (2.81 *WT/100)/1.040; VVB = (5.62 *WT/100)/1.040; VRB = (3.86 *WT/100)/1.040; ## Fixed parameters BP = 0.61; # Blood:plasma partition coefficient fup = 0.028; # Fraction unbound in plasma fub = fup/BP; # Fraction unbound in blood KbLU = exp(0.8334); KbHT = exp(1.1205); KbSK = exp(-.5238); KbSP = exp(0.3224); KbPA = exp(0.3224); KbLI = exp(1.7604); KbST = exp(0.3224); KbGU = exp(1.2026); KbKI = exp(1.3171); ##----------------------------------------- S15 = VVB*BP/1000; C15 = Venous_Blood/S15 ##----------------------------------------- d/dt(Lungs) = QLU*(Venous_Blood/VVB - Lungs/KbLU/VLU); d/dt(Heart) = QHT*(Arterial_Blood/VAB - Heart/KbHT/VHT); d/dt(Brain) = QBR*(Arterial_Blood/VAB - Brain/KbBR/VBR); d/dt(Muscles) = QMU*(Arterial_Blood/VAB - Muscles/KbMU/VMU); d/dt(Adipose) = QAD*(Arterial_Blood/VAB - Adipose/KbAD/VAD); d/dt(Skin) = QSK*(Arterial_Blood/VAB - Skin/KbSK/VSK); d/dt(Spleen) = QSP*(Arterial_Blood/VAB - Spleen/KbSP/VSP); d/dt(Pancreas) = QPA*(Arterial_Blood/VAB - Pancreas/KbPA/VPA); d/dt(Liver) = QHA*Arterial_Blood/VAB + QSP*Spleen/KbSP/VSP + QPA*Pancreas/KbPA/VPA + QST*Stomach/KbST/VST + QGU*Gut/KbGU/VGU - CLint*fub*Liver/KbLI/VLI - QLI*Liver/KbLI/VLI; d/dt(Stomach) = QST*(Arterial_Blood/VAB - Stomach/KbST/VST); d/dt(Gut) = QGU*(Arterial_Blood/VAB - Gut/KbGU/VGU); d/dt(Bones) = QBO*(Arterial_Blood/VAB - Bones/KbBO/VBO); d/dt(Kidneys) = QKI*(Arterial_Blood/VAB - Kidneys/KbKI/VKI); d/dt(Arterial_Blood) = QLU*(Lungs/KbLU/VLU - Arterial_Blood/VAB); d/dt(Venous_Blood) = QHT*Heart/KbHT/VHT + QBR*Brain/KbBR/VBR + QMU*Muscles/KbMU/VMU + QAD*Adipose/KbAD/VAD + QSK*Skin/KbSK/VSK + QLI*Liver/KbLI/VLI + QBO*Bones/KbBO/VBO + QKI*Kidneys/KbKI/VKI + QRB*Rest_of_Body/KbRB/VRB - QLU*Venous_Blood/VVB; d/dt(Rest_of_Body) = QRB*(Arterial_Blood/VAB - Rest_of_Body/KbRB/VRB); }) } pbpk2 <- pbpk2() pbpk2 #> -- rxode2-based free-form 16-cmt ODE model ------------------------------------- #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 Venous_Blood #> 2 2 Skin #> 3 3 Lungs #> 4 4 Heart #> 5 5 Brain #> 6 6 Muscles #> 7 7 Adipose #> 8 8 Spleen #> 9 9 Pancreas #> 10 10 Liver #> 11 11 Stomach #> 12 12 Gut #> 13 13 Bones #> 14 14 Kidneys #> 15 15 Arterial_Blood #> 16 16 Rest_of_Body #> -- Model (Normalized Syntax): -- #> function() { #> model({ #> cmt(Venous_Blood) #> cmt(Skin) #> KbBR = exp(lKbBR) #> KbMU = exp(lKbMU) #> KbAD = exp(lKbAD) #> CLint = exp(lCLint + eta.LClint) #> KbBO = exp(lKbBO) #> KbRB = exp(lKbRB) #> CO = (187 * WT^0.81) * 60/1000 #> QHT = 4 * CO/100 #> QBR = 12 * CO/100 #> QMU = 17 * CO/100 #> QAD = 5 * CO/100 #> QSK = 5 * CO/100 #> QSP = 3 * CO/100 #> QPA = 1 * CO/100 #> QLI = 25.5 * CO/100 #> QST = 1 * CO/100 #> QGU = 14 * CO/100 #> QHA = QLI - (QSP + QPA + QST + QGU) #> QBO = 5 * CO/100 #> QKI = 19 * CO/100 #> QRB = CO - (QHT + QBR + QMU + QAD + QSK + QLI + QBO + #> QKI) #> QLU = QHT + QBR + QMU + QAD + QSK + QLI + QBO + QKI + #> QRB #> VLU = (0.76 * WT/100)/1.051 #> VHT = (0.47 * WT/100)/1.03 #> VBR = (2 * WT/100)/1.036 #> VMU = (40 * WT/100)/1.041 #> VAD = (21.42 * WT/100)/0.916 #> VSK = (3.71 * WT/100)/1.116 #> VSP = (0.26 * WT/100)/1.054 #> VPA = (0.14 * WT/100)/1.045 #> VLI = (2.57 * WT/100)/1.04 #> VST = (0.21 * WT/100)/1.05 #> VGU = (1.44 * WT/100)/1.043 #> VBO = (14.29 * WT/100)/1.99 #> VKI = (0.44 * WT/100)/1.05 #> VAB = (2.81 * WT/100)/1.04 #> VVB = (5.62 * WT/100)/1.04 #> VRB = (3.86 * WT/100)/1.04 #> BP = 0.61 #> fup = 0.028 #> fub = fup/BP #> KbLU = exp(0.8334) #> KbHT = exp(1.1205) #> KbSK = exp(-0.5238) #> KbSP = exp(0.3224) #> KbPA = exp(0.3224) #> KbLI = exp(1.7604) #> KbST = exp(0.3224) #> KbGU = exp(1.2026) #> KbKI = exp(1.3171) #> S15 = VVB * BP/1000 #> C15 = Venous_Blood/S15 #> d/dt(Lungs) = QLU * (Venous_Blood/VVB - Lungs/KbLU/VLU) #> d/dt(Heart) = QHT * (Arterial_Blood/VAB - Heart/KbHT/VHT) #> d/dt(Brain) = QBR * (Arterial_Blood/VAB - Brain/KbBR/VBR) #> d/dt(Muscles) = QMU * (Arterial_Blood/VAB - Muscles/KbMU/VMU) #> d/dt(Adipose) = QAD * (Arterial_Blood/VAB - Adipose/KbAD/VAD) #> d/dt(Skin) = QSK * (Arterial_Blood/VAB - Skin/KbSK/VSK) #> d/dt(Spleen) = QSP * (Arterial_Blood/VAB - Spleen/KbSP/VSP) #> d/dt(Pancreas) = QPA * (Arterial_Blood/VAB - Pancreas/KbPA/VPA) #> d/dt(Liver) = QHA * Arterial_Blood/VAB + QSP * Spleen/KbSP/VSP + #> QPA * Pancreas/KbPA/VPA + QST * Stomach/KbST/VST + #> QGU * Gut/KbGU/VGU - CLint * fub * Liver/KbLI/VLI - #> QLI * Liver/KbLI/VLI #> d/dt(Stomach) = QST * (Arterial_Blood/VAB - Stomach/KbST/VST) #> d/dt(Gut) = QGU * (Arterial_Blood/VAB - Gut/KbGU/VGU) #> d/dt(Bones) = QBO * (Arterial_Blood/VAB - Bones/KbBO/VBO) #> d/dt(Kidneys) = QKI * (Arterial_Blood/VAB - Kidneys/KbKI/VKI) #> d/dt(Arterial_Blood) = QLU * (Lungs/KbLU/VLU - Arterial_Blood/VAB) #> d/dt(Venous_Blood) = QHT * Heart/KbHT/VHT + QBR * Brain/KbBR/VBR + #> QMU * Muscles/KbMU/VMU + QAD * Adipose/KbAD/VAD + #> QSK * Skin/KbSK/VSK + QLI * Liver/KbLI/VLI + QBO * #> Bones/KbBO/VBO + QKI * Kidneys/KbKI/VKI + QRB * Rest_of_Body/KbRB/VRB - #> QLU * Venous_Blood/VVB #> d/dt(Rest_of_Body) = QRB * (Arterial_Blood/VAB - Rest_of_Body/KbRB/VRB) #> }) #> }"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-cmt.html","id":"appending-compartments-to-the-model","dir":"Articles","previous_headings":"","what":"Appending compartments to the model","title":"Changing rxode2 compartment numbers","text":"can also append “compartments” model. ODE solving internals, add fake compartments model differential equations defined. example legal: can see clearly underlying classic rxode2 model: compartments defined differential equations supported; model : give error:","code":"ode.1c.ka <- function(){ model({ C2 = center/V d / dt(depot) = -KA * depot d/dt(center) = KA * depot - CL*C2 cmt(eff) }) } ode.1c.ka <- ode.1c.ka() print(ode.1c.ka) #> -- rxode2-based free-form 2-cmt ODE model -------------------------------------- #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 depot #> 2 2 center #> -- Model (Normalized Syntax): -- #> function() { #> model({ #> C2 = center/V #> d/dt(depot) = -KA * depot #> d/dt(center) = KA * depot - CL * C2 #> cmt(eff) #> }) #> } ode.1c.ka$simulationModel #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> rxode2 2.0.14.9000 model named rx_a34f770c8ba668b242ec15fd28a802d9 model (ready). #> x$state: depot, center #> x$stateExtra: eff #> x$params: V, KA, CL #> x$lhs: C2 ode.1c.ka <- rxode2({ cmt(eff) C2 = center/V; d / dt(depot) = -KA * depot d/dt(center) = KA * depot - CL*C2 }) Error in rxModelVars_(obj) : Evaluation error: Compartment 'eff' needs differential equations defined."},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-covariates.html","id":"individual-covariates","dir":"Articles","previous_headings":"","what":"Individual Covariates","title":"rxode2 Covariates","text":"individual covariate wish solve may specify iCov dataset:","code":"library(rxode2) ## rxode2 2.0.14.9000 using 2 threads (see ?getRxThreads) ## no cache: create with `rxCreateCache()` library(units) ## udunits database from /usr/share/xml/udunits/udunits2.xml library(xgxr) mod3 <- function() { ini({ TKA <- 2.94E-01 ## Clearance with individuals TCL <- 1.86E+01 TV2 <-4.02E+01 TQ <-1.05E+01 TV3 <-2.97E+02 TKin <- 1 TKout <- 1 TEC50 <-200 }) model({ KA <- TKA CL <- TCL * (WT / 70) ^ 0.75 V2 <- TV2 Q <- TQ V3 <- TV3 Kin <- TKin Kout <- TKout EC50 <- TEC50 Tz <- 8 amp <- 0.1 C2 <- central/V2 C3 <- peri/V3 d/dt(depot) <- -KA*depot d/dt(central) <- KA*depot - CL*C2 - Q*C2 + Q*C3 d/dt(peri) <- Q*C2 - Q*C3 d/dt(eff) <- Kin - Kout*(1-C2/(EC50+C2))*eff eff(0) <- 1 ## This specifies that the effect compartment starts at 1. }) } ev <- et(amount.units=\"mg\", time.units=\"hours\") %>% et(amt=10000, cmt=1) %>% et(0,48,length.out=100) %>% et(id=1:4) set.seed(10) rxSetSeed(10) ## Now use iCov to simulate a 4-id sample r1 <- solve(mod3, ev, # Create individual covariate data-frame iCov=data.frame(id=1:4, WT=rnorm(4, 70, 10))) ## using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ print(r1) ## ── Solved rxode2 object ── ## ── Parameters ($params): ── ## TKA TCL TV2 TQ TV3 TKin TKout TEC50 Tz amp ## 0.294 18.600 40.200 10.500 297.000 1.000 1.000 200.000 8.000 0.100 ## ── Initial Conditions ($inits): ── ## depot central peri eff ## 0 0 0 1 ## ── First part of data (object): ── ## # A tibble: 400 × 17 ## id time KA CL V2 Q V3 Kin Kout EC50 C2 C3 depot ## [h] ## 1 1 0 0.294 18.6 40.2 10.5 297 1 1 200 0 0 10000 ## 2 1 0.485 0.294 18.6 40.2 10.5 297 1 1 200 27.8 0.257 8671. ## 3 1 0.970 0.294 18.6 40.2 10.5 297 1 1 200 43.7 0.873 7519. ## 4 1 1.45 0.294 18.6 40.2 10.5 297 1 1 200 51.7 1.68 6520. ## 5 1 1.94 0.294 18.6 40.2 10.5 297 1 1 200 54.7 2.56 5654. ## 6 1 2.42 0.294 18.6 40.2 10.5 297 1 1 200 54.5 3.45 4903. ## # ℹ 394 more rows ## # ℹ 4 more variables: central , peri , eff , WT plot(r1, C2, log=\"y\") ## Warning: Transformation introduced infinite values in continuous y-axis"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-covariates.html","id":"time-varying-covariates","dir":"Articles","previous_headings":"","what":"Time Varying Covariates","title":"rxode2 Covariates","text":"Covariates easy specify rxode2, can specify variable. Time-varying covariates, like clock time circadian rhythm model, can also used. Extending indirect response model already discussed, : Now covariate present event dataset, system can solved combining dataset model: solving ODE equations, solver may sample times outside data. happens, ODE solver can use linear interpolation covariate values. equivalent R’s approxfun method=\"linear\". Note linear approximation case leads kinks solved system 24-hours covariate linear interpolation near 24 near 0. linear seems reasonable, cases like clock time make interpolation methods attractive. rxode2 default covariate interpolation last observation carried forward (locf), constant approximation. equivalent R’s approxfun method=\"constant\". gives following plots: case, plots seem smoother. can also use NONMEM’s preferred interpolation style next observation carried backward (NOCB): gives following plots:","code":"library(rxode2) library(units) mod4 <- mod3 %>% model(d/dt(eff) <- Kin - Kout*(1-C2/(EC50+C2))*eff) %>% model(-Kin) %>% model(Kin <- TKin + amp *cos(2*pi*(ctime-Tz)/24), append=C2, cov=\"ctime\") ev <- et(amountUnits=\"mg\", timeUnits=\"hours\") %>% et(amt=10000, cmt=1) %>% et(0,48,length.out=100) ## Create data frame of 8 am dosing for the first dose This is done ## with base R but it can be done with dplyr or data.table ev$ctime <- (ev$time+set_units(8,hr)) %% 24 ev$WT <- 70 r1 <- solve(mod4, ev, covsInterpolation=\"linear\") print(r1) #> ── Solved rxode2 object ── #> ── Parameters ($params): ── #> TKA TCL TV2 TQ TV3 TKout TEC50 #> 0.294000 18.600000 40.200000 10.500000 297.000000 1.000000 200.000000 #> TKin Tz amp pi #> 1.000000 8.000000 0.100000 3.141593 #> ── Initial Conditions ($inits): ── #> depot central peri eff #> 0 0 0 1 #> ── First part of data (object): ── #> # A tibble: 100 × 17 #> time KA CL V2 Q V3 Kout EC50 C2 Kin C3 depot #> [h] #> 1 0 0.294 18.6 40.2 10.5 297 1 200 0 1.1 0 10000 #> 2 0.485 0.294 18.6 40.2 10.5 297 1 200 27.8 1.10 0.257 8671. #> 3 0.970 0.294 18.6 40.2 10.5 297 1 200 43.7 1.10 0.874 7519. #> 4 1.45 0.294 18.6 40.2 10.5 297 1 200 51.8 1.09 1.68 6520. #> 5 1.94 0.294 18.6 40.2 10.5 297 1 200 54.8 1.09 2.56 5654. #> 6 2.42 0.294 18.6 40.2 10.5 297 1 200 54.6 1.08 3.45 4903. #> # ℹ 94 more rows #> # ℹ 5 more variables: central , peri , eff , ctime [h], WT plot(r1,C2, ylab=\"Central Concentration\") plot(r1,eff) + ylab(\"Effect\") + xlab(\"Time\") r1 <- solve(mod4, ev,covsInterpolation=\"locf\") print(r1) #> ── Solved rxode2 object ── #> ── Parameters ($params): ── #> TKA TCL TV2 TQ TV3 TKout TEC50 #> 0.294000 18.600000 40.200000 10.500000 297.000000 1.000000 200.000000 #> TKin Tz amp pi #> 1.000000 8.000000 0.100000 3.141593 #> ── Initial Conditions ($inits): ── #> depot central peri eff #> 0 0 0 1 #> ── First part of data (object): ── #> # A tibble: 100 × 17 #> time KA CL V2 Q V3 Kout EC50 C2 Kin C3 depot #> [h] #> 1 0 0.294 18.6 40.2 10.5 297 1 200 0 1.1 0 10000 #> 2 0.485 0.294 18.6 40.2 10.5 297 1 200 27.8 1.10 0.257 8671. #> 3 0.970 0.294 18.6 40.2 10.5 297 1 200 43.7 1.10 0.874 7519. #> 4 1.45 0.294 18.6 40.2 10.5 297 1 200 51.8 1.09 1.68 6520. #> 5 1.94 0.294 18.6 40.2 10.5 297 1 200 54.8 1.09 2.56 5654. #> 6 2.42 0.294 18.6 40.2 10.5 297 1 200 54.6 1.08 3.45 4903. #> # ℹ 94 more rows #> # ℹ 5 more variables: central , peri , eff , ctime [h], WT plot(r1,C2, ylab=\"Central Concentration\", xlab=\"Time\") plot(r1,eff, ylab=\"Effect\", xlab=\"Time\") r1 <- solve(mod4, ev,covsInterpolation=\"nocb\") print(r1) #> ── Solved rxode2 object ── #> ── Parameters ($params): ── #> TKA TCL TV2 TQ TV3 TKout TEC50 #> 0.294000 18.600000 40.200000 10.500000 297.000000 1.000000 200.000000 #> TKin Tz amp pi #> 1.000000 8.000000 0.100000 3.141593 #> ── Initial Conditions ($inits): ── #> depot central peri eff #> 0 0 0 1 #> ── First part of data (object): ── #> # A tibble: 100 × 17 #> time KA CL V2 Q V3 Kout EC50 C2 Kin C3 depot #> [h] #> 1 0 0.294 18.6 40.2 10.5 297 1 200 0 1.1 0 10000 #> 2 0.485 0.294 18.6 40.2 10.5 297 1 200 27.8 1.10 0.257 8671. #> 3 0.970 0.294 18.6 40.2 10.5 297 1 200 43.7 1.10 0.874 7519. #> 4 1.45 0.294 18.6 40.2 10.5 297 1 200 51.8 1.09 1.68 6520. #> 5 1.94 0.294 18.6 40.2 10.5 297 1 200 54.8 1.09 2.56 5654. #> 6 2.42 0.294 18.6 40.2 10.5 297 1 200 54.6 1.08 3.45 4903. #> # ℹ 94 more rows #> # ℹ 5 more variables: central , peri , eff , ctime [h], WT plot(r1,C2, ylab=\"Central Concentration\", xlab=\"Time\") plot(r1,eff, ylab=\"Effect\", xlab=\"Time\")"},{"path":[]},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-data-frame.html","id":"creating-an-interactive-data-frame","dir":"Articles","previous_headings":"Using rxode2 data frames","what":"Creating an interactive data frame","title":"rxode2 Data Frames","text":"rxode2 supports returning solved object modified data-frame. done predict(), solve(), rxSolve() methods.","code":"library(rxode2) library(units) ## Setup example model mod1 <- function() { ini({ # central KA <- 2.94E-01 CL <- 1.86E+01 # peripheral V2 <- 4.02E+01 Q <- 1.05E+01 V3 <- 2.97E+02 # effects Kin <- 1 Kout <- 1 EC50 <- 200 }) model({ C2 <- centr/V2 C3 <- peri/V3 d/dt(depot) <- -KA*depot d/dt(centr) <- KA*depot - CL*C2 - Q*C2 + Q*C3 d/dt(peri) <- Q*C2 - Q*C3 d/dt(eff) <- Kin - Kout*(1-C2/(EC50+C2))*eff eff(0) <- 1 }) } ## Seup parameters and initial conditions ## Setup dosing event information ev <- et(amountUnits=\"mg\", timeUnits = \"hours\") %>% et(amt=10000, addl=9, ii=12) %>% et(amt=20000, addl=4, time=120, ii=24) %>% et(0:240) ## Now solve x <- predict(mod1, ev) x #> -- Solved rxode2 object -- #> -- Parameters (x$params): -- #> KA CL V2 Q V3 Kin Kout EC50 #> 0.294 18.600 40.200 10.500 297.000 1.000 1.000 200.000 #> -- Initial Conditions (x$inits): -- #> depot centr peri eff #> 0 0 0 1 #> -- First part of data (object): -- #> # A tibble: 241 x 7 #> time C2 C3 depot centr peri eff #> [h] #> 1 0 0 0 10000 0 0 1 #> 2 1 44.4 0.920 7453. 1784. 273. 1.08 #> 3 2 54.9 2.67 5554. 2206. 794. 1.18 #> 4 3 51.9 4.46 4140. 2087. 1324. 1.23 #> 5 4 44.5 5.98 3085. 1789. 1776. 1.23 #> 6 5 36.5 7.18 2299. 1467. 2132. 1.21 #> # i 235 more rows"},{"path":[]},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-data-frame.html","id":"using-the-solved-object-as-a-simple-data-frame","dir":"Articles","previous_headings":"Using rxode2 data frames","what":"Using the solved object as a simple data frame","title":"rxode2 Data Frames","text":"solved object acts data.frame tbl can filtered dpylr. example filter easily.","code":"library(dplyr) ## You can drop units for comparisons and filtering x <- mod1 %>% solve(ev) %>% drop_units() %>% filter(time <= 3) %>% as_tibble() ## or keep them and compare with the proper units. x <- mod1 %>% solve(ev) %>% filter(time <= set_units(3, hr)) %>% as_tibble() x #> # A tibble: 4 x 7 #> time C2 C3 depot centr peri eff #> [h] #> 1 0 0 0 10000 0 0 1 #> 2 1 44.4 0.920 7453. 1784. 273. 1.08 #> 3 2 54.9 2.67 5554. 2206. 794. 1.18 #> 4 3 51.9 4.46 4140. 2087. 1324. 1.23"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-data-frame.html","id":"updating-the-data-set-interactively","dir":"Articles","previous_headings":"","what":"Updating the data-set interactively","title":"rxode2 Data Frames","text":"However isn’t just simple data object. can use solved object update parameters fly, even change sampling time. First need recreate original solved system:","code":"x <- mod1 %>% solve(ev) print(x) #> -- Solved rxode2 object -- #> -- Parameters ($params): -- #> KA CL V2 Q V3 Kin Kout EC50 #> 0.294 18.600 40.200 10.500 297.000 1.000 1.000 200.000 #> -- Initial Conditions ($inits): -- #> depot centr peri eff #> 0 0 0 1 #> -- First part of data (object): -- #> # A tibble: 241 x 7 #> time C2 C3 depot centr peri eff #> [h] #> 1 0 0 0 10000 0 0 1 #> 2 1 44.4 0.920 7453. 1784. 273. 1.08 #> 3 2 54.9 2.67 5554. 2206. 794. 1.18 #> 4 3 51.9 4.46 4140. 2087. 1324. 1.23 #> 5 4 44.5 5.98 3085. 1789. 1776. 1.23 #> 6 5 36.5 7.18 2299. 1467. 2132. 1.21 #> # i 235 more rows"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-data-frame.html","id":"modifying-observation-times-for-rxode2","dir":"Articles","previous_headings":"Updating the data-set interactively","what":"Modifying observation times for rxode2","title":"rxode2 Data Frames","text":"Notice initial effect now 2. can also change sampling times easily method changing t time. example:","code":"x$t <- seq(0,5,length.out=20) print(x) #> -- Solved rxode2 object -- #> -- Parameters ($params): -- #> KA CL V2 Q V3 Kin Kout EC50 #> 0.294 18.600 40.200 10.500 297.000 1.000 1.000 200.000 #> -- Initial Conditions ($inits): -- #> depot centr peri eff #> 0 0 0 1 #> -- First part of data (object): -- #> # A tibble: 20 x 7 #> time C2 C3 depot centr peri eff #> [h] #> 1 0 0 0 10000 0 0 1 #> 2 0.263 16.8 0.0817 9255. 677. 24.3 1.01 #> 3 0.526 29.5 0.299 8566. 1187. 88.7 1.03 #> 4 0.789 38.9 0.615 7929. 1562. 183. 1.06 #> 5 1.05 45.5 1.00 7338. 1830. 298. 1.09 #> 6 1.32 50.1 1.44 6792. 2013. 427. 1.12 #> # i 14 more rows plot(x)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-data-frame.html","id":"modifying-simulation-parameters","dir":"Articles","previous_headings":"Updating the data-set interactively","what":"Modifying simulation parameters","title":"rxode2 Data Frames","text":"can also access change parameters $ operator. example, accessing KA can done : may change assigning new value. can access/change parameters, initialization(s) events $params, $inits, $events accessor syntax, similar used . syntax makes easy update explore effect various parameters solved object.","code":"x$KA #> [1] 0.294 x$KA <- 1 print(x) #> -- Solved rxode2 object -- #> -- Parameters ($params): -- #> KA CL V2 Q V3 Kin Kout EC50 #> 1.0 18.6 40.2 10.5 297.0 1.0 1.0 200.0 #> -- Initial Conditions ($inits): -- #> depot centr peri eff #> 0 0 0 1 #> -- First part of data (object): -- #> # A tibble: 20 x 7 #> time C2 C3 depot centr peri eff #> [h] #> 1 0 0 0 10000 0 0 1 #> 2 0.263 52.2 0.261 7686. 2098. 77.6 1.03 #> 3 0.526 83.3 0.900 5908. 3348. 267. 1.09 #> 4 0.789 99.8 1.75 4541. 4010. 519. 1.15 #> 5 1.05 106. 2.69 3490. 4273. 800. 1.21 #> 6 1.32 106. 3.66 2683. 4272. 1086. 1.26 #> # i 14 more rows plot(x)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-datasets.html","id":"datasets-for-rxode2-nlmixr","dir":"Articles","previous_headings":"","what":"Datasets for rxode2 & nlmixr","title":"rxode2 Event Types","text":"Data input nlmixr type data input rxode2, similar data NONMEM (NONMEM-ready datasets can used directly nlmixr).","code":""},{"path":[]},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-datasets.html","id":"subject-identification-columns","dir":"Articles","previous_headings":"Columns Described by Type of Use","what":"Subject Identification Columns","title":"rxode2 Event Types","text":"subject identification column separates subjects identification random effects. ID: subject identifier may integer, character, factor.","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-datasets.html","id":"observation-columns","dir":"Articles","previous_headings":"Columns Described by Type of Use","what":"Observation Columns","title":"rxode2 Event Types","text":"Observation columns used indicate dependent variable use measure . DV: numeric column measurement CENS: numeric column indication censoring, limit quantification assay. LIMIT: numeric column helping indicate type censoring, limit quantification assay. MDV: indicator missing DV values CMT: name number compartment DVID: dependent variable identifier EVID event identifier","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-datasets.html","id":"dosing-columns","dir":"Articles","previous_headings":"Columns Described by Type of Use","what":"Dosing Columns","title":"rxode2 Event Types","text":"AMT: amount dose CMT: name number compartment EVID: event identifier ADDL: number additional doses RATE DUR: rate duration dose","code":""},{"path":[]},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-datasets.html","id":"details-for-specific-dataset-columns","dir":"Articles","previous_headings":"","what":"Details for Specific Dataset Columns","title":"rxode2 Event Types","text":"details sorted alphabetically column name. grouping use, see documentation .","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-datasets.html","id":"amt-column","dir":"Articles","previous_headings":"Details for Specific Dataset Columns","what":"AMT Column","title":"rxode2 Event Types","text":"AMT column defines amount dose. observation rows, 0 NA. dosing rows, amount dose administered CMT. dose zero-order rate (constant infusion), infusion may setup using RATE DUR column.","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-datasets.html","id":"censlimit-columns","dir":"Articles","previous_headings":"Details for Specific Dataset Columns","what":"CENS/LIMIT Columns","title":"rxode2 Event Types","text":"CENS column indicator column indicating censoring occurred. pharmacokinetic modeling, censoring typically sample limit quantification. Internally rxode2 saves values nlmixr can use likelihood calculations. CENS = 0 indicates value DV measured without censoring. CENS = 1 indicates value left censored (limit quantitation) value DV censoring/quantitation limit. CENS = -1 indicates value right censored (limit quantitation) value DV censoring/quantitation limit. LIMIT additional information censoring handled nlmixr stored rxode2’s data structure well. value left censored, like limit 1 may also believe value certain threshold, like zero. case, limit 0 indicates censored value 0 1. short : CENS = 0 LIMIT ignored observation censored CENS = 1 value censored (LIMIT, DV) CENS = -1 value censored (DV, LIMIT)","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-datasets.html","id":"cmt-column","dir":"Articles","previous_headings":"Details for Specific Dataset Columns","what":"CMT Column","title":"rxode2 Event Types","text":"CMT column indicates compartment event occurs. given character string factor (preferred method), matched name model. given integer, matched order compartments appear model.","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-datasets.html","id":"dur-column","dir":"Articles","previous_headings":"Details for Specific Dataset Columns","what":"DUR Column","title":"rxode2 Event Types","text":"DUR column defines duration infusion. used set duration zero-order rate infusion.","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-datasets.html","id":"dv-column","dir":"Articles","previous_headings":"Details for Specific Dataset Columns","what":"DV Column","title":"rxode2 Event Types","text":"DV column indicates current measurement current compartment (see CMT) current measurement identifier (see DVID) may missing (see MDV) censored (see CENS).","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-datasets.html","id":"dvid-column","dir":"Articles","previous_headings":"Details for Specific Dataset Columns","what":"DVID Column","title":"rxode2 Event Types","text":"TODO","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-datasets.html","id":"evid-column","dir":"Articles","previous_headings":"Details for Specific Dataset Columns","what":"EVID Column","title":"rxode2 Event Types","text":"EVID column event identifier row data. observation records, 0. normal dosing records, 1. Many EVID values detailed rxode2 Event Types Classic rxode2 Events vignettes.","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-datasets.html","id":"id-column","dir":"Articles","previous_headings":"Details for Specific Dataset Columns","what":"ID Column","title":"rxode2 Event Types","text":"ID column subject identifier. column used separate one individual (usually single person animal) another. model, ID column used separate individuals. numerical integrator re-initializes new individual, new values random effects selected.","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-datasets.html","id":"rate-column","dir":"Articles","previous_headings":"Details for Specific Dataset Columns","what":"RATE Column","title":"rxode2 Event Types","text":"TODO","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-table.html","id":"creating-rxode2s-event-tables","dir":"Articles","previous_headings":"","what":"Creating rxode2’s event tables","title":"Easy rxode2 Event Tables","text":"event table rxode2 specialized data frame acts container rxode2’s events observation times. create rxode2 event table may use code eventTable(), et(), even create data frame right event information contained . closely related types events rxode2 supports. event table can add sampling/observations doses piping direct access. short table two main functions create dosing Sampling times can added add.sampling( sampling times ) et( sampling times ). Dosing intervals sampling windows also supported. documentation using et() syntax, though supported. models, can illustrate using model shared rxode2 tutorial:","code":"library(rxode2) #> rxode2 2.0.14.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()` library(units) #> udunits database from /usr/share/xml/udunits/udunits2.xml (ev <- et()) #> -- EventTable with 0 records -- #> 0 dosing records (see x$get.dosing(); add with add.dosing or et) #> 0 observation times (see x$get.sampling(); add with add.sampling or et) (ev <- et()) #> -- EventTable with 0 records -- #> 0 dosing records (see x$get.dosing(); add with add.dosing or et) #> 0 observation times (see x$get.sampling(); add with add.sampling or et) ## Model from rxode2 tutorial m1 <-function() { ini({ KA <- 2.94E-01 CL <- 1.86E+01 V2 <- 4.02E+01 Q <- 1.05E+01 V3 <- 2.97E+02 Kin <- 1 Kout <- 1 EC50 <- 200 ## Added modeled bioavaiblity, duration and rate fdepot <- 1 durDepot <- 8 rateDepot <- 1250 }) model({ C2 <- centr/V2 C3 <- peri/V3 d/dt(depot) <- -KA*depot f(depot) <- fdepot dur(depot) <- durDepot rate(depot) <- rateDepot d/dt(centr) <- KA*depot - CL*C2 - Q*C2 + Q*C3 d/dt(peri) <- Q*C2 - Q*C3 d/dt(eff) <- Kin - Kout*(1-C2/(EC50+C2))*eff; eff(0) <- 1 }) }"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-table.html","id":"adding-doses-to-the-event-table","dir":"Articles","previous_headings":"Creating rxode2’s event tables","what":"Adding doses to the event table","title":"Easy rxode2 Event Tables","text":"created can add dosing event table add.dosing(), et() functions. Using add.dosing() function : Notice units specified table. specified, units use units package keep track units convert needed. Additionally, ggforce uses label ggplot axes. set_units drop_units useful set drop rxode2 event table units. example, can see time axes labeled: familiar NONMEM/rxode2 event records, can also specify dosing using et dose elements directly: gives: shows easy creating event tables can .","code":"ev <- eventTable(amount.units=\"mg\", time.units=\"hr\") ## The methods ar attached to the event table, so you can use ## them directly ev$add.dosing(dose=10000, nbr.doses = 3)# loading doses ## Starts at time 0; Default dosing interval is 24 ## You can also pipe the event tables to these methods. ev <- ev %>% add.dosing(dose=5000, nbr.doses=14, dosing.interval=12)# maintenance ev #> -- EventTable with 2 records -- #> 2 dosing records (see x$get.dosing(); add with add.dosing or et) #> 0 observation times (see x$get.sampling(); add with add.sampling or et) #> multiple doses in `addl` columns, expand with x$expand(); or etExpand(x) #> -- First part of x: -- #> # A tibble: 2 x 5 #> time amt ii addl evid #> [h] [mg] [h] #> 1 0 10000 24 2 1:Dose (Add) #> 2 0 5000 12 13 1:Dose (Add) rxSolve(m1, ev) %>% plot(C2) #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ ev <- et(timeUnits=\"hr\") %>% et(amt=10000, until = set_units(3, days), ii=12) # loading doses ev #> -- EventTable with 1 records -- #> 1 dosing records (see x$get.dosing(); add with add.dosing or et) #> 0 observation times (see x$get.sampling(); add with add.sampling or et) #> multiple doses in `addl` columns, expand with x$expand(); or etExpand(x) #> -- First part of x: -- #> # A tibble: 1 x 5 #> time amt ii addl evid #> [h] [h] #> 1 0 10000 12 6 1:Dose (Add) rxSolve(m1, ev) %>% plot(C2) #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-table.html","id":"adding-sampling-to-an-event-table","dir":"Articles","previous_headings":"Creating rxode2’s event tables","what":"Adding sampling to an event table","title":"Easy rxode2 Event Tables","text":"notice examples, rxode2 generated default sampling times since sampling times. wish control sampling time, add samples rxode2 event table add.sampling et gives: use et can simply add similar way add.sampling: gives following rxode2 solve: Note jagged nature plots since sample times.","code":"ev <- eventTable(amount.units=\"mg\", time.units=\"hr\") ## The methods ar attached to the event table, so you can use them ## directly ev$add.dosing(dose=10000, nbr.doses = 3)# loading doses ev$add.sampling(seq(0,24,by=4)) ev #> -- EventTable with 8 records -- #> 1 dosing records (see x$get.dosing(); add with add.dosing or et) #> 7 observation times (see x$get.sampling(); add with add.sampling or et) #> multiple doses in `addl` columns, expand with x$expand(); or etExpand(x) #> -- First part of x: -- #> # A tibble: 8 x 5 #> time amt ii addl evid #> [h] [mg] [h] #> 1 0 NA NA NA 0:Observation #> 2 0 10000 24 2 1:Dose (Add) #> 3 4 NA NA NA 0:Observation #> 4 8 NA NA NA 0:Observation #> 5 12 NA NA NA 0:Observation #> 6 16 NA NA NA 0:Observation #> 7 20 NA NA NA 0:Observation #> 8 24 NA NA NA 0:Observation solve(m1, ev) %>% plot(C2) ev <- et(timeUnits=\"hr\") %>% et(amt=10000, until = set_units(3, days), ii=12) %>% # loading doses et(seq(0,24,by=4)) ev #> -- EventTable with 8 records -- #> 1 dosing records (see x$get.dosing(); add with add.dosing or et) #> 7 observation times (see x$get.sampling(); add with add.sampling or et) #> multiple doses in `addl` columns, expand with x$expand(); or etExpand(x) #> -- First part of x: -- #> # A tibble: 8 x 5 #> time amt ii addl evid #> [h] [h] #> 1 0 NA NA NA 0:Observation #> 2 0 10000 12 6 1:Dose (Add) #> 3 4 NA NA NA 0:Observation #> 4 8 NA NA NA 0:Observation #> 5 12 NA NA NA 0:Observation #> 6 16 NA NA NA 0:Observation #> 7 20 NA NA NA 0:Observation #> 8 24 NA NA NA 0:Observation solve(m1, ev) %>% plot(C2)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-table.html","id":"expand-the-event-table-to-a-multi-subject-event-table-","dir":"Articles","previous_headings":"Creating rxode2’s event tables","what":"Expand the event table to a multi-subject event table.","title":"Easy rxode2 Event Tables","text":"thing needed expand event table list IDs want expand; can see following simulation 4 individuals solved :","code":"ev <- et(timeUnits=\"hr\") %>% et(amt=10000, until = set_units(3, days), ii=12) %>% # loading doses et(seq(0,48,length.out=200)) %>% et(id=1:4) ev #> -- EventTable with 804 records -- #> 4 dosing records (see x$get.dosing(); add with add.dosing or et) #> 800 observation times (see x$get.sampling(); add with add.sampling or et) #> multiple doses in `addl` columns, expand with x$expand(); or etExpand(x) #> -- First part of x: -- #> # A tibble: 804 x 6 #> id time amt ii addl evid #> [h] [h] #> 1 1 0 NA NA NA 0:Observation #> 2 1 0 10000 12 6 1:Dose (Add) #> 3 1 0.241 NA NA NA 0:Observation #> 4 1 0.482 NA NA NA 0:Observation #> 5 1 0.724 NA NA NA 0:Observation #> 6 1 0.965 NA NA NA 0:Observation #> 7 1 1.21 NA NA NA 0:Observation #> 8 1 1.45 NA NA NA 0:Observation #> 9 1 1.69 NA NA NA 0:Observation #> 10 1 1.93 NA NA NA 0:Observation #> # i 794 more rows set.seed(42) rxSetSeed(42) solve(m1, ev, params=data.frame(KA=0.294*exp(rnorm(4)), CL=18.6*exp(rnorm(4)))) %>% plot(C2)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-table.html","id":"add-doses-and-samples-within-a-sampling-window","dir":"Articles","previous_headings":"Creating rxode2’s event tables","what":"Add doses and samples within a sampling window","title":"Easy rxode2 Event Tables","text":"addition adding fixed doses fixed sampling times, can windows sample draw doses . dosing windows specify time ordered numerical vector lowest dosing time highest dosing time inside list. example, start dosing time 6 hour dosing window: can clearly see different dosing times following simulation: course reality dosing interval may 2 hours: sort thing can specified sampling times. specify sampling times terms sampling window, can create list sampling times. sampling time two element ordered numeric vector. shows flexibility dosing sampling rxode2 event tables allow.","code":"set.seed(42) rxSetSeed(42) ev <- et(timeUnits=\"hr\") %>% et(time=list(c(0,6)), amt=10000, until = set_units(2, days), ii=12) %>% # loading doses et(id=1:4) ev #> -- EventTable with 16 records -- #> 16 dosing records (see x$get.dosing(); add with add.dosing or et) #> 0 observation times (see x$get.sampling(); add with add.sampling or et) #> -- First part of x: -- #> # A tibble: 16 x 6 #> id low time high amt evid #> [h] [h] [h] #> 1 1 0 5.49 6 10000 1:Dose (Add) #> 2 1 12 17.0 18 10000 1:Dose (Add) #> 3 1 24 25.7 30 10000 1:Dose (Add) #> 4 1 36 41.6 42 10000 1:Dose (Add) #> 5 2 0 4.31 6 10000 1:Dose (Add) #> 6 2 12 14.7 18 10000 1:Dose (Add) #> 7 2 24 28.2 30 10000 1:Dose (Add) #> 8 2 36 39.9 42 10000 1:Dose (Add) #> 9 3 0 0.808 6 10000 1:Dose (Add) #> 10 3 12 16.4 18 10000 1:Dose (Add) #> 11 3 24 27.1 30 10000 1:Dose (Add) #> 12 3 36 39.9 42 10000 1:Dose (Add) #> 13 4 0 4.98 6 10000 1:Dose (Add) #> 14 4 12 13.7 18 10000 1:Dose (Add) #> 15 4 24 29.6 30 10000 1:Dose (Add) #> 16 4 36 41.5 42 10000 1:Dose (Add) ev <- ev %>% et(seq(0,48,length.out=200)) solve(m1, ev, params=data.frame(KA=0.294*exp(rnorm(4)), CL=18.6*exp(rnorm(4)))) %>% plot(C2) set.seed(42) rxSetSeed(42) ev <- et(timeUnits=\"hr\") %>% et(time=list(c(0,2)), amt=10000, until = set_units(2, days), ii=12) %>% # loading doses et(id=1:4) %>% et(seq(0,48,length.out=200)) solve(m1, ev, params=data.frame(KA=0.294*exp(rnorm(4)), CL=18.6*exp(rnorm(4)))) %>% plot(C2) rxSetSeed(42) set.seed(42) ev <- et(timeUnits=\"hr\") %>% et(time=list(c(0,2)), amt=10000, until = set_units(2, days), ii=12) %>% # loading doses et(id=1:4) ## Create 20 samples in the first 24 hours and 20 samples in the ## second 24 hours samples <- c(lapply(1:20, function(...){c(0,24)}), lapply(1:20, function(...){c(20,48)})) ## Add the random collection to the event table ev <- ev %>% et(samples) library(ggplot2) solve(m1, ev, params=data.frame(KA=0.294*exp(rnorm(4)), CL=18.6*exp(rnorm(4)))) %>% plot(C2) + geom_point()"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-table.html","id":"combining-event-tables","dir":"Articles","previous_headings":"Creating rxode2’s event tables","what":"Combining event tables","title":"Easy rxode2 Event Tables","text":"Since can create dosing records sampling records, can create complex dosing regimen wish. addition, rxode2 allows combine event tables c, seq, rep, rbind.","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-table.html","id":"sequencing-event-tables","dir":"Articles","previous_headings":"Creating rxode2’s event tables","what":"Sequencing event tables","title":"Easy rxode2 Event Tables","text":"One way combine event table sequence c, seq etSeq. takes two dosing groups adds least one inter-dose interval : sequencing events, can also separate sequence period time; example wanted separate week, easily following sequence event tables: Note example time bid qd event tables exactly one week, 1 week plus 24 hours inter-dose interval. want behavior, can sequence using wait=\"+ii\". Also note, rxode2 assumes dosing want space event tables , clears sampling records combine event tables. true, can also use option samples=\"use\"","code":"## bid for 5 days bid <- et(timeUnits=\"hr\") %>% et(amt=10000,ii=12,until=set_units(5, \"days\")) ## qd for 5 days qd <- et(timeUnits=\"hr\") %>% et(amt=20000,ii=24,until=set_units(5, \"days\")) ## bid for 5 days followed by qd for 5 days et <- seq(bid,qd) %>% et(seq(0,11*24,length.out=100)); rxSolve(m1, et) %>% plot(C2) ## bid for 5 days followed by qd for 5 days et <- seq(bid,set_units(1, \"week\"), qd) %>% et(seq(0,18*24,length.out=100)); rxSolve(m1, et) %>% plot(C2) ## bid for 5 days followed by qd for 5 days et <- seq(bid,set_units(1, \"week\"), qd,wait=\"+ii\") %>% et(seq(0,18*24,length.out=100)); rxSolve(m1, et) %>% plot(C2)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-table.html","id":"repeating-event-tables","dir":"Articles","previous_headings":"Creating rxode2’s event tables","what":"Repeating event tables","title":"Easy rxode2 Event Tables","text":"can event table can repeat etRep rep. example 4 rounds 2 weeks QD therapy 1 week therapy can simply specified: simplified way use sequence event tables. Therefore, many options still apply; samples cleared unless use samples=\"use\", time event tables least inter-dose interval. can adjust timing wait option.","code":"qd <-et(timeUnits = \"hr\") %>% et(amt=10000, ii=24, until=set_units(2, \"weeks\"), cmt=\"depot\") et <- rep(qd, times=4, wait=set_units(1,\"weeks\")) %>% add.sampling(set_units(seq(0, 12.5,by=0.005),weeks)) rxSolve(m1, et) %>% plot(C2)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-table.html","id":"combining-event-tables-with-rbind","dir":"Articles","previous_headings":"Creating rxode2’s event tables","what":"Combining event tables with rbind","title":"Easy rxode2 Event Tables","text":"may combine event tables rbind. consider event times combining event tables, keeps times. space event tables waiting period, also consider inter-dose interval. Using previous seq can clearly see difference. sequence: bind together rbind Still waiting period applies (consider inter-dose interval) can also bind tables together make ID event table unique; can good combine cohorts different expected dosing sampling times. requires id=\"unique\" option; Using first example shows different case:","code":"## bid for 5 days bid <- et(timeUnits=\"hr\") %>% et(amt=10000,ii=12,until=set_units(5, \"days\")) ## qd for 5 days qd <- et(timeUnits=\"hr\") %>% et(amt=20000,ii=24,until=set_units(5, \"days\")) et <- seq(bid,qd) %>% et(seq(0,18*24,length.out=500)); rxSolve(m1, et) %>% plot(C2) ## bid for 5 days et <- rbind(bid,qd) %>% et(seq(0,18*24,length.out=500)); rxSolve(m1, et) %>% plot(C2) et <- rbind(bid,wait=set_units(10,days),qd) %>% et(seq(0,18*24,length.out=500)); rxSolve(m1, et) %>% plot(C2) ## bid for 5 days et <- etRbind(bid,qd, id=\"unique\") %>% et(seq(0,150,length.out=500)); library(ggplot2) rxSolve(m1, et) %>% plot(C2) + facet_wrap( ~ id)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-table.html","id":"event-tables-in-rstudio-notebooks","dir":"Articles","previous_headings":"Creating rxode2’s event tables","what":"Event tables in Rstudio Notebooks","title":"Easy rxode2 Event Tables","text":"addition output console shown examples, Rstudio notebook output different can seen following screenshots; first screenshot shows event table looks evaluating Rstduio notebook simple dataframe allows page contents. click first box Rstudio notebook output, notes event table: ## Expanding events Event tables can expanded contain addl data item, like following example: can expand events addl items $expand() etExpand(ev): first, etExpand(ev) expands event table without modifying original data frame: can see addl events expanded, however original data frame remained intact: use ev$expand() modify ev object. similar object-oriented method:","code":"ev <- et() %>% et(dose=50, ii=8, until=48) ev #> -- EventTable with 1 records -- #> 1 dosing records (see x$get.dosing(); add with add.dosing or et) #> 0 observation times (see x$get.sampling(); add with add.sampling or et) #> multiple doses in `addl` columns, expand with x$expand(); or etExpand(x) #> -- First part of x: -- #> # A tibble: 1 x 5 #> time amt ii addl evid #> #> 1 0 50 8 6 1:Dose (Add) etExpand(ev) #> -- EventTable with 7 records -- #> 7 dosing records (see x$get.dosing(); add with add.dosing or et) #> 0 observation times (see x$get.sampling(); add with add.sampling or et) #> -- First part of x: -- #> # A tibble: 7 x 4 #> time amt ii evid #> #> 1 0 50 0 1:Dose (Add) #> 2 8 50 0 1:Dose (Add) #> 3 16 50 0 1:Dose (Add) #> 4 24 50 0 1:Dose (Add) #> 5 32 50 0 1:Dose (Add) #> 6 40 50 0 1:Dose (Add) #> 7 48 50 0 1:Dose (Add) print(ev) #> -- EventTable with 1 records -- #> 1 dosing records (see $get.dosing(); add with add.dosing or et) #> 0 observation times (see $get.sampling(); add with add.sampling or et) #> multiple doses in `addl` columns, expand with $expand(); or etExpand() #> -- First part of : -- #> # A tibble: 1 x 5 #> time amt ii addl evid #> #> 1 0 50 8 6 1:Dose (Add) ev$expand() ev #> -- EventTable with 7 records -- #> 7 dosing records (see x$get.dosing(); add with add.dosing or et) #> 0 observation times (see x$get.sampling(); add with add.sampling or et) #> -- First part of x: -- #> # A tibble: 7 x 4 #> time amt ii evid #> #> 1 0 50 0 1:Dose (Add) #> 2 8 50 0 1:Dose (Add) #> 3 16 50 0 1:Dose (Add) #> 4 24 50 0 1:Dose (Add) #> 5 32 50 0 1:Dose (Add) #> 6 40 50 0 1:Dose (Add) #> 7 48 50 0 1:Dose (Add)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-types.html","id":"rxode2-event-tables","dir":"Articles","previous_headings":"","what":"rxode2 event tables","title":"rxode2 Event Types","text":"general, rxode2 event tables follow NONMEM dataset convention exceptions: may turn compartment negative compartment number “-cmt” cmt compartment name. compartment data item (cmt) can still number, number compartment defined appearance compartment name model. can tedious count, can specify compartment numbers easier using cmt(cmtName) beginning model. Bioavailability changes change rate infusion since dur/amt fixed input data. Similarly, specifying rate/amt infusion, bioavailability change infusion duration since rate/amt fixed input data. infrequent NONMEM columns supported: pcmt, call. evid=5 replace event; replaces value compartment value specified amt column. equivalent deSolve=replace. evid=6 multiply event; multiplies value compartment value specified amt column. equivalent deSolve=multiply. evid=7 transit compartment model/phantom event. puts dose dose() function calculates time since last dose tad() doesn’t actually put dose compartment. allows transit() function easily apply compartment. legal entries data table: notes: evid can classic RxODE (described ) NONMEM-style evid described . NONMEM’s DV required; rxode2 ODE solving framework. NONMEM’s MDV required, since captured EVID. Instead NONMEM-compatible data, can accept deSolve compatible data-frames. returning rxode2 solved data-set additional event ids (EVID) may see depending solving options: EVID = -1 modeled rate ends (corresponds rate = -1) EVID = -2 modeled duration ends (corresponds rate=-2) EVID = -10 rate specified zero-order infusion ends (corresponds rate > 0) EVID = -20 duration specified zero-order infusion ends (corresponds dur > 0) EVID = 101, 102, 103,... correspond 1, 2, 3, … modeled time (mtime). can accessed solving option combination addDosing=TRUE subsetNonmem=FALSE. want see classic EVID equivalents can use addDosing=NA. illustrate event types use model original rxode2 tutorial.","code":"library(rxode2) #> rxode2 2.0.14.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()` ## Model from rxode2 tutorial m1 <- function() { ini({ KA <- 2.94E-01 CL <- 1.86E+01 V2 <- 4.02E+01 Q <- 1.05E+01 V3 <- 2.97E+02 Kin <- 1 Kout <- 1 EC50 <- 200 ## Added modeled bioavaiblity, duration and rate fdepot <- 1 durDepot <- 8 rateDepot <- 1250 }) model({ C2 <- centr/V2 C3 <- peri/V3 d/dt(depot) <- -KA*depot f(depot) <- fdepot dur(depot) <- durDepot rate(depot) <- rateDepot d/dt(centr) <- KA*depot - CL*C2 - Q*C2 + Q*C3 d/dt(peri) <- Q*C2 - Q*C3 d/dt(eff) <- Kin - Kout*(1-C2/(EC50+C2))*eff eff(0) <- 1 }) }"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-types.html","id":"bolusadditive-doses","dir":"Articles","previous_headings":"","what":"Bolus/Additive Doses","title":"rxode2 Event Types","text":"bolus dose default type dose rxode2 requires amt/dose. Note uses convenience function et() described rxode2 event tables","code":"ev <- et(timeUnits=\"hr\") %>% et(amt=10000, ii=12,until=24) %>% et(seq(0, 24, length.out=100)) ev #> -- EventTable with 101 records -- #> 1 dosing records (see x$get.dosing(); add with add.dosing or et) #> 100 observation times (see x$get.sampling(); add with add.sampling or et) #> multiple doses in `addl` columns, expand with x$expand(); or etExpand(x) #> -- First part of x: -- #> # A tibble: 101 x 5 #> time amt ii addl evid #> [h] [h] #> 1 0 NA NA NA 0:Observation #> 2 0 10000 12 2 1:Dose (Add) #> 3 0.242 NA NA NA 0:Observation #> 4 0.485 NA NA NA 0:Observation #> 5 0.727 NA NA NA 0:Observation #> 6 0.970 NA NA NA 0:Observation #> 7 1.21 NA NA NA 0:Observation #> 8 1.45 NA NA NA 0:Observation #> 9 1.70 NA NA NA 0:Observation #> 10 1.94 NA NA NA 0:Observation #> # i 91 more rows rxSolve(m1, ev) %>% plot(C2) + xlab(\"Time\")"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-types.html","id":"infusion-doses","dir":"Articles","previous_headings":"","what":"Infusion Doses","title":"rxode2 Event Types","text":"different type infusions rxode2 supports: Constant Rate Infusion (rate) Constant Duration Infusion (dur) Estimated Rate Infusion Estimated Duration Infusion","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-types.html","id":"constant-infusion-in-terms-of-duration-and-rate","dir":"Articles","previous_headings":"Infusion Doses","what":"Constant Infusion (in terms of duration and rate)","title":"rxode2 Event Types","text":"next type event infusion; two ways specify infusion; first dur keyword. example : can also specified rate component: exception bioavailability changes infusion. case modeling rate, bioavailability decrease, decreases infusion duration, NONMEM. example: Similarly increasing bioavailability increases infusion duration. rationale behavior rate amt specified event table, thing can change bioavailability increase duration infusion. specify amt dur components event table, bioavailability changes affect rate infusion. can see side--side comparison bioavailability changes affecting rate instead duration records following plots:","code":"ev <- et(timeUnits=\"hr\") %>% et(amt=10000, ii=12,until=24, dur=8) %>% et(seq(0, 24, length.out=100)) ev #> -- EventTable with 101 records -- #> 1 dosing records (see x$get.dosing(); add with add.dosing or et) #> 100 observation times (see x$get.sampling(); add with add.sampling or et) #> multiple doses in `addl` columns, expand with x$expand(); or etExpand(x) #> -- First part of x: -- #> # A tibble: 101 x 6 #> time amt ii addl evid dur #> [h] [h] [h] #> 1 0 NA NA NA 0:Observation NA #> 2 0 10000 12 2 1:Dose (Add) 8 #> 3 0.242 NA NA NA 0:Observation NA #> 4 0.485 NA NA NA 0:Observation NA #> 5 0.727 NA NA NA 0:Observation NA #> 6 0.970 NA NA NA 0:Observation NA #> 7 1.21 NA NA NA 0:Observation NA #> 8 1.45 NA NA NA 0:Observation NA #> 9 1.70 NA NA NA 0:Observation NA #> 10 1.94 NA NA NA 0:Observation NA #> # i 91 more rows rxSolve(m1, ev) %>% plot(depot, C2) + xlab(\"Time\") ev <- et(timeUnits=\"hr\") %>% et(amt=10000, ii=12,until=24, rate=10000/8) %>% et(seq(0, 24, length.out=100)) ev #> -- EventTable with 101 records -- #> 1 dosing records (see x$get.dosing(); add with add.dosing or et) #> 100 observation times (see x$get.sampling(); add with add.sampling or et) #> multiple doses in `addl` columns, expand with x$expand(); or etExpand(x) #> -- First part of x: -- #> # A tibble: 101 x 6 #> time amt rate ii addl evid #> [h] [h] #> 1 0 NA NA NA NA 0:Observation #> 2 0 10000 1250 12 2 1:Dose (Add) #> 3 0.242 NA NA NA NA 0:Observation #> 4 0.485 NA NA NA NA 0:Observation #> 5 0.727 NA NA NA NA 0:Observation #> 6 0.970 NA NA NA NA 0:Observation #> 7 1.21 NA NA NA NA 0:Observation #> 8 1.45 NA NA NA NA 0:Observation #> 9 1.70 NA NA NA NA 0:Observation #> 10 1.94 NA NA NA NA 0:Observation #> # i 91 more rows rxSolve(m1, ev) %>% plot(depot, C2) + xlab(\"Time\") rxSolve(m1, ev, c(fdepot=0.25)) %>% plot(depot, C2) + xlab(\"Time\") rxSolve(m1, ev, c(fdepot=1.25)) %>% plot(depot, C2) + xlab(\"Time\") ev <- et(timeUnits=\"hr\") %>% et(amt=10000, ii=12,until=24, dur=8) %>% et(seq(0, 24, length.out=100)) library(ggplot2) library(patchwork) p1 <- rxSolve(m1, ev, c(fdepot=1.25)) %>% plot(depot) + xlab(\"Time\") + ylim(0,5000) p2 <- rxSolve(m1, ev, c(fdepot=0.25)) %>% plot(depot) + xlab(\"Time\")+ ylim(0,5000) ## Use patchwork syntax to combine plots p1 * p2"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-types.html","id":"modeled-rate-and-duration-of-infusion","dir":"Articles","previous_headings":"Infusion Doses","what":"Modeled Rate and Duration of Infusion","title":"rxode2 Event Types","text":"can model duration, equivalent NONMEM’s rate=-2. Similarly, may also model rate. equivalent NONMEM’s rate=-1 rxode2’s event table specifies data item well.","code":"ev <- et(timeUnits=\"hr\") %>% et(amt=10000, ii=12,until=24, rate=-2) %>% et(seq(0, 24, length.out=100)) ev #> -- EventTable with 101 records -- #> 1 dosing records (see x$get.dosing(); add with add.dosing or et) #> 100 observation times (see x$get.sampling(); add with add.sampling or et) #> multiple doses in `addl` columns, expand with x$expand(); or etExpand(x) #> -- First part of x: -- #> # A tibble: 101 x 6 #> time amt rate ii addl evid #> [h] [h] #> 1 0 NA NA NA NA 0:Observation #> 2 0 10000 -2:dur 12 2 1:Dose (Add) #> 3 0.242 NA NA NA NA 0:Observation #> 4 0.485 NA NA NA NA 0:Observation #> 5 0.727 NA NA NA NA 0:Observation #> 6 0.970 NA NA NA NA 0:Observation #> 7 1.21 NA NA NA NA 0:Observation #> 8 1.45 NA NA NA NA 0:Observation #> 9 1.70 NA NA NA NA 0:Observation #> 10 1.94 NA NA NA NA 0:Observation #> # i 91 more rows rxSolve(m1, ev, c(durDepot=7)) %>% plot(depot, C2) + xlab(\"Time\") ev <- et(timeUnits=\"hr\") %>% et(amt=10000, ii=12,until=24, rate=-1) %>% et(seq(0, 24, length.out=100)) ev #> -- EventTable with 101 records -- #> 1 dosing records (see x$get.dosing(); add with add.dosing or et) #> 100 observation times (see x$get.sampling(); add with add.sampling or et) #> multiple doses in `addl` columns, expand with x$expand(); or etExpand(x) #> -- First part of x: -- #> # A tibble: 101 x 6 #> time amt rate ii addl evid #> [h] [h] #> 1 0 NA NA NA NA 0:Observation #> 2 0 10000 -1:rate 12 2 1:Dose (Add) #> 3 0.242 NA NA NA NA 0:Observation #> 4 0.485 NA NA NA NA 0:Observation #> 5 0.727 NA NA NA NA 0:Observation #> 6 0.970 NA NA NA NA 0:Observation #> 7 1.21 NA NA NA NA 0:Observation #> 8 1.45 NA NA NA NA 0:Observation #> 9 1.70 NA NA NA NA 0:Observation #> 10 1.94 NA NA NA NA 0:Observation #> # i 91 more rows rxSolve(m1, ev, c(rateDepot=10000/3)) %>% plot(depot, C2) + xlab(\"Time\")"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-types.html","id":"steady-state","dir":"Articles","previous_headings":"","what":"Steady State","title":"rxode2 Event Types","text":"doses solved steady state reached constant inter-dose interval.","code":"ev <- et(timeUnits=\"hr\") %>% et(amt=10000, ii=12, ss=1) %>% et(seq(0, 24, length.out=100)) ev #> -- EventTable with 101 records -- #> 1 dosing records (see x$get.dosing(); add with add.dosing or et) #> 100 observation times (see x$get.sampling(); add with add.sampling or et) #> -- First part of x: -- #> # A tibble: 101 x 5 #> time amt ii evid ss #> [h] [h] #> 1 0 NA NA 0:Observation NA #> 2 0 10000 12 1:Dose (Add) 1 #> 3 0.242 NA NA 0:Observation NA #> 4 0.485 NA NA 0:Observation NA #> 5 0.727 NA NA 0:Observation NA #> 6 0.970 NA NA 0:Observation NA #> 7 1.21 NA NA 0:Observation NA #> 8 1.45 NA NA 0:Observation NA #> 9 1.70 NA NA 0:Observation NA #> 10 1.94 NA NA 0:Observation NA #> # i 91 more rows rxSolve(m1, ev) %>% plot(C2)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-types.html","id":"steady-state-for-complex-dosing","dir":"Articles","previous_headings":"Steady State","what":"Steady state for complex dosing","title":"rxode2 Event Types","text":"using ss=2 flag, can use super-positioning principle linear kinetics get steady state nonstandard dosing (.e. morning 100 mg vs evening 150 mg). done : Saving state values Resetting states solving system steady state Adding back prior state values can see takes full dose cycle reach true complex steady state dosing.","code":"ev <- et(timeUnits=\"hr\") %>% et(amt=10000, ii=24, ss=1) %>% et(time=12, amt=15000, ii=24, ss=2) %>% et(time=24, amt=10000, ii=24, addl=3) %>% et(time=36, amt=15000, ii=24, addl=3) %>% et(seq(0, 64, length.out=500)) library(ggplot2) rxSolve(m1, ev,maxsteps=10000) %>% plot(C2) + annotate(\"rect\", xmin=0, xmax=24, ymin=-Inf, ymax=Inf, alpha=0.2) + annotate(\"text\", x=12.5, y=7, label=\"Initial Steady State Period\") + annotate(\"text\", x=44, y=7, label=\"Steady State AM/PM dosing\")"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-types.html","id":"steady-state-for-constant-infusion-or-zero-order-processes","dir":"Articles","previous_headings":"Steady State","what":"Steady state for constant infusion or zero order processes","title":"rxode2 Event Types","text":"last type steady state rxode2 supports steady-state constant infusion rate. can specified way NONMEM, : inter-dose interval ii=0 steady state dose, ie ss=1 Either positive rate (rate>0) estimated rate rate=-1. zero dose, ie amt=0 steady-state constant infusion achieved, infusion turned using record, just like NONMEM. Note rate=-2 model duration infusion doesn’t make much sense since solving infusion steady state. duration specified steady state solution. Also note bioavailability changes steady state infusion also make sense neither change rate duration steady state infusion. Hence modeled bioavailability type dosing event ignored. example: can used PK, can used steady-state disease processes.","code":"ev <- et(timeUnits=\"hr\") %>% et(amt=0, ss=1,rate=10000/8) p1 <- rxSolve(m1, ev) %>% plot(C2, eff) ev <- et(timeUnits=\"hr\") %>% et(amt=200000, rate=10000/8) %>% et(0, 250, length.out=1000) p2 <- rxSolve(m1, ev) %>% plot(C2, eff) library(patchwork) p1 / p2"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-types.html","id":"reset-events","dir":"Articles","previous_headings":"","what":"Reset Events","title":"rxode2 Event Types","text":"Reset events implemented evid=3 evid=reset, reset evid=4 reset dose. solving show happens system system reset 6 hours post-dose. can see compartments reset initial values. next dose start dosing cycle . case, whole system reset dose given","code":"ev <- et(timeUnits=\"hr\") %>% et(amt=10000, ii=12, addl=3) %>% et(time=6, evid=reset) %>% et(seq(0, 24, length.out=100)) ev #> -- EventTable with 102 records -- #> 2 dosing records (see x$get.dosing(); add with add.dosing or et) #> 100 observation times (see x$get.sampling(); add with add.sampling or et) #> multiple doses in `addl` columns, expand with x$expand(); or etExpand(x) #> -- First part of x: -- #> # A tibble: 102 x 5 #> time amt ii addl evid #> [h] [h] #> 1 0 NA NA NA 0:Observation #> 2 0 10000 12 3 1:Dose (Add) #> 3 0.242 NA NA NA 0:Observation #> 4 0.485 NA NA NA 0:Observation #> 5 0.727 NA NA NA 0:Observation #> 6 0.970 NA NA NA 0:Observation #> 7 1.21 NA NA NA 0:Observation #> 8 1.45 NA NA NA 0:Observation #> 9 1.70 NA NA NA 0:Observation #> 10 1.94 NA NA NA 0:Observation #> # i 92 more rows rxSolve(m1, ev) %>% plot(depot,C2, eff) ev <- et(timeUnits=\"hr\") %>% et(amt=10000, ii=12, addl=3) %>% et(time=6, amt=10000, evid=4) %>% et(seq(0, 24, length.out=100)) ev #> -- EventTable with 102 records -- #> 2 dosing records (see x$get.dosing(); add with add.dosing or et) #> 100 observation times (see x$get.sampling(); add with add.sampling or et) #> multiple doses in `addl` columns, expand with x$expand(); or etExpand(x) #> -- First part of x: -- #> # A tibble: 102 x 5 #> time amt ii addl evid #> [h] [h] #> 1 0 NA NA NA 0:Observation #> 2 0 10000 12 3 1:Dose (Add) #> 3 0.242 NA NA NA 0:Observation #> 4 0.485 NA NA NA 0:Observation #> 5 0.727 NA NA NA 0:Observation #> 6 0.970 NA NA NA 0:Observation #> 7 1.21 NA NA NA 0:Observation #> 8 1.45 NA NA NA 0:Observation #> 9 1.70 NA NA NA 0:Observation #> 10 1.94 NA NA NA 0:Observation #> # i 92 more rows rxSolve(m1, ev) %>% plot(depot,C2, eff)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-event-types.html","id":"turning-off-compartments","dir":"Articles","previous_headings":"","what":"Turning off compartments","title":"rxode2 Event Types","text":"may also turn compartment, similar reset event. Solving shows system: case, depot turned , depot compartment concentrations set initial values compartment concentrations/levels reset. another dose depot administered depot compartment turned back . Note dose compartment turns back compartment dosed. Hence turn effect compartment, continues another dose depot. turn back compartment, zero-dose compartment evid=2 compartment needed.","code":"ev <- et(timeUnits=\"hr\") %>% et(amt=10000, ii=12, addl=3) %>% et(time=6, cmt=\"-depot\", evid=2) %>% et(seq(0, 24, length.out=100)) ev #> -- EventTable with 102 records -- #> 2 dosing records (see x$get.dosing(); add with add.dosing or et) #> 100 observation times (see x$get.sampling(); add with add.sampling or et) #> multiple doses in `addl` columns, expand with x$expand(); or etExpand(x) #> -- First part of x: -- #> # A tibble: 102 x 6 #> time cmt amt ii addl evid #> [h] [h] #> 1 0 (obs) NA NA NA 0:Observation #> 2 0 (default) 10000 12 3 1:Dose (Add) #> 3 0.242 (obs) NA NA NA 0:Observation #> 4 0.485 (obs) NA NA NA 0:Observation #> 5 0.727 (obs) NA NA NA 0:Observation #> 6 0.970 (obs) NA NA NA 0:Observation #> 7 1.21 (obs) NA NA NA 0:Observation #> 8 1.45 (obs) NA NA NA 0:Observation #> 9 1.70 (obs) NA NA NA 0:Observation #> 10 1.94 (obs) NA NA NA 0:Observation #> # i 92 more rows rxSolve(m1, ev) %>% plot(depot,C2, eff) ev <- et(timeUnits=\"hr\") %>% et(amt=10000, ii=12, addl=3) %>% et(time=6, cmt=\"-eff\", evid=2) %>% et(seq(0, 24, length.out=100)) rxSolve(m1, ev) %>% plot(depot,C2, eff) ev <- et(timeUnits=\"hr\") %>% et(amt=10000, ii=12, addl=3) %>% et(time=6, cmt=\"-eff\", evid=2) %>% et(time=12,cmt=\"eff\",evid=2) %>% et(seq(0, 24, length.out=100)) rxSolve(m1, ev) %>% plot(depot,C2, eff)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-events-classic.html","id":"classic-rxode-evid-values","dir":"Articles","previous_headings":"","what":"Classic RxODE evid values","title":"Classic rxode2 Events","text":"Originally RxODE supported compound event IDs; rxode2 still supports parameters, often useful use normal NONMEM dataset standard used many modeling tools like NONMEM, Monolix nlmixr, described rxode2 types article. Classically, RxODE supported event coding single event id evid described following table. classic EVID concatenate numbers table, infusion compartment 1 10101 infusion compartment 199 119901. EVID = 0 (observations), EVID=2 (type event) EVID=3 supported. Internally EVID=9 non-observation event makes sure system initialized zero; EVID=9 manually set. EVID 10-99 represents modeled time interventions, similar NONMEM’s MTIME. along amount (amt) time columns specify events ODE system. infusions specified EVIDs > 100 amt column represents rate value. Infusion flags 1 2 +amt turn infusion specific compartment -amt turn infusion specific compartment. specify dose/duration place dosing records time duration starts stops. modeled rate/duration infusion flags infusion flag must followed infusion record. number concatenated together form full RxODE event ID, shown following examples:","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-events-classic.html","id":"bolus-dose-examples","dir":"Articles","previous_headings":"Classic RxODE evid values","what":"Bolus Dose Examples","title":"Classic rxode2 Events","text":"100 bolus dose compartment #1 time 0 100 bolus dose compartment #99 time 0 100 bolus dose compartment #199 time 0","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-events-classic.html","id":"infusion-event-examples","dir":"Articles","previous_headings":"Classic RxODE evid values","what":"Infusion Event Examples","title":"Classic rxode2 Events","text":"Bolus infusion rate 50 compartment 1 1.5 hr, (modeled bioavailability changes duration infusion) Bolus infusion rate 50 compartment 1 1.5 hr (modeled bioavailability changes rate infusion) Modeled rate amount 50 Modeled duration amount 50","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-events-classic.html","id":"steady-state-for-classic-rxode-evid-example","dir":"Articles","previous_headings":"Classic RxODE evid values","what":"Steady State for classic RxODE EVID example","title":"Classic rxode2 Events","text":"Steady state dose cmt 1 Steady State super-positioning principle 50 pm 100 dose","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-events-classic.html","id":"steady-state-with-lagged-dose-for-classic-rxode-evid","dir":"Articles","previous_headings":"Classic RxODE evid values","what":"Steady state with lagged dose for classic RxODE evid","title":"Classic rxode2 Events","text":"Steady state lagged dose bolus dose: time | evid | amt | ii | 0 | 109 | 100 | 24 | 0 | 101 | 100 | 0 | event 109 calculates trough amount steady state passed (ii-lag_time) event 101 applies next steady state dose. Steady state (=2) lagged bolus dose Steady state infusion lag time time | evid | amt | ii | 0 | 10109 | 5 | 24 | 0 | 10108 | -5 | 24 | 0 | 10101 | 5 | | 20 | 10101 | -5 | | case bolus, 10109 event calculates trough concentration ii=24, may (may ) still infusion running. infusion running 10108 event turn infusion appropriate time. infusion completed, 10108 event ignored. next 2 events 10101 represent event times (assuming bioavailability applied).","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-events-classic.html","id":"turning-off-a-compartment-with-classic-rxode-evid","dir":"Articles","previous_headings":"Classic RxODE evid values","what":"Turning off a compartment with classic RxODE EVID","title":"Classic rxode2 Events","text":"Turn first compartment time 12 Event coding rxode2 encoded single event number evid. compartments 100, coded : event 0 observation events. 100*(Compartment Number) + 1 dose captured amt 10000 + 100*(Compartment Number) + 1 infusion rate captured amt column infusion turned subtracting amt evid stop infusion. compartments greater equal 100, 100s place digits transferred 100,000th place digit. doses 99th compartment evid bolus dose 9901 evid infusion 19901. bolus dose 199th compartment evid bolus dose 109901. infusion dosing record 199th compartment 119901.","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-intro.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Introduction to rxode2","text":"rxode2 R package facilitates simulation ODE models R. designed pharmacometrics models mind, can applied generally ODE model.","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-intro.html","id":"description-of-rxode2-illustrated-through-an-example","dir":"Articles","previous_headings":"","what":"Description of rxode2 illustrated through an example","title":"Introduction to rxode2","text":"model equations can specified text string, model file R expression. differential algebraic equations permitted. Differential equations specified d/dt(var_name) =. equation can separated semicolon. load rxode2 package compile model: Model parameters may specified ini({}) model block, initial conditions can specified within model cmt(0)= X, like model eff(0) <- 1. may also specify subject variability initial conditions residual error components just like nlmixr2. allows single interface nlmixr2/rxode2 models. Also note, classic rxode2 interface still works just like past (don’t worry breaking code time). fact, can get classic rxode2 model $simulationModel ui object:","code":"library(rxode2) #> rxode2 2.0.14.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()` mod1 <- function() { ini({ # central KA=2.94E-01 CL=1.86E+01 V2=4.02E+01 # peripheral Q=1.05E+01 V3=2.97E+02 # effects Kin=1 Kout=1 EC50=200 }) model({ C2 <- centr/V2 C3 <- peri/V3 d/dt(depot) <- -KA*depot d/dt(centr) <- KA*depot - CL*C2 - Q*C2 + Q*C3 d/dt(peri) <- Q*C2 - Q*C3 eff(0) <- 1 d/dt(eff) <- Kin - Kout*(1-C2/(EC50+C2))*eff }) } mod1 <- mod1() # create the ui object (can also use `rxode2(mod1)`) mod1 summary(mod1$simulationModel)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-intro.html","id":"specify-dosing-and-sampling-in-rxode2","dir":"Articles","previous_headings":"Description of rxode2 illustrated through an example","what":"Specify Dosing and sampling in rxode2","title":"Introduction to rxode2","text":"rxode2 provides simple flexible way specify dosing sampling functions generate event table. First, empty event table generated “et()” function. interface similar NONMEM event tables: can see code, can dose compartment named rxode2 model. slight deviation NONMEM can reduce need compartment renumbering. events can also combined expanded (multi-subject events complex regimens) rbind, c, seq, rep. information creating complex dosing regimens using rxode2 see rxode2 events vignette.","code":"ev <- et(amountUnits=\"mg\", timeUnits=\"hours\") %>% et(amt=10000, addl=9,ii=12,cmt=\"depot\") %>% et(time=120, amt=2000, addl=4, ii=14, cmt=\"depot\") %>% et(0:240) # Add sampling"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-intro.html","id":"solving-odes","dir":"Articles","previous_headings":"Description of rxode2 illustrated through an example","what":"Solving ODEs","title":"Introduction to rxode2","text":"ODE can now solved using rxSolve: returns modified data frame. can see compartment values plot : , Note labels automatically labeled units initial event table. rxode2 extracts units label plot (present).","code":"x <- mod1 %>% rxSolve(ev) #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ x #> ── Solved rxode2 object ── #> ── Parameters (x$params): ── #> KA CL V2 Q V3 Kin Kout EC50 #> 0.294 18.600 40.200 10.500 297.000 1.000 1.000 200.000 #> ── Initial Conditions (x$inits): ── #> depot centr peri eff #> 0 0 0 1 #> ── First part of data (object): ── #> # A tibble: 241 × 7 #> time C2 C3 depot centr peri eff #> [h] #> 1 0 0 0 10000 0 0 1 #> 2 1 44.4 0.920 7453. 1784. 273. 1.08 #> 3 2 54.9 2.67 5554. 2206. 794. 1.18 #> 4 3 51.9 4.46 4140. 2087. 1324. 1.23 #> 5 4 44.5 5.98 3085. 1789. 1776. 1.23 #> 6 5 36.5 7.18 2299. 1467. 2132. 1.21 #> # ℹ 235 more rows library(ggplot2) plot(x,C2) + ylab(\"Central Concentration\") plot(x,eff) + ylab(\"Effect\")"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-model-types.html","id":"prediction-only-models","dir":"Articles","previous_headings":"","what":"Prediction only models","title":"rxode2 additional model types","text":"Prediction models simple create. use rxode2 syntax without ODE systems . simple example one-compartment model. Solving rxode2 models saving simple ODE system, faster course.","code":"library(rxode2) ## rxode2 2.0.14.9000 using 2 threads (see ?getRxThreads) ## no cache: create with `rxCreateCache()` mod <- function(){ model({ ipre <- 10 * exp(-ke * t) }) } et <- et(seq(0,24,length.out=50)) cmt1 <- rxSolve(mod,et,params=c(ke=0.5)) ## using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ cmt1 ## -- Solved rxode2 object -- ## -- Parameters (x$params): -- ## ke ## 0.5 ## -- Initial Conditions (x$inits): -- ## named numeric(0) ## -- First part of data (object): -- ## # A tibble: 50 x 2 ## time ipre ## ## 1 0 10 ## 2 0.490 7.83 ## 3 0.980 6.13 ## 4 1.47 4.80 ## 5 1.96 3.75 ## 6 2.45 2.94 ## # i 44 more rows"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-model-types.html","id":"solved-compartment-models","dir":"Articles","previous_headings":"","what":"Solved compartment models","title":"rxode2 additional model types","text":"Solved models also simple create. simply place linCmt() psuedo-function code. linCmt() function figures type model use based parameter names specified. often, pharmacometric models parameterized terms volume clearances. Clearances specified NONMEM-style names CL, Q, Q1, Q2, etc. distributional clearances CLD, CLD2. Volumes specified Central (VC V), Peripheral/Tissue (VP, VT). translations available, example translations : Another popular parameterization terms micro-constants. rxode2 assumes compartment 1 central compartment. elimination constant specified K, Ke Kel. example translations : last parameterization possible using alpha V //B/C. example translations : linCmt() sleuthing complete, 1, 2 3 compartment model solution used value linCmt(). compartments can dose linear solved system depot central linear absorption constant model ka. Without additional ODEs, compartments numbered depot=1 central=2. absorption constant ka missing, may dose central compartment. Without additional ODEs compartment number central=1. compartments take sort events ODE model can take, discussed rxode2 events vignette. acts ODE model; specify dose depot compartment solve system:","code":"mod <- function() { ini({ kel <- 0.5 V <- 1 }) model({ ipre <- linCmt(V, kel) }) } et <- et(amt=10,time=0,cmt=depot) %>% et(seq(0,24,length.out=50)) cmt1 <- rxSolve(mod,et) ## using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ cmt1 ## -- Solved rxode2 object -- ## -- Parameters (x$params): -- ## kel V ## 0.5 1.0 ## -- Initial Conditions (x$inits): -- ## named numeric(0) ## -- First part of data (object): -- ## # A tibble: 50 x 2 ## time ipre ## ## 1 0 10 ## 2 0.490 7.83 ## 3 0.980 6.13 ## 4 1.47 4.80 ## 5 1.96 3.75 ## 6 2.45 2.94 ## # i 44 more rows"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-model-types.html","id":"mixing-solved-systems-and-odes","dir":"Articles","previous_headings":"","what":"Mixing Solved Systems and ODEs","title":"rxode2 additional model types","text":"addition pure ODEs, may mix solved systems ODEs. prior 2-compartment indirect response model can simplified linCmt() function: allows indirect response model assign 2-compartment model C2 variable used indirect response model. mixing solved systems ODEs, solved system’s compartment always last compartment. solved system technically isn’t compartment solved. Adding dosing compartment end interfere actual ODE solved. Therefore,two-compartment indirect response model, effect compartment compartment #1 PK dosing compartment depot compartment #2. compartment model requires new event table since compartment number changed: can solved following command: Note solving require specifying effect compartment initial condition 1. Rather, already pre-specified eff(0)=1. can solved different initial conditions easily: rxode2 detective also require specify variables linCmt() function already defined block. Therefore, following function also work solve system. Note specify parameters solving system since built model, can override parameters:","code":"library(rxode2) ## Setup example model mod1 <-function() { model({ C2 = centr/V2 C3 = peri/V3 d/dt(depot) =-KA*depot d/dt(centr) = KA*depot - CL*C2 - Q*C2 + Q*C3 d/dt(peri) = Q*C2 - Q*C3 d/dt(eff) = Kin - Kout*(1-C2/(EC50+C2))*eff }) } ## Seup parameters and initial conditions theta <- c(KA=2.94E-01, CL=1.86E+01, V2=4.02E+01, # central Q=1.05E+01, V3=2.97E+02, # peripheral Kin=1, Kout=1, EC50=200) # effects inits <- c(eff=1) ## Setup dosing event information ev <- et(amountUnits=\"mg\", timeUnits=\"hours\") %>% et(amt=10000, addl=9, ii=12) %>% et(amt=20000, addl=4, time=120, ii=24) %>% add.sampling(0:240) ## Setup a mixed solved/ode system: mod2 <- function() { model({ ## the order of variables do not matter, the type of compartmental ## model is determined by the parameters specified. C2 = linCmt(KA, CL, V2, Q, V3); eff(0) = 1 ## This specifies that the effect compartment starts at 1. d/dt(eff) = Kin - Kout*(1-C2/(EC50+C2))*eff; }) } ev <- et(amountUnits='mg', timeUnits='hours') %>% et(amt=10000, addl=9, ii=12, cmt=2) %>% et(amt=20000, addl=4, time=120, ii=24, cmt=2) %>% et(0:240) x <- mod2 %>% solve(theta, ev) ## using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ print(x) ## -- Solved rxode2 object -- ## -- Parameters ($params): -- ## KA CL V2 Q V3 Kin Kout EC50 ## 0.294 18.600 40.200 10.500 297.000 1.000 1.000 200.000 ## -- Initial Conditions ($inits): -- ## eff ## 1 ## -- First part of data (object): -- ## # A tibble: 241 x 3 ## time C2 eff ## [h] ## 1 0 249. 1 ## 2 1 121. 1.35 ## 3 2 60.3 1.38 ## 4 3 31.0 1.28 ## 5 4 17.0 1.18 ## 6 5 10.2 1.11 ## # i 235 more rows x <- mod2 %>% solve(theta, ev,c(eff=2)) print(x) ## -- Solved rxode2 object -- ## -- Parameters ($params): -- ## KA CL V2 Q V3 Kin Kout EC50 ## 0.294 18.600 40.200 10.500 297.000 1.000 1.000 200.000 ## -- Initial Conditions ($inits): -- ## eff ## 2 ## -- First part of data (object): -- ## # A tibble: 241 x 3 ## time C2 eff ## [h] ## 1 0 249. 2 ## 2 1 121. 1.93 ## 3 2 60.3 1.67 ## 4 3 31.0 1.41 ## 5 4 17.0 1.23 ## 6 5 10.2 1.13 ## # i 235 more rows mod3 <- function() { ini({ KA <- 2.94E-01 CL <- 1.86E+01 V2 <- 4.02E+01 Q <- 1.05E+01 V3 <- 2.97E+02 Kin <- 1 Kout <- 1 EC50 <- 200 }) model({ # Since the parameters are in the ini block, put them in linCmt so # that the model is detected correctly C2 <- linCmt(KA, CL, V2, Q, V3) eff(0) <- 1 ## This specifies that the effect compartment starts at 1. d/dt(eff) <- Kin - Kout*(1-C2/(EC50+C2))*eff; }) } x <- mod3 %>% solve(ev) print(x) ## -- Solved rxode2 object -- ## -- Parameters ($params): -- ## KA CL V2 Q V3 Kin Kout EC50 ## 0.294 18.600 40.200 10.500 297.000 1.000 1.000 200.000 ## -- Initial Conditions ($inits): -- ## eff ## 1 ## -- First part of data (object): -- ## # A tibble: 241 x 3 ## time C2 eff ## [h] ## 1 0 249. 1 ## 2 1 121. 1.35 ## 3 2 60.3 1.38 ## 4 3 31.0 1.28 ## 5 4 17.0 1.18 ## 6 5 10.2 1.11 ## # i 235 more rows x <- mod3 %>% solve(c(KA=10),ev) print(x) ## -- Solved rxode2 object -- ## -- Parameters ($params): -- ## KA CL V2 Q V3 Kin Kout EC50 ## 10.0 18.6 40.2 10.5 297.0 1.0 1.0 200.0 ## -- Initial Conditions ($inits): -- ## eff ## 1 ## -- First part of data (object): -- ## # A tibble: 241 x 3 ## time C2 eff ## [h] ## 1 0 249. 1 ## 2 1 121. 1.35 ## 3 2 60.3 1.38 ## 4 3 31.0 1.28 ## 5 4 17.0 1.18 ## 6 5 10.2 1.11 ## # i 235 more rows"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-nesting.html","id":"nesting-in-rxode2","dir":"Articles","previous_headings":"","what":"Nesting in rxode2","title":"Nesting levels in rxode2","text":"one level nesting possible rxode2; example using following uncertainties sources variability:","code":""},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-nesting.html","id":"event-table","dir":"Articles","previous_headings":"Nesting in rxode2","what":"Event table","title":"Nesting levels in rxode2","text":"event table contains nesting variables: inv: investigator id id: subject id eye: eye id (left right) occ: occasion","code":"library(rxode2) #> rxode2 2.0.14.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()` library(dplyr) #> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union et(amountUnits=\"mg\", timeUnits=\"hours\") %>% et(amt=10000, addl=9,ii=12,cmt=\"depot\") %>% et(time=120, amt=2000, addl=4, ii=14, cmt=\"depot\") %>% et(seq(0, 240, by=4)) %>% # Assumes sampling when there is no dosing information et(seq(0, 240, by=4) + 0.1) %>% ## adds 0.1 for separate eye et(id=1:20) %>% ## Add an occasion per dose mutate(occ=cumsum(!is.na(amt))) %>% mutate(occ=ifelse(occ == 0, 1, occ)) %>% mutate(occ=2- occ %% 2) %>% mutate(eye=ifelse(round(time) == time, 1, 2)) %>% mutate(inv=ifelse(id < 10, 1, 2)) %>% as_tibble -> ev"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-nesting.html","id":"rxode2-model","dir":"Articles","previous_headings":"Nesting in rxode2","what":"rxode2 model","title":"Nesting levels in rxode2","text":"creates rxode2 model multi-level nesting. Note variables inv.Cl, inv.Ka, eta.Cl etc; need one variable level nesting.","code":"mod <- rxode2({ ## Clearance with individuals eff(0) = 1 C2 = centr/V2*(1+prop.sd) C3 = peri/V3 CL = TCl*exp(eta.Cl + eye.Cl + iov.Cl + inv.Cl) KA = TKA * exp(eta.Ka + eye.Ka + iov.Cl + inv.Ka) d/dt(depot) =-KA*depot d/dt(centr) = KA*depot - CL*C2 - Q*C2 + Q*C3 d/dt(peri) = Q*C2 - Q*C3 d/dt(eff) = Kin - Kout*(1-C2/(EC50+C2))*eff ef0 = eff + add.sd }) #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-nesting.html","id":"uncertainty-in-model-parameters","dir":"Articles","previous_headings":"Nesting in rxode2","what":"Uncertainty in Model parameters","title":"Nesting levels in rxode2","text":"","code":"theta <- c(\"TKA\"=0.294, \"TCl\"=18.6, \"V2\"=40.2, \"Q\"=10.5, \"V3\"=297, \"Kin\"=1, \"Kout\"=1, \"EC50\"=200) ## Creating covariance matrix tmp <- matrix(rnorm(8^2), 8, 8) tMat <- tcrossprod(tmp, tmp) / (8 ^ 2) dimnames(tMat) <- list(names(theta), names(theta)) tMat #> TKA TCl V2 Q V3 #> TKA 0.091283564 -0.068572309 -0.021058603 0.051974567 0.035090728 #> TCl -0.068572309 0.159500450 0.021955940 -0.033815812 0.019583567 #> V2 -0.021058603 0.021955940 0.038136753 -0.015179898 0.017702364 #> Q 0.051974567 -0.033815812 -0.015179898 0.179281300 0.084678596 #> V3 0.035090728 0.019583567 0.017702364 0.084678596 0.094222614 #> Kin -0.021023944 0.046353050 0.004554589 -0.052996743 -0.044415064 #> Kout -0.007146270 -0.001840578 0.012059396 -0.006507225 -0.004639813 #> EC50 0.001406257 -0.055571475 0.003785865 0.032559017 -0.019434394 #> Kin Kout EC50 #> TKA -0.021023944 -0.007146270 0.001406257 #> TCl 0.046353050 -0.001840578 -0.055571475 #> V2 0.004554589 0.012059396 0.003785865 #> Q -0.052996743 -0.006507225 0.032559017 #> V3 -0.044415064 -0.004639813 -0.019434394 #> Kin 0.097337411 -0.010167878 -0.001557061 #> Kout -0.010167878 0.027566158 0.019229527 #> EC50 -0.001557061 0.019229527 0.064498809"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-nesting.html","id":"nesting-variability","dir":"Articles","previous_headings":"Nesting in rxode2","what":"Nesting Variability","title":"Nesting levels in rxode2","text":"specify multiple levels nesting, can specify nested lotri matrix; using approach use condition operator | specify variable nesting occurs ; Bayesian simulation need specify much information parameter; rxode2 nu parameter. case: - id, nu=100 model came 100 subjects - eye, nu=200 model came 200 eyes - occ, nu=200 model came 200 occasions - inv, nu=10 model came 10 investigators specify lotri can use | var(nu=X), :","code":"omega <- lotri(lotri(eta.Cl ~ 0.1, eta.Ka ~ 0.1) | id(nu=100), lotri(eye.Cl ~ 0.05, eye.Ka ~ 0.05) | eye(nu=200), lotri(iov.Cl ~ 0.01, iov.Ka ~ 0.01) | occ(nu=200), lotri(inv.Cl ~ 0.02, inv.Ka ~ 0.02) | inv(nu=10)) omega #> $id #> eta.Cl eta.Ka #> eta.Cl 0.1 0.0 #> eta.Ka 0.0 0.1 #> #> $eye #> eye.Cl eye.Ka #> eye.Cl 0.05 0.00 #> eye.Ka 0.00 0.05 #> #> $occ #> iov.Cl iov.Ka #> iov.Cl 0.01 0.00 #> iov.Ka 0.00 0.01 #> #> $inv #> inv.Cl inv.Ka #> inv.Cl 0.02 0.00 #> inv.Ka 0.00 0.02 #> #> Properties: nu"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-nesting.html","id":"unexplained-variability","dir":"Articles","previous_headings":"Nesting in rxode2","what":"Unexplained variability","title":"Nesting levels in rxode2","text":"last piece variability specify unexplained variability","code":"sigma <- lotri(prop.sd ~ .25, add.sd~ 0.125)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-nesting.html","id":"solving-the-problem","dir":"Articles","previous_headings":"Nesting in rxode2","what":"Solving the problem","title":"Nesting levels in rxode2","text":"multiple investigators study; investigator number individuals enrolled site. rxode2 automatically determines number investigators simulate effect investigator. output, inv.Cl(inv==1) inv.Cl investigator 1, inv.Cl(inv==2) inv.Cl investigator 2, etc. inv.Cl(inv==1), inv.Cl(inv==2), etc simulated study combined form investigator variability. equation form represent following: look simulated parameters can see inv.Cl(inv==1) inv.Cl(inv==2) s$params; study: eye variability occasion variability individual simulates number variables become eye occasion variability; case eye: look simulation variables (ie eye.Cl(eye==1), eye.Cl(eye==2), etc) change individual combined make eye variability occasion variability can seen pharamcometric models.","code":"s <- rxSolve(mod, theta, ev, thetaMat=tMat, omega=omega, sigma=sigma, sigmaDf=400, nStud=400) #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> unhandled error message: EE:[lsoda] 70000 steps taken before reaching tout #> @(lsoda.c:750 #> Warning: some ID(s) could not solve the ODEs correctly; These values are #> replaced with 'NA' print(s) #> -- Solved rxode2 object -- #> -- Parameters ($params): -- #> # A tibble: 8,000 x 24 #> sim.id id `inv.Cl(inv==1)` `inv.Cl(inv==2)` `inv.Ka(inv==1)` #> #> 1 1 1 -0.148 -0.132 -0.000571 #> 2 1 2 -0.148 -0.132 -0.000571 #> 3 1 3 -0.148 -0.132 -0.000571 #> 4 1 4 -0.148 -0.132 -0.000571 #> 5 1 5 -0.148 -0.132 -0.000571 #> 6 1 6 -0.148 -0.132 -0.000571 #> 7 1 7 -0.148 -0.132 -0.000571 #> 8 1 8 -0.148 -0.132 -0.000571 #> 9 1 9 -0.148 -0.132 -0.000571 #> 10 1 10 -0.148 -0.132 -0.000571 #> # i 7,990 more rows #> # i 19 more variables: `inv.Ka(inv==2)` , `eye.Cl(eye==1)` , #> # `eye.Cl(eye==2)` , `eye.Ka(eye==1)` , `eye.Ka(eye==2)` , #> # `iov.Cl(occ==1)` , `iov.Cl(occ==2)` , `iov.Ka(occ==1)` , #> # `iov.Ka(occ==2)` , V2 , V3 , TCl , eta.Cl , #> # TKA , eta.Ka , Q , Kin , Kout , EC50 #> -- Initial Conditions ($inits): -- #> depot centr peri eff #> 0 0 0 1 #> #> Simulation with uncertainty in: #> * parameters ($thetaMat for changes) #> * omega matrix ($omegaList) #> #> -- First part of data (object): -- #> # A tibble: 976,000 x 21 #> sim.id id time inv.Cl inv.Ka eye.Cl eye.Ka iov.Cl iov.Ka C2 C3 #> [h] #> 1 1 1 0 -0.148 -0.000571 0.702 -0.915 0.0816 0.0896 0 0 #> 2 1 1 0.1 -0.148 -0.000571 -0.277 -0.0671 0.0816 0.0896 1.25 0.00269 #> 3 1 1 4 -0.148 -0.000571 0.702 -0.915 0.0816 0.0896 39.4 3.93 #> 4 1 1 4.1 -0.148 -0.000571 -0.277 -0.0671 0.0816 0.0896 49.6 4.04 #> 5 1 1 8 -0.148 -0.000571 0.702 -0.915 0.0816 0.0896 36.3 7.33 #> 6 1 1 8.1 -0.148 -0.000571 -0.277 -0.0671 0.0816 0.0896 23.3 7.39 #> # i 975,994 more rows #> # i 10 more variables: CL , KA , ef0 , depot , centr , #> # peri , eff , occ , eye , inv inv.Cl = (inv == 1) * `inv.Cl(inv==1)` + (inv == 2) * `inv.Cl(inv==2)` print(head(s$params)) #> sim.id id inv.Cl(inv==1) inv.Cl(inv==2) inv.Ka(inv==1) inv.Ka(inv==2) #> 1 1 1 -0.1480315 -0.1323712 -0.0005714332 0.08559259 #> 2 1 2 -0.1480315 -0.1323712 -0.0005714332 0.08559259 #> 3 1 3 -0.1480315 -0.1323712 -0.0005714332 0.08559259 #> 4 1 4 -0.1480315 -0.1323712 -0.0005714332 0.08559259 #> 5 1 5 -0.1480315 -0.1323712 -0.0005714332 0.08559259 #> 6 1 6 -0.1480315 -0.1323712 -0.0005714332 0.08559259 #> eye.Cl(eye==1) eye.Cl(eye==2) eye.Ka(eye==1) eye.Ka(eye==2) iov.Cl(occ==1) #> 1 0.70186234 -0.27732005 -0.915347545 -0.06709872 0.08164632 #> 2 0.12461103 -0.22840762 -0.183417034 -0.05335536 0.02906715 #> 3 -0.11718627 0.08188798 0.009429659 0.15021773 0.24113638 #> 4 0.06090385 -0.32973251 0.139530066 -0.18749762 0.03151548 #> 5 0.10903320 0.02315588 -0.279554496 -0.35864036 0.01036085 #> 6 -0.27158388 -0.15547165 -0.153497112 -0.06469808 0.04908725 #> iov.Cl(occ==2) iov.Ka(occ==1) iov.Ka(occ==2) V2 V3 TCl #> 1 0.294447042 0.089582665 0.13833348 40.31123 296.704 18.12202 #> 2 -0.018486651 0.004075217 0.10875214 40.31123 296.704 18.12202 #> 3 0.127857862 -0.060962525 -0.09452202 40.31123 296.704 18.12202 #> 4 -0.203070657 0.025916649 0.37173955 40.31123 296.704 18.12202 #> 5 -0.006504903 -0.043367120 -0.12604635 40.31123 296.704 18.12202 #> 6 0.051101039 -0.097513628 -0.11446093 40.31123 296.704 18.12202 #> eta.Cl TKA eta.Ka Q Kin Kout EC50 #> 1 0.18588661 0.1850192 -0.201815537 10.26808 0.7761331 1.285074 200.3064 #> 2 0.24056866 0.1850192 -0.003196246 10.26808 0.7761331 1.285074 200.3064 #> 3 0.13228555 0.1850192 -0.629686258 10.26808 0.7761331 1.285074 200.3064 #> 4 -0.38391078 0.1850192 0.560212037 10.26808 0.7761331 1.285074 200.3064 #> 5 0.14257398 0.1850192 -0.150690952 10.26808 0.7761331 1.285074 200.3064 #> 6 0.09652758 0.1850192 -0.549121466 10.26808 0.7761331 1.285074 200.3064 print(head(s$params %>% filter(sim.id == 2))) #> sim.id id inv.Cl(inv==1) inv.Cl(inv==2) inv.Ka(inv==1) inv.Ka(inv==2) #> 1 2 1 0.001613993 -0.1655022 0.1074734 0.02238288 #> 2 2 2 0.001613993 -0.1655022 0.1074734 0.02238288 #> 3 2 3 0.001613993 -0.1655022 0.1074734 0.02238288 #> 4 2 4 0.001613993 -0.1655022 0.1074734 0.02238288 #> 5 2 5 0.001613993 -0.1655022 0.1074734 0.02238288 #> 6 2 6 0.001613993 -0.1655022 0.1074734 0.02238288 #> eye.Cl(eye==1) eye.Cl(eye==2) eye.Ka(eye==1) eye.Ka(eye==2) iov.Cl(occ==1) #> 1 -0.06492477 0.2103290 -0.258234272 -0.65555476 0.05581626 #> 2 0.29221373 0.1291948 -0.001047067 -0.06049668 0.18612125 #> 3 0.18355366 0.2809128 -0.006091777 -0.07121414 -0.07860149 #> 4 0.51729297 -0.2746913 0.296216014 0.19018619 -0.01220883 #> 5 0.09854127 0.1244885 0.051972718 0.02492854 -0.05869592 #> 6 -0.21757059 0.1180519 0.265363855 -0.02517008 0.21103990 #> iov.Cl(occ==2) iov.Ka(occ==1) iov.Ka(occ==2) V2 V3 TCl #> 1 0.08770510 -0.1213494181 -0.07194749 40.40494 296.9874 18.59039 #> 2 -0.06866621 -0.0034025289 0.03800002 40.40494 296.9874 18.59039 #> 3 -0.12655918 -0.0784557848 0.12632977 40.40494 296.9874 18.59039 #> 4 -0.03565934 -0.0007239254 -0.16161576 40.40494 296.9874 18.59039 #> 5 0.02553487 0.1917256083 -0.31148491 40.40494 296.9874 18.59039 #> 6 0.01985213 -0.0201123515 -0.16279535 40.40494 296.9874 18.59039 #> eta.Cl TKA eta.Ka Q Kin Kout EC50 #> 1 -0.30400507 0.1844716 0.11056784 10.33659 1.137549 0.9891969 200.0611 #> 2 0.49634073 0.1844716 -0.05259496 10.33659 1.137549 0.9891969 200.0611 #> 3 -0.07096015 0.1844716 -0.10609177 10.33659 1.137549 0.9891969 200.0611 #> 4 0.08067657 0.1844716 0.25228398 10.33659 1.137549 0.9891969 200.0611 #> 5 0.24616432 0.1844716 0.01271617 10.33659 1.137549 0.9891969 200.0611 #> 6 -0.05820859 0.1844716 0.33222285 10.33659 1.137549 0.9891969 200.0611 eye.Cl = (eye == 1) * `eye.Cl(eye==1)` + (eye == 2) * `eye.Cl(eye==2)`"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-pipeline.html","id":"setting-up-the-rxode2-model-for-the-pipeline","dir":"Articles","previous_headings":"","what":"Setting up the rxode2 model for the pipeline","title":"rxode2 in a pipeline","text":"example show use rxode2 simple pipeline. can start model can used different simulation workflows rxode2 can handle: tumor growth model described Ribba 2012. case, compiled model R object Ribba2012, though rxode2 simulation pipeline, assign compiled model object, though think makes sense.","code":"library(rxode2) #> rxode2 2.0.14.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()` Ribba2012 <- function() { ini({ k = 100 tkde = 0.24 eta.tkde = 0 tkpq = 0.0295 eta.kpq = 0 tkqpp = 0.0031 eta.kqpp = 0 tlambdap = 0.121 eta.lambdap = 0 tgamma = 0.729 eta.gamma = 0 tdeltaqp = 0.00867 eta.deltaqp = 0 prop.sd <- 0 tpt0 = 7.13 eta.pt0 = 0 tq0 = 41.2 eta.q0 = 0 }) model({ kde ~ tkde*exp(eta.tkde) kpq ~ tkpq * exp(eta.kpq) kqpp ~ tkqpp * exp(eta.kqpp) lambdap ~ tlambdap*exp(eta.lambdap) gamma ~ tgamma*exp(eta.gamma) deltaqp ~ tdeltaqp*exp(eta.deltaqp) d/dt(c) = -kde * c d/dt(pt) = lambdap * pt *(1-pstar/k) + kqpp*qp - kpq*pt - gamma*c*kde*pt d/dt(q) = kpq*pt -gamma*c*kde*q d/dt(qp) = gamma*c*kde*q - kqpp*qp - deltaqp*qp ## initial conditions pt0 ~ tpt0*exp(eta.pt0) q0 ~ tq0*exp(eta.q0) pt(0) = pt0 q(0) = q0 pstar <- (pt+q+qp) pstar ~ prop(prop.sd) }) }"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-pipeline.html","id":"simulating-one-event-table","dir":"Articles","previous_headings":"","what":"Simulating one event table","title":"rxode2 in a pipeline","text":"Simulating single event table quite simple: pipe rxode2 simulation object event table object et(). events completely specified, simply solve ODE system rxSolve(). case can pipe output plot() conveniently view results. pt (Proliferative Tissue), q (quiescent tissue) qp (DNA-Damaged quiescent tissue) pstar (total tumor tissue)","code":"Ribba2012 %>% # Use rxode2 et(time.units=\"months\") %>% # Pipe to a new event table et(amt=1, time=50, until=58, ii=1.5) %>% # Add dosing every 1.5 months et(0, 250, by=0.5) %>% # Add some sampling times (not required) rxSolve() %>% # Solve the simulation plot(pt, q, qp, pstar) # Plot it, plotting the variables of interest #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’"},{"path":[]},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-pipeline.html","id":"simulating-with-between-subject-variability","dir":"Articles","previous_headings":"Simulating multiple subjects from a single event table","what":"Simulating with between subject variability","title":"rxode2 in a pipeline","text":"next sort simulation may useful simulating multiple patients treatments. case, use omega matrix specified paper: information, easy simulate 3 subjects model-based parameters: Note two different things added simulation: - nSub specify many subjects model - omega specify subject variability.","code":"## Add CVs from paper for individual simulation ## Uses exact formula: lognCv = function(x){log((x/100)^2+1)} library(lotri) ## Now create omega matrix ## I'm using lotri to quickly specify names/diagonals omega <- lotri(eta.pt0 ~ lognCv(94), eta.q0 ~ lognCv(54), eta.lambdap ~ lognCv(72), eta.kqp ~ lognCv(76), eta.kqpp ~ lognCv(97), eta.deltaqp ~ lognCv(115), eta.tkde ~ lognCv(70)) omega #> eta.pt0 eta.q0 eta.lambdap eta.kqp eta.kqpp eta.deltaqp #> eta.pt0 0.6331848 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> eta.q0 0.0000000 0.2558818 0.0000000 0.0000000 0.0000000 0.0000000 #> eta.lambdap 0.0000000 0.0000000 0.4176571 0.0000000 0.0000000 0.0000000 #> eta.kqp 0.0000000 0.0000000 0.0000000 0.4559047 0.0000000 0.0000000 #> eta.kqpp 0.0000000 0.0000000 0.0000000 0.0000000 0.6631518 0.0000000 #> eta.deltaqp 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.8426442 #> eta.tkde 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 #> eta.tkde #> eta.pt0 0.0000000 #> eta.q0 0.0000000 #> eta.lambdap 0.0000000 #> eta.kqp 0.0000000 #> eta.kqpp 0.0000000 #> eta.deltaqp 0.0000000 #> eta.tkde 0.3987761 set.seed(1089) rxSetSeed(1089) Ribba2012 %>% # Use rxode2 et(time.units=\"months\") %>% # Pipe to a new event table et(amt=1, time=50, until=58, ii=1.5) %>% # Add dosing every 1.5 months et(0, 250, by=0.5) %>% # Add some sampling times (not required) rxSolve(nSub=3, omega=omega) %>% # Solve the simulation plot(pt, q, qp, pstar) # Plot it, plotting the variables of interest #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ℹ omega has too many items, ignored: 'eta.kqp'"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-pipeline.html","id":"simulation-with-unexplained-variability","dir":"Articles","previous_headings":"Simulating multiple subjects from a single event table","what":"Simulation with unexplained variability","title":"rxode2 in a pipeline","text":"can even add unexplained variability quite easily: case added sigma matrix unexplained variability pstar total tumor tissue. can even simulate uncertainty theta omega sigma values wish.","code":"Ribba2012 %>% # Use rxode2 ini(prop.sd=0.05) %>% # change variability et(time.units=\"months\") %>% # Pipe to a new event table et(amt=1, time=50, until=58, ii=1.5) %>% # Add dosing every 1.5 months et(0, 250, by=0.5) %>% # Add some sampling times (not required) rxSolve(nSub=3, omega=omega) %>% plot(pt, q, qp, sim) # Plot it, plotting the variables of interest #> ℹ change initial estimate of `prop.sd` to `0.05` #> ℹ omega has too many items, ignored: 'eta.kqp' # note that sim is the simulated pstar since this is simulated from the # model with a nlmixr2 endpoint"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-pipeline.html","id":"simulation-with-uncertainty-in-all-the-parameters-by-matrices","dir":"Articles","previous_headings":"Simulating multiple subjects from a single event table","what":"Simulation with uncertainty in all the parameters (by matrices)","title":"rxode2 in a pipeline","text":"assume parameters came 95 subjects 8 observations apiece, degrees freedom omega matrix 95, degrees freedom sigma matrix 95*8=760 95 items informed omega matrix, 760 items informed sigma matrix. Often simulations full covariance matrix fixed effect parameters. case, matrix, specified thetaMat. full covariance matrix, can information diagonal elements covariance matrix model paper. can converted follows: Now thetaMat represent uncertainty theta matrix, well pieces simulation. Typically can put information simulation thetaMat matrix. large variability theta easy sample negative rate constant, make sense. example: correct problems simply need use truncated multivariate normal specify reasonable ranges parameters. theta specified thetaLower thetaUpper. Similar parameters matrices: omegaLower, omegaUpper, sigmaLower sigmaUpper. may named vectors, one numeric value, numeric vector matching number parameters specified thetaMat matrix. case simulation simply modified thetaLower=0 make sure rates positive:","code":"Ribba2012 %>% # Use rxode2 ini(prop.sd = 0.05) %>% et(time.units=\"months\") %>% # Pipe to a new event table et(amt=1, time=50, until=58, ii=1.5) %>% # Add dosing every 1.5 months et(0, 250, by=0.5) %>% # Add some sampling times (not required) rxSolve(nSub=3, nStud=3, omega=omega, dfSub=760, dfObs=95) %>% # Solve the simulation plot(pt, q, qp, sim) # Plot it, plotting the variables of interest #> ℹ change initial estimate of `prop.sd` to `0.05` #> ℹ omega has too many items, ignored: 'eta.kqp' rseVar <- function(est, rse){ return(est*rse/100)^2 } thetaMat <- lotri(tpt0 ~ rseVar(7.13,25), tq0 ~ rseVar(41.2,7), tlambdap ~ rseVar(0.121, 16), tkqpp ~ rseVar(0.0031, 35), tdeltaqp ~ rseVar(0.00867, 21), tgamma ~ rseVar(0.729, 37), tkde ~ rseVar(0.24, 33) ) thetaMat #> tpt0 tq0 tlambdap tkqpp tdeltaqp tgamma tkde #> tpt0 1.7825 0.000 0.00000 0.000000 0.0000000 0.00000 0.0000 #> tq0 0.0000 2.884 0.00000 0.000000 0.0000000 0.00000 0.0000 #> tlambdap 0.0000 0.000 0.01936 0.000000 0.0000000 0.00000 0.0000 #> tkqpp 0.0000 0.000 0.00000 0.001085 0.0000000 0.00000 0.0000 #> tdeltaqp 0.0000 0.000 0.00000 0.000000 0.0018207 0.00000 0.0000 #> tgamma 0.0000 0.000 0.00000 0.000000 0.0000000 0.26973 0.0000 #> tkde 0.0000 0.000 0.00000 0.000000 0.0000000 0.00000 0.0792 Ribba2012 %>% # Use rxode2 ini(prop.sd = 0.05) %>% et(time.units=\"months\") %>% # Pipe to a new event table et(amt=1, time=50, until=58, ii=1.5) %>% # Add dosing every 1.5 months et(0, 250, by=0.5) %>% # Add some sampling times (not required) rxSolve(nSub=2, nStud=2, omega=omega, thetaMat=thetaMat, dfSub=760, dfObs=95) %>% # Solve the simulation plot(pt, q, qp, pstar) # Plot it, plotting the variables of interest #> ℹ change initial estimate of `prop.sd` to `0.05` #> unhandled error message: EE:[lsoda] 70000 steps taken before reaching tout #> @(lsoda.c:750 #> Warning message: #> In rxSolve_(object, .ctl, .nms, .xtra, params, events, inits, setupOnly = .setupOnly) : #> Some ID(s) could not solve the ODEs correctly; These values are replaced with NA. Ribba2012 %>% # Use rxode2 ini(prop.sd = 0.05) %>% et(time.units=\"months\") %>% # Pipe to a new event table et(amt=1, time=50, until=58, ii=1.5) %>% # Add dosing every 1.5 months et(0, 250, by=0.5) %>% # Add some sampling times (not required) rxSolve(nSub=2, nStud=2, omega=omega, thetaMat=thetaMat, thetaLower=0, # Make sure the rates are reasonable dfSub=760, dfObs=95) %>% # Solve the simulation plot(pt, q, qp, sim) # Plot it, plotting the variables of interest #> ℹ change initial estimate of `prop.sd` to `0.05` #> ℹ omega has too many items, ignored: 'eta.kqp'"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-pipeline.html","id":"summarizing-the-simulation-output","dir":"Articles","previous_headings":"","what":"Summarizing the simulation output","title":"rxode2 in a pipeline","text":"easy use dplyr data.table perform summary simulations, rxode2 also provides ability confint function.","code":"## This takes a little more time; Most of the time is the summary ## time. sim0 <- Ribba2012 %>% # Use rxode2 ini(prop.sd=0.05) %>% et(time.units=\"months\") %>% # Pipe to a new event table et(amt=1, time=50, until=58, ii=1.5) %>% # Add dosing every 1.5 months et(0, 250, by=0.5) %>% # Add some sampling times (not required) rxSolve(nSub=10, nStud=10, omega=omega, thetaMat=thetaMat, thetaLower=0, # Make sure the rates are reasonable dfSub=760, dfObs=95) %>% # Solve the simulation confint(c(\"pt\",\"q\",\"qp\",\"sim\"),level=0.90); # Create Simulation intervals #> ℹ change initial estimate of `prop.sd` to `0.05` #> ℹ omega has too many items, ignored: 'eta.kqp' #> ! in order to put confidence bands around the intervals, you need at least 2500 simulations #> summarizing data...done sim0 %>% plot() # Plot the simulation intervals"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-pipeline.html","id":"simulating-from-a-data-frame-of-parameters","dir":"Articles","previous_headings":"Summarizing the simulation output","what":"Simulating from a data-frame of parameters","title":"rxode2 in a pipeline","text":"simulation matrices can useful fast way simulate information, sometimes may want simulate complex scenarios. instance, may reason believe tkde needs tlambdap, therefore need simulated carefully. can generate data frame whatever way want. internal method simulating new parameters exported .","code":"library(dplyr) #> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union Ribba2012 <- Ribba2012() # Convert to classic rxode2 model with ini attached r <- Ribba2012$simulationIniModel #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ pars <- rxInits(r) pars <- pars[regexpr(\"(prop|eta)\",names(pars)) == -1] print(pars) #> k tkde tkpq tkqpp tlambdap tgamma #> 1.00e+02 2.40e-01 2.95e-02 3.10e-03 1.21e-01 7.29e-01 #> tdeltaqp tpt0 tq0 rxerr.pstar #> 8.67e-03 7.13e+00 4.12e+01 1.00e+00 ## This is the exported method for simulation of Theta/Omega internally in rxode2 df <- rxSimThetaOmega(params=pars, omega=omega,dfSub=760, thetaMat=thetaMat, thetaLower=0, nSub=60,nStud=60) %>% filter(tkde > tlambdap) %>% as_tibble() ## You could also simulate more and bind them together to a data frame. print(df) #> # A tibble: 2,220 × 17 #> k tkde tkpq tkqpp tlambdap tgamma tdeltaqp tpt0 tq0 rxerr.pstar #> #> 1 100 1.50 0.0295 0.121 0.780 0.850 1.39 8.04 41.2 1 #> 2 100 1.50 0.0295 0.121 0.780 0.850 1.39 8.04 41.2 1 #> 3 100 1.50 0.0295 0.121 0.780 0.850 1.39 8.04 41.2 1 #> 4 100 1.50 0.0295 0.121 0.780 0.850 1.39 8.04 41.2 1 #> 5 100 1.50 0.0295 0.121 0.780 0.850 1.39 8.04 41.2 1 #> 6 100 1.50 0.0295 0.121 0.780 0.850 1.39 8.04 41.2 1 #> 7 100 1.50 0.0295 0.121 0.780 0.850 1.39 8.04 41.2 1 #> 8 100 1.50 0.0295 0.121 0.780 0.850 1.39 8.04 41.2 1 #> 9 100 1.50 0.0295 0.121 0.780 0.850 1.39 8.04 41.2 1 #> 10 100 1.50 0.0295 0.121 0.780 0.850 1.39 8.04 41.2 1 #> # ℹ 2,210 more rows #> # ℹ 7 more variables: eta.pt0 , eta.q0 , eta.lambdap , #> # eta.kqp , eta.kqpp , eta.deltaqp , eta.tkde ## Quick check to make sure that all the parameters are OK. all(df$tkde>df$tlambdap) #> [1] TRUE sim1 <- r %>% # Use rxode2 et(time.units=\"months\") %>% # Pipe to a new event table et(amt=1, time=50, until=58, ii=1.5) %>% # Add dosing every 1.5 months et(0, 250, by=0.5) %>% # Add some sampling times (not required) rxSolve(df) ## Note this information looses information about which ID is in a ## \"study\", so it summarizes the confidence intervals by dividing the ## subjects into sqrt(#subjects) subjects and then summarizes the ## confidence intervals sim2 <- sim1 %>% confint(c(\"pt\",\"q\",\"qp\",\"sim\"),level=0.90); # Create Simulation intervals #> ! in order to put confidence bands around the intervals, you need at least 2500 simulations #> summarizing data...done save(sim2, file = file.path(system.file(package = \"rxode2\"), \"pipeline-sim2.rds\"), version = 2) sim2 %>% plot()"},{"path":[]},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-plot.html","id":"setting-up-model-for-plotting-explanation","dir":"Articles","previous_headings":"Plotting in rxode2","what":"Setting up model for plotting explanation","title":"Plotting rxode2 models","text":"first step explain rxode2 model plots setup: rxode2 model event table solved object","code":"library(rxode2) ## rxode2 2.0.14.9000 using 2 threads (see ?getRxThreads) ## no cache: create with `rxCreateCache()` ## Model from rxode2 tutorial m1 <- function() { ini({ KA <- 2.94E-01 CL <- 1.86E+01 V2 <- 4.02E+01 Q <- 1.05E+01 V3 <- 2.97E+02 Kin <- 1 Kout <- 1 EC50 <- 200 ## Added modeled bioavaiblity, duration and rate fdepot <- 1 durDepot <- 8 rateDepot <- 1250 }) model({ C2 <- centr / V2 C3 <- peri / V3 d/dt(depot) <- -KA * depot f(depot) <- fdepot dur(depot) <- durDepot rate(depot) <- rateDepot d/dt(centr) <- KA * depot - CL * C2 - Q * C2 + Q * C3 d/dt(peri) <- Q * C2 - Q * C3 d/dt(eff) <- Kin - Kout * (1 - C2 / (EC50 + C2)) * eff eff(0) <- 1 }) } ev <- et(timeUnits = \"hr\") %>% et(amt = 10000, ii = 12, until = 24) %>% et(seq(0, 24, length.out = 100)) s <- rxSolve(m1, ev)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-plot.html","id":"default-rxode2-plot","dir":"Articles","previous_headings":"Plotting in rxode2","what":"Default rxode2 plot","title":"Plotting rxode2 models","text":"default plot rxode2 plot time versus state calculated lhs values: Things note: First, plots actually ggplot2 plots can modified standard ggplot2 grammar graphics Also note plot method rxSolve objects can currently use arguments default plot method: log character string contains \"x\" x axis logarithmic, \"y\" y axis logarithmic \"xy\" \"yx\" axes logarithmic. available, use xgxr xgx_scale_x_log10() xgx_scale_y_log10() functions. xlab bit different simply supplying x-label ggplot2, retain unit information originally supplied event table. Also note, available, unit information used used meaningful ticks xgx_scale_x_time_units() ylab supplies y label following currently unsupported: . type b. xlim c. ylim d. main e. sub f. ann g. axes","code":"plot(s)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-plot.html","id":"subsetting-plots","dir":"Articles","previous_headings":"","what":"Subsetting plots","title":"Plotting rxode2 models","text":"interesting, often useful subset plots based values interested ; example, interesting plot eff C2. , simply specify interesting items plot function. instance:","code":"plot(s, C2, eff)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-plot.html","id":"semi-log-plots","dir":"Articles","previous_headings":"","what":"Semi-log plots","title":"Plotting rxode2 models","text":"Semi-log plots PK concentrations common; simply need use log=\"y\" uses xgx_scale_y_log10() available clearly show semi-log nature plot.","code":"plot(s, C2, log=\"y\", ylab=\"Concentration\") ## Warning: Transformation introduced infinite values in continuous y-axis"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-plot.html","id":"plots-with-multi-subject-plots","dir":"Articles","previous_headings":"","what":"Plots with multi-subject plots","title":"Plotting rxode2 models","text":"multi-subject plots can easily plot applying principles . illustrate plot, lets expand event table include plot 4 subjects lognormal random variability subjects; complete, may plot method: Notice colored individual labeled legend. interested concentration, produces similar plot: Notice plot individual labeled attached id let know individual comes . done ggrepel available, otherwise legend retained.","code":"# Setup the new problem m2 <- function() { ini({ KA <- 2.94E-01 TCL <- 1.86E+01 V2 <- 4.02E+01 Q <- 1.05E+01 V3 <- 2.97E+02 Kin <- 1 Kout <- 1 EC50 <- 200 ## Added modeled bioavaiblity, duration and rate fdepot <- 1 durDepot <- 8 rateDepot <- 1250 eta.Cl ~ 0.4^2 }) model({ CL <- TCL * exp(eta.Cl) C2 <- centr / V2 C3 <- peri / V3 d/dt(depot) <- -KA * depot f(depot) <- fdepot dur(depot) <- durDepot rate(depot) <- rateDepot d/dt(centr) <- KA * depot - CL * C2 - Q * C2 + Q * C3 d/dt(peri) <- Q * C2 - Q * C3 d/dt(eff) <- Kin - Kout * (1 - C2 / (EC50 + C2)) * eff eff(0) <- 1 }) } # Create the event table ev <- et(timeUnits = \"hr\") %>% et(amt = 10000, until = units::set_units(3, days), ii = 12) %>% # loading doses et(seq(0, 48, length.out = 200)) %>% et(id = 1:4) s <- rxSolve(m2, ev) ## using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ plot(s, C2, eff) plot(s, C2, log=\"y\", ylab=\"Concentration\") ## Warning: Transformation introduced infinite values in continuous y-axis"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-plot.html","id":"multi-subject-plots-with-large-number-of-subjects","dir":"Articles","previous_headings":"Plots with multi-subject plots","what":"Multi-subject plots with large number of subjects","title":"Plotting rxode2 models","text":"can get bit much many subjects solved (example lets simulate 100) case, individuals put plot transparent grayscale plot pane. allows places subjects present darker. number individuals plots switch legend grayscale controlled changing options rxode2.spaghetti. ie. options(rxode2.spaghetti=7). 7 individuals default value plotting changes individual grayscale spaghetti plots. can also create confidence interval simulations confint: plot plot","code":"ev <- et(timeUnits = \"hr\") %>% et(amt = 10000, until = units::set_units(3, days), ii = 12) %>% # loading doses et(seq(0, 48, length.out = 200)) %>% et(id = 1:100) # 100 subjects s <- rxSolve(m2, ev) plot(s, C2, log=\"y\", ylab=\"Concentration\") ## Warning: Transformation introduced infinite values in continuous y-axis s2 <- confint(s, parm=\"C2\") ## ! in order to put confidence bands around the intervals, you need at least 2500 simulations ## summarizing data...done plot(s2)"},{"path":"https://nlmixr2.github.io/rxode2/articles/rxode2-prior-data.html","id":"using-prior-data-for-solving","dir":"Articles","previous_headings":"","what":"Using prior data for solving","title":"Using Prior Data for ODE solving","text":"rxode2 can use single subject multiple subjects single event table solve ODEs. Additionally, rxode2 can use arbitrary data frame individualized events. example using nlmixr, use theo_sd data frame","code":"library(rxode2) #> rxode2 2.0.14.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()` library(nlmixr2data) ## Load data from nlmixr d <- theo_sd ## Create rxode2 model theo <- function() { ini({ tka <- 0.45 # Log Ka tcl <- 1 # Log Cl tv <- 3.45 # Log V eta.ka ~ 0.6 eta.cl ~ 0.3 eta.v ~ 0.1 }) model({ ka <- exp(tka + eta.ka) cl <- exp(tcl + eta.cl) v <- exp(tv + eta.v) d/dt(depot) = -ka * depot d/dt(center) = ka * depot - cl / v * center cp = center / v }) } ## Create parameter dataset library(dplyr) #> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union parsDf <- tribble( ~ eta.ka, ~ eta.cl, ~ eta.v, 0.105, -0.487, -0.080, 0.221, 0.144, 0.021, 0.368, 0.031, 0.058, -0.277, -0.015, -0.007, -0.046, -0.155, -0.142, -0.382, 0.367, 0.203, -0.791, 0.160, 0.047, -0.181, 0.168, 0.096, 1.420, 0.042, 0.012, -0.738, -0.391, -0.170, 0.790, 0.281, 0.146, -0.527, -0.126, -0.198) %>% mutate(tka = 0.451, tcl = 1.017, tv = 3.449) ## Now solve the dataset solveData <- rxSolve(theo, parsDf, d) #> ℹ parameter labels from comments will be replaced by 'label()' #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ plot(solveData, cp) print(solveData) #> ── Solved rxode2 object ── #> ── Parameters ($params): ── #> # A tibble: 12 × 7 #> id tka tcl tv eta.ka eta.cl eta.v #>