diff --git a/articles/Integrating-User-Defined-Functions-into-rxode2.html b/articles/Integrating-User-Defined-Functions-into-rxode2.html index 7a8b001d3..e8907fbda 100644 --- a/articles/Integrating-User-Defined-Functions-into-rxode2.html +++ b/articles/Integrating-User-Defined-Functions-into-rxode2.html @@ -248,8 +248,8 @@

R based user functionsprint(mb) #> Unit: milliseconds #> expr min lq mean median uq max neval -#> withoutC 7.622042 7.688254 8.259156 7.735658 7.875183 13.217607 100 -#> withC 2.042315 2.082330 2.407566 2.169873 2.681195 6.437425 100 +#> withoutC 7.680327 7.785828 8.376530 7.838657 7.987801 13.987494 100 +#> withC 2.060081 2.104287 2.427778 2.174448 2.712511 6.527538 100

The C version is almost twice as fast as the R version. You may have noticed the conversion also created C versions of the first derivative. This is done automatically and gives not just C versions of function, diff --git a/articles/Integrating-User-Defined-Functions-into-rxode2_files/figure-html/benmchmark1-1.png b/articles/Integrating-User-Defined-Functions-into-rxode2_files/figure-html/benmchmark1-1.png index 09c5cefe1..2831da80e 100644 Binary files a/articles/Integrating-User-Defined-Functions-into-rxode2_files/figure-html/benmchmark1-1.png and b/articles/Integrating-User-Defined-Functions-into-rxode2_files/figure-html/benmchmark1-1.png differ diff --git a/articles/Integrating-User-Defined-Functions-into-rxode2_files/figure-html/convertC-1.png b/articles/Integrating-User-Defined-Functions-into-rxode2_files/figure-html/convertC-1.png index 6d2263fb1..41fa69a3d 100644 Binary files a/articles/Integrating-User-Defined-Functions-into-rxode2_files/figure-html/convertC-1.png and b/articles/Integrating-User-Defined-Functions-into-rxode2_files/figure-html/convertC-1.png differ diff --git a/articles/rxode2-cmt.html b/articles/rxode2-cmt.html index 78155d0dc..ed4591f62 100644 --- a/articles/rxode2-cmt.html +++ b/articles/rxode2-cmt.html @@ -380,8 +380,8 @@

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_5da87c6d1f91668f6d05372040b2eafc model (ready). 
-#> DLL: /tmp/RtmpG6A6n6/rxode2/rx_5da87c6d1f91668f6d05372040b2eafc__.rxd/rx_5da87c6d1f91668f6d05372040b2eafc_.so
+
#> rxode2 2.0.14.9000 model named rx_ebc703eece126d4bf12e074fd16966f2 model (ready). 
+#> DLL: /tmp/RtmpFScia9/rxode2/rx_ebc703eece126d4bf12e074fd16966f2__.rxd/rx_ebc703eece126d4bf12e074fd16966f2_.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_93a4b5aac982087fb323c655d89a3bb9 model (ready). 
+
#> rxode2 2.0.14.9000 model named rx_28ca3a83fb397e38ec72a547f91659fa model (ready). 
 #> x$state: depot, center
 #> x$stateExtra: eff
 #> x$params: V, KA, CL
diff --git a/articles/rxode2-model-types.html b/articles/rxode2-model-types.html
index ff01c0997..ba39fda15 100644
--- a/articles/rxode2-model-types.html
+++ b/articles/rxode2-model-types.html
@@ -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 494c07bb7..1bd23ba5e 100644 --- a/articles/rxode2-nesting.html +++ b/articles/rxode2-nesting.html @@ -312,24 +312,24 @@

Uncertainty in Model parametersdimnames(tMat) <- list(names(theta), names(theta)) tMat

-
#>              TKA           TCl           V2           Q           V3
-#> TKA   0.10524323  0.0195962916 -0.040781262 -0.12273095 -0.010991507
-#> TCl   0.01959629  0.0911766794 -0.019584328 -0.07810065 -0.006831950
-#> V2   -0.04078126 -0.0195843283  0.040144815  0.05199231  0.002913150
-#> Q    -0.12273095 -0.0781006450  0.051992306  0.30989598  0.102225734
-#> V3   -0.01099151 -0.0068319505  0.002913150  0.10222573  0.141390721
-#> Kin   0.01554079  0.0001343313 -0.018775609 -0.06667904 -0.036404209
-#> Kout -0.07183484 -0.0531330807  0.028680084  0.11728741 -0.033987922
-#> EC50  0.03725729  0.0134040543 -0.003635586 -0.09243313 -0.002517493
-#>                Kin        Kout         EC50
-#> TKA   0.0155407941 -0.07183484  0.037257286
-#> TCl   0.0001343313 -0.05313308  0.013404054
-#> V2   -0.0187756094  0.02868008 -0.003635586
-#> Q    -0.0666790392  0.11728741 -0.092433134
-#> V3   -0.0364042091 -0.03398792 -0.002517493
-#> Kin   0.0510761277 -0.03593031  0.049433157
-#> Kout -0.0359303052  0.24617352 -0.104651320
-#> EC50  0.0494331568 -0.10465132  0.134046722
+
#>              TKA          TCl           V2           Q          V3         Kin
+#> TKA   0.18214722 -0.065073613  0.154851667 -0.06849577 -0.05144454  0.09665182
+#> TCl  -0.06507361  0.211128764  0.025454389 -0.03638970  0.09481766 -0.08117011
+#> V2    0.15485167  0.025454389  0.226483333 -0.13042048 -0.01811260  0.06004728
+#> Q    -0.06849577 -0.036389697 -0.130420482  0.16011352  0.05065716 -0.04982262
+#> V3   -0.05144454  0.094817658 -0.018112600  0.05065716  0.23800567 -0.01442470
+#> Kin   0.09665182 -0.081170111  0.060047278 -0.04982262 -0.01442470  0.12352553
+#> Kout -0.04309263  0.007532678 -0.066664954 -0.06649494 -0.07215505 -0.01753545
+#> EC50 -0.02269191  0.044278855 -0.004855918  0.02220431  0.06194107 -0.02223489
+#>              Kout         EC50
+#> TKA  -0.043092630 -0.022691906
+#> TCl   0.007532678  0.044278855
+#> V2   -0.066664954 -0.004855918
+#> Q    -0.066494941  0.022204306
+#> V3   -0.072155052  0.061941066
+#> Kin  -0.017535455 -0.022234891
+#> Kout  0.218063152 -0.005305191
+#> EC50 -0.005305191  0.053124939

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.0130 0.169 0.00797 -#> 2 1 2 -0.0130 0.169 0.00797 -#> 3 1 3 -0.0130 0.169 0.00797 -#> 4 1 4 -0.0130 0.169 0.00797 -#> 5 1 5 -0.0130 0.169 0.00797 -#> 6 1 6 -0.0130 0.169 0.00797 -#> 7 1 7 -0.0130 0.169 0.00797 -#> 8 1 8 -0.0130 0.169 0.00797 -#> 9 1 9 -0.0130 0.169 0.00797 -#> 10 1 10 -0.0130 0.169 0.00797 +#> 1 1 1 0.000394 0.0880 0.0544 +#> 2 1 2 0.000394 0.0880 0.0544 +#> 3 1 3 0.000394 0.0880 0.0544 +#> 4 1 4 0.000394 0.0880 0.0544 +#> 5 1 5 0.000394 0.0880 0.0544 +#> 6 1 6 0.000394 0.0880 0.0544 +#> 7 1 7 0.000394 0.0880 0.0544 +#> 8 1 8 0.000394 0.0880 0.0544 +#> 9 1 9 0.000394 0.0880 0.0544 +#> 10 1 10 0.000394 0.0880 0.0544 #> # 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,14 +433,14 @@

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.0130 0.00797 -0.364 -0.0797 0.179 0.122 0 0 -#> 2 1 1 0.1 -0.0130 0.00797 0.370 -0.365 0.179 0.122 5.97 0.0114 -#> 3 1 1 4 -0.0130 0.00797 -0.364 -0.0797 0.179 0.122 38.4 4.13 -#> 4 1 1 4.1 -0.0130 0.00797 0.370 -0.365 0.179 0.122 32.6 4.22 -#> 5 1 1 8 -0.0130 0.00797 -0.364 -0.0797 0.179 0.122 32.9 6.65 -#> 6 1 1 8.1 -0.0130 0.00797 0.370 -0.365 0.179 0.122 11.3 6.68 +#> 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.000394 0.0544 0.0887 0.0923 0.0426 0.0697 0 0 +#> 2 1 1 0.1 0.000394 0.0544 0.285 -0.151 0.0426 0.0697 4.62 0.00765 +#> 3 1 1 4 0.000394 0.0544 0.0887 0.0923 0.0426 0.0697 7.10 2.53 +#> 4 1 1 4.1 0.000394 0.0544 0.285 -0.151 0.0426 0.0697 20.5 2.59 +#> 5 1 1 8 0.000394 0.0544 0.0887 0.0923 0.0426 0.0697 3.92 4.18 +#> 6 1 1 8.1 0.000394 0.0544 0.285 -0.151 0.0426 0.0697 15.2 4.20 #> # 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>

@@ -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.01297846      0.1687315    0.007971401    -0.04895385
-#> 2      1  2    -0.01297846      0.1687315    0.007971401    -0.04895385
-#> 3      1  3    -0.01297846      0.1687315    0.007971401    -0.04895385
-#> 4      1  4    -0.01297846      0.1687315    0.007971401    -0.04895385
-#> 5      1  5    -0.01297846      0.1687315    0.007971401    -0.04895385
-#> 6      1  6    -0.01297846      0.1687315    0.007971401    -0.04895385
+#> 1      1  1    0.000394143     0.08802844     0.05437463      -0.213229
+#> 2      1  2    0.000394143     0.08802844     0.05437463      -0.213229
+#> 3      1  3    0.000394143     0.08802844     0.05437463      -0.213229
+#> 4      1  4    0.000394143     0.08802844     0.05437463      -0.213229
+#> 5      1  5    0.000394143     0.08802844     0.05437463      -0.213229
+#> 6      1  6    0.000394143     0.08802844     0.05437463      -0.213229
 #>   eye.Cl(eye==1) eye.Cl(eye==2) eye.Ka(eye==1) eye.Ka(eye==2) iov.Cl(occ==1)
-#> 1    -0.36434523   0.3704529236    -0.07970633    -0.36508422    0.178666438
-#> 2    -0.10723630  -0.1543465784    -0.36039433     0.05790772   -0.001530669
-#> 3    -0.05693862  -0.0707329793     0.05983005    -0.04233135   -0.033899194
-#> 4    -0.03024253   0.3470127990    -0.26257778    -0.17789013   -0.076572829
-#> 5     0.07694592   0.0996393327    -0.07031235    -0.06961614    0.015876306
-#> 6    -0.17759027   0.0002101827     0.10656827     0.54980122   -0.042696454
+#> 1     0.08874123    0.284908310     0.09233534    -0.15129633     0.04256025
+#> 2    -0.22329690    0.069170727    -0.41096481    -0.01330093    -0.10302790
+#> 3    -0.32858952   -0.240481495     0.04094987     0.27816655    -0.01911401
+#> 4     0.20057725    0.102077397     0.09427646     0.10042832    -0.10427700
+#> 5    -0.17589887    0.439108541    -0.09699372     0.34545120    -0.05921163
+#> 6     0.31540626    0.008289514    -0.48644444    -0.24490623    -0.08336518
 #>   iov.Cl(occ==2) iov.Ka(occ==1) iov.Ka(occ==2)       V2       V3      TCl
-#> 1    -0.05670826    0.121693604    0.021541003 39.94027 296.5209 18.59632
-#> 2    -0.01018096   -0.003395944    0.009158207 39.94027 296.5209 18.59632
-#> 3    -0.01926255   -0.048021922   -0.188427781 39.94027 296.5209 18.59632
-#> 4    -0.17832430    0.048755911    0.084187050 39.94027 296.5209 18.59632
-#> 5     0.07169803   -0.084700170   -0.017363741 39.94027 296.5209 18.59632
-#> 6    -0.03108922   -0.060459613   -0.072644806 39.94027 296.5209 18.59632
-#>        eta.Cl       TKA     eta.Ka        Q     Kin    Kout     EC50
-#> 1 -0.27253945 0.1845138 0.28787878 10.10728 1.41481 1.08659 200.2634
-#> 2 -0.27825150 0.1845138 0.07849200 10.10728 1.41481 1.08659 200.2634
-#> 3 -0.19629964 0.1845138 0.12164312 10.10728 1.41481 1.08659 200.2634
-#> 4 -0.04954326 0.1845138 0.08188589 10.10728 1.41481 1.08659 200.2634
-#> 5  0.01468967 0.1845138 0.02590364 10.10728 1.41481 1.08659 200.2634
-#> 6 -0.21743628 0.1845138 0.33722480 10.10728 1.41481 1.08659 200.2634
+#> 1 0.148051420 0.06965373 0.24581707 40.09401 295.6217 18.14504 +#> 2 -0.020787382 0.06760295 0.31972821 40.09401 295.6217 18.14504 +#> 3 0.005025168 -0.06591651 -0.07580992 40.09401 295.6217 18.14504 +#> 4 0.002808463 0.06168375 0.02224114 40.09401 295.6217 18.14504 +#> 5 -0.001778236 0.03771896 0.02584761 40.09401 295.6217 18.14504 +#> 6 0.082541169 0.03786819 0.10218887 40.09401 295.6217 18.14504 +#> eta.Cl TKA eta.Ka Q Kin Kout EC50 +#> 1 0.38786341 0.1857857 -0.173919328 10.01157 1.005855 1.781983 199.6408 +#> 2 0.14026344 0.1857857 0.225097434 10.01157 1.005855 1.781983 199.6408 +#> 3 -0.08702708 0.1857857 0.411283938 10.01157 1.005855 1.781983 199.6408 +#> 4 -0.38496908 0.1857857 0.227279078 10.01157 1.005855 1.781983 199.6408 +#> 5 0.45289952 0.1857857 0.006090343 10.01157 1.005855 1.781983 199.6408 +#> 6 0.13416942 0.1857857 -0.052893417 10.01157 1.005855 1.781983 199.6408

 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.1381834    -0.07625591     -0.1147319     -0.1327589
-#> 2      2  2     -0.1381834    -0.07625591     -0.1147319     -0.1327589
-#> 3      2  3     -0.1381834    -0.07625591     -0.1147319     -0.1327589
-#> 4      2  4     -0.1381834    -0.07625591     -0.1147319     -0.1327589
-#> 5      2  5     -0.1381834    -0.07625591     -0.1147319     -0.1327589
-#> 6      2  6     -0.1381834    -0.07625591     -0.1147319     -0.1327589
+#> 1      2  1    0.001986868      0.2045951    -0.07730072    -0.09059694
+#> 2      2  2    0.001986868      0.2045951    -0.07730072    -0.09059694
+#> 3      2  3    0.001986868      0.2045951    -0.07730072    -0.09059694
+#> 4      2  4    0.001986868      0.2045951    -0.07730072    -0.09059694
+#> 5      2  5    0.001986868      0.2045951    -0.07730072    -0.09059694
+#> 6      2  6    0.001986868      0.2045951    -0.07730072    -0.09059694
 #>   eye.Cl(eye==1) eye.Cl(eye==2) eye.Ka(eye==1) eye.Ka(eye==2) iov.Cl(occ==1)
-#> 1      0.2269129      0.2581869      0.2798932    -0.02681279    -0.22890287
-#> 2     -0.2009005     -0.1696096      0.1474433     0.28535219     0.12983576
-#> 3     -0.3672459     -0.3987801      0.2564106    -0.07613422    -0.10691395
-#> 4      0.1755765      0.1995688     -0.1289375     0.12910869    -0.03148799
-#> 5      0.2309972      0.1180215     -0.2515939    -0.20469517    -0.04596325
-#> 6      0.1475438      0.1968126      0.2314342    -0.31494432    -0.04242763
-#>   iov.Cl(occ==2) iov.Ka(occ==1) iov.Ka(occ==2)       V2       V3     TCl
-#> 1     0.03418487     0.09613456     0.16156506 40.41229 297.3253 18.2318
-#> 2    -0.07748243    -0.19162629    -0.09772608 40.41229 297.3253 18.2318
-#> 3     0.11418462     0.04707450     0.16807478 40.41229 297.3253 18.2318
-#> 4     0.12375822    -0.03202817     0.20011273 40.41229 297.3253 18.2318
-#> 5    -0.10228126     0.07826439     0.22500170 40.41229 297.3253 18.2318
-#> 6    -0.10016671    -0.01462587     0.02336089 40.41229 297.3253 18.2318
-#>        eta.Cl       TKA     eta.Ka        Q       Kin      Kout     EC50
-#> 1 -0.20086952 0.2333199 -0.0414174 10.72069 0.9786748 0.9991689 200.2193
-#> 2  0.11308182 0.2333199 -0.3548082 10.72069 0.9786748 0.9991689 200.2193
-#> 3 -0.36755955 0.2333199  0.1558984 10.72069 0.9786748 0.9991689 200.2193
-#> 4 -0.18393330 0.2333199  0.3091535 10.72069 0.9786748 0.9991689 200.2193
-#> 5 -0.02736961 0.2333199 -0.2065517 10.72069 0.9786748 0.9991689 200.2193
-#> 6 -0.31209212 0.2333199 -0.3761942 10.72069 0.9786748 0.9991689 200.2193
+#> 1 -0.10709761 0.28601847 -0.27271957 -0.25903852 -0.027814266 +#> 2 -0.10449928 -0.07056373 0.11189229 -0.26687317 -0.104948857 +#> 3 0.17425974 0.33925855 -0.12120111 -0.09546716 -0.035051731 +#> 4 -0.01581228 0.18438539 -0.51131389 -0.04098984 -0.009952889 +#> 5 0.16638326 -0.02882976 0.02979109 0.17039239 -0.074698671 +#> 6 -0.22401771 0.32229049 -0.03720356 0.02952642 -0.080734767 +#> iov.Cl(occ==2) iov.Ka(occ==1) iov.Ka(occ==2) V2 V3 TCl +#> 1 -0.03138863 0.08441297 -0.03262962 40.14834 297.9576 18.20341 +#> 2 -0.24533363 0.12337983 0.08421487 40.14834 297.9576 18.20341 +#> 3 0.06999665 0.14882817 0.03111777 40.14834 297.9576 18.20341 +#> 4 -0.15914658 -0.09220504 -0.10809969 40.14834 297.9576 18.20341 +#> 5 -0.03274357 0.05611387 0.05903557 40.14834 297.9576 18.20341 +#> 6 -0.02216565 -0.01391522 0.03948332 40.14834 297.9576 18.20341 +#> eta.Cl TKA eta.Ka Q Kin Kout EC50 +#> 1 0.02279773 0.3299909 -0.18655563 10.81314 1.649013 0.3192288 200.2316 +#> 2 -0.17666623 0.3299909 0.05105939 10.81314 1.649013 0.3192288 200.2316 +#> 3 -0.25311782 0.3299909 -0.11943289 10.81314 1.649013 0.3192288 200.2316 +#> 4 0.59976414 0.3299909 -0.44235783 10.81314 1.649013 0.3192288 200.2316 +#> 5 -0.05830617 0.3299909 0.48535172 10.81314 1.649013 0.3192288 200.2316 +#> 6 -0.54775033 0.3299909 -0.28962686 10.81314 1.649013 0.3192288 200.2316

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-plot_files/figure-html/unnamed-chunk-10-1.png b/articles/rxode2-plot_files/figure-html/unnamed-chunk-10-1.png index 7338c8003..c89de6b13 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 b954465a7..7d273e95d 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 b1555d6ee..fbaf3759f 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 8c5987101..bbd0b3ff4 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 09e5259eb..9bf9247f6 100644 --- a/articles/rxode2-prior-data.html +++ b/articles/rxode2-prior-data.html @@ -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.0599 -0.281 -0.0622 -#> 2 2 0.451 1.02 3.45 0.469 -1.66 -0.245 -#> 3 3 0.451 1.02 3.45 -1.38 0.234 0.103 -#> 4 4 0.451 1.02 3.45 0.0553 -0.336 -0.298 -#> 5 5 0.451 1.02 3.45 0.849 -0.0873 -0.278 -#> 6 6 0.451 1.02 3.45 1.77 -0.378 0.296 -#> 7 7 0.451 1.02 3.45 -0.476 -0.218 -0.0439 -#> 8 8 0.451 1.02 3.45 1.34 -0.146 -0.498 -#> 9 9 0.451 1.02 3.45 -0.447 0.444 -0.0631 -#> 10 10 0.451 1.02 3.45 0.337 0.450 -0.195 -#> 11 11 0.451 1.02 3.45 -0.304 0.0651 -0.575 -#> 12 12 0.451 1.02 3.45 0.131 0.325 -0.258 +#> 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.000984 -0.270 0.220 +#> 2 2 0.451 1.02 3.45 1.41 0.262 -0.0357 +#> 3 3 0.451 1.02 3.45 -0.590 0.941 0.134 +#> 4 4 0.451 1.02 3.45 -0.0662 -0.103 0.149 +#> 5 5 0.451 1.02 3.45 -0.172 -0.331 -0.0178 +#> 6 6 0.451 1.02 3.45 -0.580 -0.385 -0.275 +#> 7 7 0.451 1.02 3.45 -0.609 -0.820 -0.0913 +#> 8 8 0.451 1.02 3.45 1.15 -0.0560 -0.0764 +#> 9 9 0.451 1.02 3.45 0.674 -0.268 0.153 +#> 10 10 0.451 1.02 3.45 0.437 -0.0307 -0.677 +#> 11 11 0.451 1.02 3.45 -0.224 0.709 -0.112 +#> 12 12 0.451 1.02 3.45 -0.0314 0.123 0.378 #> ── 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 1.48 2.09 29.6 0 320. 0 -#> 2 1 0.25 1.48 2.09 29.6 3.31 221. 98.0 -#> 3 1 0.57 1.48 2.09 29.6 6.02 138. 178. -#> 4 1 1.12 1.48 2.09 29.6 8.33 61.1 246. -#> 5 1 2.02 1.48 2.09 29.6 9.28 16.1 274. -#> 6 1 3.82 1.48 2.09 29.6 8.64 1.13 255. +#> id time ka cl v cp depot center +#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> +#> 1 1 0 1.57 2.11 39.2 0 320. 0 +#> 2 1 0.25 1.57 2.11 39.2 2.63 216. 103. +#> 3 1 0.57 1.57 2.11 39.2 4.74 131. 186. +#> 4 1 1.12 1.57 2.11 39.2 6.50 55.1 255. +#> 5 1 2.02 1.57 2.11 39.2 7.23 13.4 283. +#> 6 1 3.82 1.57 2.11 39.2 6.86 0.791 269. #> # ℹ 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 0.572 3.82 26.9 0 320. 0 -#> 2 1 0.25 0.572 3.82 26.9 1.56 277. 41.9 -#> 3 1 0.57 0.572 3.82 26.9 3.17 231. 85.4 -#> 4 1 1.12 0.572 3.82 26.9 5.16 169. 139. -#> 5 1 2.02 0.572 3.82 26.9 6.90 101. 186. -#> 6 1 3.82 0.572 3.82 26.9 7.42 35.9 200. -#> 7 1 5.1 0.572 3.82 26.9 6.81 17.3 183. -#> 8 1 7.03 0.572 3.82 26.9 5.55 5.72 149. -#> 9 1 9.05 0.572 3.82 26.9 4.29 1.80 115. -#> 10 1 12.1 0.572 3.82 26.9 2.81 0.311 75.7 +#> id time ka cl v cp depot center +#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> +#> 1 1 0 2.66 2.56 29.2 0 3.20e+ 2 0 +#> 2 1 0.25 2.66 2.56 29.2 5.25 1.65e+ 2 154. +#> 3 1 0.57 2.66 2.56 29.2 8.28 7.03e+ 1 242. +#> 4 1 1.12 2.66 2.56 29.2 9.68 1.63e+ 1 283. +#> 5 1 2.02 2.66 2.56 29.2 9.43 1.49e+ 0 276. +#> 6 1 3.82 2.66 2.56 29.2 8.10 1.24e- 2 237. +#> 7 1 5.1 2.66 2.56 29.2 7.24 4.13e- 4 212. +#> 8 1 7.03 2.66 2.56 29.2 6.12 2.44e- 6 179. +#> 9 1 9.05 2.66 2.56 29.2 5.13 1.11e- 8 150. +#> 10 1 12.1 2.66 2.56 29.2 3.92 -9.72e-10 115. #> # ℹ 122 more rows data.table::data.table(solveData) -#> id time ka cl v cp depot center -#> 1: 1 0.00 0.5724265 3.820799 26.90346 0.000000 3.199920e+02 0.00000 -#> 2: 1 0.25 0.5724265 3.820799 26.90346 1.557454 2.773248e+02 41.90091 -#> 3: 1 0.57 0.5724265 3.820799 26.90346 3.173836 2.309065e+02 85.38718 -#> 4: 1 1.12 0.5724265 3.820799 26.90346 5.160704 1.685409e+02 138.84080 -#> 5: 1 2.02 0.5724265 3.820799 26.90346 6.896249 1.006847e+02 185.53296 -#> --- -#> 128: 12 5.07 3.0179183 2.472543 28.72246 7.427310 7.260196e-05 213.33063 -#> 129: 12 7.07 3.0179183 2.472543 28.72246 6.252592 1.738745e-07 179.58985 -#> 130: 12 9.03 3.0179183 2.472543 28.72246 5.281827 -2.728387e-09 151.70708 -#> 131: 12 12.05 3.0179183 2.472543 28.72246 4.072673 1.594573e-09 116.97721 -#> 132: 12 24.15 3.0179183 2.472543 28.72246 1.437184 1.386272e-10 41.27947 +#> id time ka cl v cp depot center +#> 1: 1 0.00 2.659113 2.556823 29.24724 0.000000 3.199920e+02 0.0000 +#> 2: 1 0.25 2.659113 2.556823 29.24724 5.249097 1.645999e+02 153.5216 +#> 3: 1 0.57 2.659113 2.556823 29.24724 8.278016 7.028801e+01 242.1091 +#> 4: 1 1.12 2.659113 2.556823 29.24724 9.682049 1.628245e+01 283.1732 +#> 5: 1 2.02 2.659113 2.556823 29.24724 9.428983 1.487182e+00 275.7717 +#> --- +#> 128: 12 5.07 4.838476 1.653409 35.68224 7.173483 6.937358e-09 255.9659 +#> 129: 12 7.07 4.838476 1.653409 35.68224 6.538560 7.834384e-12 233.3104 +#> 130: 12 9.03 4.838476 1.653409 35.68224 5.970894 -2.530342e-11 213.0548 +#> 131: 12 12.05 4.838476 1.653409 35.68224 5.191166 8.775063e-13 185.2324 +#> 132: 12 24.15 4.838476 1.653409 35.68224 2.963226 -3.376430e-12 105.7345 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 6e8023cc6..36ca5627f 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-speed.html b/articles/rxode2-speed.html index ea106f224..72494132e 100644 --- a/articles/rxode2-speed.html +++ b/articles/rxode2-speed.html @@ -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_3db52194eb7226d83c8555109940bf90 model ( ready). 
-#> DLL: /tmp/RtmpG6A6n6/rxode2/rx_3db52194eb7226d83c8555109940bf90__.rxd/rx_3db52194eb7226d83c8555109940bf90_.so
+#> rxode2 2.0.14.9000 model named rx_681ee960fe62742402698ea5729ab086 model ( ready). 
+#> DLL: /tmp/RtmpFScia9/rxode2/rx_681ee960fe62742402698ea5729ab086__.rxd/rx_681ee960fe62742402698ea5729ab086_.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_90dfb781eb7a2b58bc36489c28ba4170 model ( ready). -#> DLL: /tmp/RtmpG6A6n6/rxode2/rx_90dfb781eb7a2b58bc36489c28ba4170__.rxd/rx_90dfb781eb7a2b58bc36489c28ba4170_.so +#> rxode2 2.0.14.9000 model named rx_aab532129b3bdda125abca8b1b5d38b6 model ( ready). +#> DLL: /tmp/RtmpFScia9/rxode2/rx_aab532129b3bdda125abca8b1b5d38b6__.rxd/rx_aab532129b3bdda125abca8b1b5d38b6_.so #> NULL #> #> Calculated Variables: @@ -308,8 +308,8 @@

A note about t #> }) summary(mod2$simulationModel) #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ -#> rxode2 2.0.14.9000 model named rx_65a417b472870474db4a0697fcb95aee model ( ready). -#> DLL: /tmp/RtmpG6A6n6/rxode2/rx_65a417b472870474db4a0697fcb95aee__.rxd/rx_65a417b472870474db4a0697fcb95aee_.so +#> rxode2 2.0.14.9000 model named rx_ea3e0ddd0ac2c9081602c0a652dd1d0b model ( ready). +#> DLL: /tmp/RtmpFScia9/rxode2/rx_ea3e0ddd0ac2c9081602c0a652dd1d0b__.rxd/rx_ea3e0ddd0ac2c9081602c0a652dd1d0b_.so #> NULL #> #> Calculated Variables: @@ -365,8 +365,8 @@

A note about t #> }) summary(mod2$simulationIniModel) #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ -#> rxode2 2.0.14.9000 model named rx_54cbbfad6ad14a3e7e87c2ad66f30d45 model ( ready). -#> DLL: /tmp/RtmpG6A6n6/rxode2/rx_54cbbfad6ad14a3e7e87c2ad66f30d45__.rxd/rx_54cbbfad6ad14a3e7e87c2ad66f30d45_.so +#> rxode2 2.0.14.9000 model named rx_09f8a4a73e98c2930e9b942212c58dc1 model ( ready). +#> DLL: /tmp/RtmpFScia9/rxode2/rx_09f8a4a73e98c2930e9b942212c58dc1__.rxd/rx_09f8a4a73e98c2930e9b942212c58dc1_.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() 271.12972 276.67950 289.11109 279.70390 286.03731 446.06617 -#> runSapply() 272.23359 277.92463 285.46407 280.02252 282.28206 334.06174 -#> runSingleThread() 29.13699 29.36107 30.10626 29.53718 29.83150 47.24153 -#> run2Thread() 17.12262 17.47965 19.08089 17.68412 18.22007 29.85472 +#> runFor() 267.00796 272.31696 283.74884 274.28839 278.11932 412.33897 +#> runSapply() 268.19887 273.04343 281.91052 274.96828 280.66443 324.29213 +#> runSingleThread() 26.94761 27.13836 27.96019 27.23802 27.45841 53.41421 +#> run2Thread() 15.89870 16.17621 17.38782 16.34154 16.86491 29.45720 #> 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) 29.12487 29.43899 30.58305 30.71440 30.92168 44.55127 100 -#> runThread(2) 17.20634 17.49846 19.80544 18.10535 18.60669 31.77304 100 -#> runThread(3) 18.93741 20.09896 20.76630 20.24559 20.99026 26.60115 100 -#> runThread(4) 16.59801 17.00669 19.51821 17.49137 17.87127 39.42654 100

+#> runThread(1) 26.95434 27.25681 28.56154 28.57183 28.78348 46.00226 100 +#> runThread(2) 15.92986 16.29273 18.95247 16.95823 20.81888 30.45891 100 +#> runThread(3) 17.38843 18.81361 19.33874 19.54308 19.71673 24.41152 100 +#> runThread(4) 15.68427 16.09095 17.49891 16.55007 16.75618 38.42969 100
 autoplot(bench)

@@ -675,7 +675,7 @@

A real life exampleStoplapply <- Sys.time() print(Stoplapply - Startlapply) -#> Time difference of 13.26343 secs +#> Time difference of 11.91316 secs

By applying some of the new parallel solving concepts you can simply run the same simulation both with less code and faster:

@@ -716,7 +716,7 @@ 

A real life exampleres <- rxSolve(rx, ev, omega=omega, returnType="data.table") endParallel <- Sys.time() print(endParallel - startParallel) -#> Time difference of 0.1396136 secs

+#> Time difference of 0.1312242 secs

You can see a striking time difference between the two methods; A few things to keep in mind: