diff --git a/articles/Integrating-User-Defined-Functions-into-rxode2.html b/articles/Integrating-User-Defined-Functions-into-rxode2.html index dce60b459..668653534 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.727787 7.826180 8.474937 7.936843 8.057928 13.853230 100 -#> withC 2.081749 2.127585 2.457711 2.202926 2.741196 6.870125 100 +#> withoutC 7.700593 7.951526 9.037858 8.122375 8.471702 18.935679 100 +#> withC 2.064802 2.125209 2.465687 2.243920 2.724382 7.041264 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 11e105f0d..a9ff4f8f7 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 2f522d5ca..b5680b746 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 3c699453e..067629c85 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_ec8d3d933baf3d4de1861f6eee3af54f model (ready). 
-#> DLL: /tmp/RtmpVppdYK/rxode2/rx_ec8d3d933baf3d4de1861f6eee3af54f__.rxd/rx_ec8d3d933baf3d4de1861f6eee3af54f_.so
+
#> rxode2 2.0.14.9000 model named rx_6d8a93557eeb02beabea128dc5ad47d7 model (ready). 
+#> DLL: /tmp/RtmpBVbnb0/rxode2/rx_6d8a93557eeb02beabea128dc5ad47d7__.rxd/rx_6d8a93557eeb02beabea128dc5ad47d7_.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_94ed67c611bcc72139f39e47b9aa8dad model (ready). 
+
#> rxode2 2.0.14.9000 model named rx_c11f1e22b8dac0362b486af248228475 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 4371c056a..eccc50f32 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 ec9db2bda..0056659f6 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.11703531  0.022931069  0.052659176  0.015735283 -0.001471800
-#> TCl   0.02293107  0.137434951 -0.035314127  0.022575607  0.002065351
-#> V2    0.05265918 -0.035314127  0.071584655  0.024768330 -0.001413514
-#> Q     0.01573528  0.022575607  0.024768330  0.072451666 -0.001353117
-#> V3   -0.00147180  0.002065351 -0.001413514 -0.001353117  0.076367568
-#> Kin  -0.03399546 -0.018732699  0.028468730  0.044572898 -0.047261248
-#> Kout  0.14814446  0.086491775  0.061381309  0.012673464 -0.059667284
-#> EC50 -0.04006924  0.083122933 -0.075862944 -0.012908714 -0.006387074
-#>              Kin        Kout         EC50
-#> TKA  -0.03399546  0.14814446 -0.040069235
-#> TCl  -0.01873270  0.08649177  0.083122933
-#> V2    0.02846873  0.06138131 -0.075862944
-#> Q     0.04457290  0.01267346 -0.012908714
-#> V3   -0.04726125 -0.05966728 -0.006387074
-#> Kin   0.12125456 -0.02337792 -0.020179869
-#> Kout -0.02337792  0.32026957 -0.008859630
-#> EC50 -0.02017987 -0.00885963  0.104055320
+
#>               TKA          TCl           V2           Q          V3         Kin
+#> TKA   0.112115698 -0.009850556  0.007551027  0.02717015 -0.06912995  0.01519379
+#> TCl  -0.009850556  0.123837710  0.006503724 -0.01642326  0.03217000 -0.01689723
+#> V2    0.007551027  0.006503724  0.069794754  0.03977863 -0.02727803  0.04706302
+#> Q     0.027170148 -0.016423262  0.039778625  0.13483848 -0.02367142  0.05663249
+#> V3   -0.069129952  0.032170001 -0.027278033 -0.02367142  0.18452035 -0.14166802
+#> Kin   0.015193790 -0.016897230  0.047063019  0.05663249 -0.14166802  0.18310876
+#> Kout -0.087672219 -0.059697923 -0.014594854  0.02393805  0.03389565  0.01483708
+#> EC50  0.001308951 -0.071851696 -0.019930371 -0.06072524  0.01027476 -0.06529272
+#>             Kout         EC50
+#> TKA  -0.08767222  0.001308951
+#> TCl  -0.05969792 -0.071851696
+#> V2   -0.01459485 -0.019930371
+#> Q     0.02393805 -0.060725240
+#> V3    0.03389565  0.010274758
+#> Kin   0.01483708 -0.065292716
+#> Kout  0.17854707  0.057224680
+#> EC50  0.05722468  0.258349758

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.136 -0.0346 0.0544 -#> 2 1 2 -0.136 -0.0346 0.0544 -#> 3 1 3 -0.136 -0.0346 0.0544 -#> 4 1 4 -0.136 -0.0346 0.0544 -#> 5 1 5 -0.136 -0.0346 0.0544 -#> 6 1 6 -0.136 -0.0346 0.0544 -#> 7 1 7 -0.136 -0.0346 0.0544 -#> 8 1 8 -0.136 -0.0346 0.0544 -#> 9 1 9 -0.136 -0.0346 0.0544 -#> 10 1 10 -0.136 -0.0346 0.0544 +#> 1 1 1 -0.353 -0.00831 0.172 +#> 2 1 2 -0.353 -0.00831 0.172 +#> 3 1 3 -0.353 -0.00831 0.172 +#> 4 1 4 -0.353 -0.00831 0.172 +#> 5 1 5 -0.353 -0.00831 0.172 +#> 6 1 6 -0.353 -0.00831 0.172 +#> 7 1 7 -0.353 -0.00831 0.172 +#> 8 1 8 -0.353 -0.00831 0.172 +#> 9 1 9 -0.353 -0.00831 0.172 +#> 10 1 10 -0.353 -0.00831 0.172 #> # 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.136 0.0544 0.0480 0.358 0.00583 -0.113 0 0 -#> 2 1 1 0.1 -0.136 0.0544 0.166 -0.0803 0.00583 -0.113 0.176 0.000220 -#> 3 1 1 4 -0.136 0.0544 0.0480 0.358 0.00583 -0.113 1.30 0.102 -#> 4 1 1 4.1 -0.136 0.0544 0.166 -0.0803 0.00583 -0.113 0.772 0.106 -#> 5 1 1 8 -0.136 0.0544 0.0480 0.358 0.00583 -0.113 1.34 0.237 -#> 6 1 1 8.1 -0.136 0.0544 0.166 -0.0803 0.00583 -0.113 1.75 0.240 +#> 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.353 0.172 -0.0847 -0.0714 -0.140 -0.0936 0 0 +#> 2 1 1 0.1 -0.353 0.172 0.377 0.0547 -0.140 -0.0936 1.40 0.00175 +#> 3 1 1 4 -0.353 0.172 -0.0847 -0.0714 -0.140 -0.0936 5.37 1.26 +#> 4 1 1 4.1 -0.353 0.172 0.377 0.0547 -0.140 -0.0936 4.81 1.30 +#> 5 1 1 8 -0.353 0.172 -0.0847 -0.0714 -0.140 -0.0936 9.91 2.68 +#> 6 1 1 8.1 -0.353 0.172 0.377 0.0547 -0.140 -0.0936 13.2 2.71 #> # 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.1358041    -0.03458078     0.05442917      -0.247565
-#> 2      1  2     -0.1358041    -0.03458078     0.05442917      -0.247565
-#> 3      1  3     -0.1358041    -0.03458078     0.05442917      -0.247565
-#> 4      1  4     -0.1358041    -0.03458078     0.05442917      -0.247565
-#> 5      1  5     -0.1358041    -0.03458078     0.05442917      -0.247565
-#> 6      1  6     -0.1358041    -0.03458078     0.05442917      -0.247565
+#> 1      1  1     -0.3533063   -0.008309353      0.1723393      0.1790294
+#> 2      1  2     -0.3533063   -0.008309353      0.1723393      0.1790294
+#> 3      1  3     -0.3533063   -0.008309353      0.1723393      0.1790294
+#> 4      1  4     -0.3533063   -0.008309353      0.1723393      0.1790294
+#> 5      1  5     -0.3533063   -0.008309353      0.1723393      0.1790294
+#> 6      1  6     -0.3533063   -0.008309353      0.1723393      0.1790294
 #>   eye.Cl(eye==1) eye.Cl(eye==2) eye.Ka(eye==1) eye.Ka(eye==2) iov.Cl(occ==1)
-#> 1     0.04797388     0.16647897     0.35836544   -0.080281803    0.005827296
-#> 2    -0.04207586    -0.32127178    -0.15381006   -0.081901013   -0.073410210
-#> 3    -0.06470621     0.08531993     0.50480958    0.123794024   -0.037007587
-#> 4     0.18526342    -0.11872354     0.09425413    0.324428942   -0.068267346
-#> 5     0.40433862    -0.63445992     0.15596531   -0.005328036    0.054351465
-#> 6    -0.10670056    -0.04731742    -0.07487432    0.151772521    0.039997588
+#> 1   -0.084653889    0.377393098    -0.07141393    0.054704962    -0.14011265
+#> 2   -0.008520937   -0.489077008     0.16927439    0.285783930     0.04358167
+#> 3   -0.283413323    0.098641223     0.34678208    0.007353856    -0.06327579
+#> 4    0.149526061   -0.041868359    -0.05790838   -0.286091428     0.03214023
+#> 5    0.112097239    0.001519346    -0.24261776    0.372461612     0.01406414
+#> 6   -0.400467774   -0.210597805    -0.22281062    0.017565035     0.03305942
 #>   iov.Cl(occ==2) iov.Ka(occ==1) iov.Ka(occ==2)       V2       V3      TCl
-#> 1     0.17467000    -0.11315524   -0.027471307 39.85601 297.0982 18.79008
-#> 2    -0.14607724     0.03259654   -0.051505853 39.85601 297.0982 18.79008
-#> 3     0.11164067     0.07856921    0.030400711 39.85601 297.0982 18.79008
-#> 4    -0.08760437     0.18215322    0.136151248 39.85601 297.0982 18.79008
-#> 5     0.04369457     0.06254118    0.031107436 39.85601 297.0982 18.79008
-#> 6    -0.10039367    -0.04020207    0.001598441 39.85601 297.0982 18.79008
-#>          eta.Cl         TKA      eta.Ka        Q       Kin      Kout     EC50
-#> 1  1.054405e-02 0.002957436  0.14108524 10.32072 0.8976381 0.5071298 200.3713
-#> 2 -7.116645e-01 0.002957436  0.06126781 10.32072 0.8976381 0.5071298 200.3713
-#> 3  3.654174e-01 0.002957436 -0.42567552 10.32072 0.8976381 0.5071298 200.3713
-#> 4 -3.738538e-01 0.002957436 -0.19753563 10.32072 0.8976381 0.5071298 200.3713
-#> 5 -4.999339e-01 0.002957436  0.01392929 10.32072 0.8976381 0.5071298 200.3713
-#> 6  9.387773e-05 0.002957436  0.26899582 10.32072 0.8976381 0.5071298 200.3713
+#> 1 -0.0292564230 -0.09358504 -0.177665154 39.79951 296.9817 18.61471 +#> 2 -0.0009348098 -0.03414698 -0.009404361 39.79951 296.9817 18.61471 +#> 3 0.0779231208 0.04814655 0.026132683 39.79951 296.9817 18.61471 +#> 4 0.2262657620 0.03857114 0.046516675 39.79951 296.9817 18.61471 +#> 5 -0.0376018698 -0.02992865 -0.012187652 39.79951 296.9817 18.61471 +#> 6 0.0405471434 0.07387049 -0.112104457 39.79951 296.9817 18.61471 +#> eta.Cl TKA eta.Ka Q Kin Kout EC50 +#> 1 0.2415634 0.04791035 -0.1249151 10.40671 1.3783 0.9330583 199.2484 +#> 2 0.1791659 0.04791035 -0.2733750 10.40671 1.3783 0.9330583 199.2484 +#> 3 -0.3918928 0.04791035 -0.2927899 10.40671 1.3783 0.9330583 199.2484 +#> 4 0.3992829 0.04791035 -0.7020660 10.40671 1.3783 0.9330583 199.2484 +#> 5 -0.3256218 0.04791035 -0.2616939 10.40671 1.3783 0.9330583 199.2484 +#> 6 0.1645415 0.04791035 -0.2896588 10.40671 1.3783 0.9330583 199.2484

 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.09225121      0.4197625      0.1103034     -0.1515019
-#> 2      2  2    -0.09225121      0.4197625      0.1103034     -0.1515019
-#> 3      2  3    -0.09225121      0.4197625      0.1103034     -0.1515019
-#> 4      2  4    -0.09225121      0.4197625      0.1103034     -0.1515019
-#> 5      2  5    -0.09225121      0.4197625      0.1103034     -0.1515019
-#> 6      2  6    -0.09225121      0.4197625      0.1103034     -0.1515019
+#> 1      2  1      0.0169642     -0.0865073     0.07706971     0.04302365
+#> 2      2  2      0.0169642     -0.0865073     0.07706971     0.04302365
+#> 3      2  3      0.0169642     -0.0865073     0.07706971     0.04302365
+#> 4      2  4      0.0169642     -0.0865073     0.07706971     0.04302365
+#> 5      2  5      0.0169642     -0.0865073     0.07706971     0.04302365
+#> 6      2  6      0.0169642     -0.0865073     0.07706971     0.04302365
 #>   eye.Cl(eye==1) eye.Cl(eye==2) eye.Ka(eye==1) eye.Ka(eye==2) iov.Cl(occ==1)
-#> 1    -0.05488014    -0.07984957    -0.07530740    -0.36889709   -0.004469539
-#> 2    -0.17343539    -0.14952653     0.02524376     0.07617528    0.094073636
-#> 3    -0.12164179    -0.08067928    -0.25448151     0.17660129   -0.046442839
-#> 4    -0.02718104    -0.15424966     0.21579809    -0.24989727   -0.171911720
-#> 5    -0.23841107     0.14090024    -0.01857125    -0.06831204   -0.015170982
-#> 6    -0.24138686     0.29118531     0.08672166    -0.23968576   -0.064346196
+#> 1     0.20650330     -0.1829621     0.08264560     0.10839285     0.10782270
+#> 2     0.29778283     -0.1177979    -0.08434116    -0.53302172    -0.08026276
+#> 3    -0.42770744      0.3203564    -0.26161057     0.05568947     0.11659689
+#> 4     0.08043367      0.2573634    -0.36286064    -0.19528470    -0.11121546
+#> 5    -0.14661952      0.5356398    -0.27605050     0.36553911    -0.18787017
+#> 6     0.11496384      0.1928787    -0.18474926    -0.08959247     0.05365931
 #>   iov.Cl(occ==2) iov.Ka(occ==1) iov.Ka(occ==2)       V2       V3      TCl
-#> 1    -0.02549565     0.11869518   -0.059886917 40.67424 297.1828 18.72567
-#> 2    -0.02005688     0.08023493    0.155252184 40.67424 297.1828 18.72567
-#> 3     0.04486803     0.05466137    0.103977734 40.67424 297.1828 18.72567
-#> 4     0.04688039    -0.10694955    0.061867014 40.67424 297.1828 18.72567
-#> 5    -0.08289231    -0.06934717    0.003205325 40.67424 297.1828 18.72567
-#> 6     0.13039400     0.09517615   -0.011655494 40.67424 297.1828 18.72567
-#>        eta.Cl       TKA      eta.Ka        Q      Kin     Kout     EC50
-#> 1  0.47805457 0.5717354 -0.01968098 10.79085 1.172023 1.645267 199.6726
-#> 2  0.13587628 0.5717354  0.36191935 10.79085 1.172023 1.645267 199.6726
-#> 3  0.46234600 0.5717354 -0.22213797 10.79085 1.172023 1.645267 199.6726
-#> 4 -0.01367034 0.5717354  0.54603539 10.79085 1.172023 1.645267 199.6726
-#> 5 -0.05675895 0.5717354 -0.33562398 10.79085 1.172023 1.645267 199.6726
-#> 6 -0.56596753 0.5717354  0.41054459 10.79085 1.172023 1.645267 199.6726
+#> 1 -0.003803654 -0.10875855 0.007812402 40.29161 296.3749 17.89706 +#> 2 0.040870705 0.04182948 0.093824939 40.29161 296.3749 17.89706 +#> 3 -0.055541424 -0.03764843 -0.001353899 40.29161 296.3749 17.89706 +#> 4 0.164971483 0.06685138 -0.160326180 40.29161 296.3749 17.89706 +#> 5 0.033599149 0.19445236 0.005788602 40.29161 296.3749 17.89706 +#> 6 0.087378394 -0.03946372 0.125610916 40.29161 296.3749 17.89706 +#> eta.Cl TKA eta.Ka Q Kin Kout EC50 +#> 1 -0.3446937 0.5746999 0.27666700 11.19831 1.625991 1.514061 199.5783 +#> 2 -0.2181176 0.5746999 -0.08547344 11.19831 1.625991 1.514061 199.5783 +#> 3 -0.3546153 0.5746999 0.08954298 11.19831 1.625991 1.514061 199.5783 +#> 4 -0.2663074 0.5746999 -0.28837020 11.19831 1.625991 1.514061 199.5783 +#> 5 -0.2453782 0.5746999 0.52587183 11.19831 1.625991 1.514061 199.5783 +#> 6 -0.1355534 0.5746999 -0.07475203 11.19831 1.625991 1.514061 199.5783

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 a3ff881a3..40c38aa9a 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 6f4bc30c1..1a6ef11b9 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 8f37c4508..bf95df0a5 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 b1521b935..5d0c3e3bc 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 9db4d0712..3720caf61 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.888 0.596 -0.461 -#> 2 2 0.451 1.02 3.45 0.642 0.188 0.0306 -#> 3 3 0.451 1.02 3.45 0.490 -1.43 -0.243 -#> 4 4 0.451 1.02 3.45 -0.336 1.32 -0.109 -#> 5 5 0.451 1.02 3.45 -0.644 0.566 -0.110 -#> 6 6 0.451 1.02 3.45 0.737 -0.317 -0.0479 -#> 7 7 0.451 1.02 3.45 0.713 -1.22 -0.288 -#> 8 8 0.451 1.02 3.45 1.61 0.822 0.530 -#> 9 9 0.451 1.02 3.45 1.16 0.162 -0.450 -#> 10 10 0.451 1.02 3.45 -0.544 0.184 0.0566 -#> 11 11 0.451 1.02 3.45 0.299 -0.129 -0.0657 -#> 12 12 0.451 1.02 3.45 -1.40 0.414 0.269 +#> 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.0812 -0.169 0.306 +#> 2 2 0.451 1.02 3.45 -0.0174 0.223 0.489 +#> 3 3 0.451 1.02 3.45 -0.127 -0.0797 -0.0898 +#> 4 4 0.451 1.02 3.45 0.508 0.331 0.927 +#> 5 5 0.451 1.02 3.45 -0.396 -0.650 0.402 +#> 6 6 0.451 1.02 3.45 1.43 -0.474 0.00806 +#> 7 7 0.451 1.02 3.45 -1.06 -0.647 -0.348 +#> 8 8 0.451 1.02 3.45 -1.44 -0.311 0.145 +#> 9 9 0.451 1.02 3.45 0.117 -0.552 0.343 +#> 10 10 0.451 1.02 3.45 1.17 0.0488 0.491 +#> 11 11 0.451 1.02 3.45 -0.240 -0.345 0.0744 +#> 12 12 0.451 1.02 3.45 -0.915 0.103 0.0215 #> ── 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 3.82 5.02 19.9 0 320. 0 -#> 2 1 0.25 3.82 5.02 19.9 9.56 123. 190. -#> 3 1 0.57 3.82 5.02 19.9 13.0 36.3 258. -#> 4 1 1.12 3.82 5.02 19.9 12.8 4.45 253. -#> 5 1 2.02 3.82 5.02 19.9 10.4 0.143 206. -#> 6 1 3.82 3.82 5.02 19.9 6.57 0.000149 131. +#> id time ka cl v cp depot center +#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> +#> 1 1 0 1.70 2.34 42.7 0 320. 0 +#> 2 1 0.25 1.70 2.34 42.7 2.58 209. 110. +#> 3 1 0.57 1.70 2.34 42.7 4.57 121. 195. +#> 4 1 1.12 1.70 2.34 42.7 6.13 47.5 262. +#> 5 1 2.02 1.70 2.34 42.7 6.68 10.3 285. +#> 6 1 3.82 1.70 2.34 42.7 6.27 0.479 268. #> # ℹ 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.25 3.52 52.8 0 320. 0 -#> 2 1 0.25 1.25 3.52 52.8 1.61 234. 85.0 -#> 3 1 0.57 1.25 3.52 52.8 3.02 157. 160. -#> 4 1 1.12 1.25 3.52 52.8 4.36 79.0 230. -#> 5 1 2.02 1.25 3.52 52.8 5.08 25.7 268. -#> 6 1 3.82 1.25 3.52 52.8 4.91 2.72 259. -#> 7 1 5.1 1.25 3.52 52.8 4.55 0.550 240. -#> 8 1 7.03 1.25 3.52 52.8 4.01 0.0494 212. -#> 9 1 9.05 1.25 3.52 52.8 3.50 0.00397 185. -#> 10 1 12.1 1.25 3.52 52.8 2.86 0.0000859 151. +#> id time ka cl v cp depot center +#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> +#> 1 1 0 0.616 3.10 28.6 0 320. 0 +#> 2 1 0.25 0.616 3.10 28.6 1.58 274. 45.1 +#> 3 1 0.57 0.616 3.10 28.6 3.21 225. 91.7 +#> 4 1 1.12 0.616 3.10 28.6 5.22 160. 149. +#> 5 1 2.02 0.616 3.10 28.6 7.00 92.2 200. +#> 6 1 3.82 0.616 3.10 28.6 7.69 30.4 220. +#> 7 1 5.1 0.616 3.10 28.6 7.23 13.8 207. +#> 8 1 7.03 0.616 3.10 28.6 6.16 4.21 176. +#> 9 1 9.05 0.616 3.10 28.6 5.04 1.21 144. +#> 10 1 12.1 0.616 3.10 28.6 3.64 0.183 104. #> # ℹ 122 more rows data.table::data.table(solveData) -#> id time ka cl v cp depot center -#> 1: 1 0.00 1.248421 3.516781 52.77935 0.0000000 3.199920e+02 0.000000 -#> 2: 1 0.25 1.248421 3.516781 52.77935 1.6112563 2.342036e+02 85.041062 -#> 3: 1 0.57 1.248421 3.516781 52.77935 3.0221917 1.570707e+02 159.509312 -#> 4: 1 1.12 1.248421 3.516781 52.77935 4.3619302 7.904872e+01 230.219838 -#> 5: 1 2.02 1.248421 3.516781 52.77935 5.0837303 2.569984e+01 268.315979 -#> --- -#> 128: 12 5.07 1.433610 4.634286 22.61311 5.8420031 2.235634e-01 132.105861 -#> 129: 12 7.07 1.433610 4.634286 22.61311 3.8845279 1.271104e-02 87.841259 -#> 130: 12 9.03 1.433610 4.634286 22.61311 2.5999093 7.653600e-04 58.792036 -#> 131: 12 12.05 1.433610 4.634286 22.61311 1.4001488 1.008348e-05 31.661719 -#> 132: 12 24.15 1.433610 4.634286 22.61311 0.1172823 4.569805e-09 2.652117 +#> id time ka cl v cp depot center +#> 1: 1 0.00 0.6161300 3.098316 28.57109 0.0000000 3.199920e+02 0.000000 +#> 2: 1 0.25 0.6161300 3.098316 28.57109 1.5768176 2.743113e+02 45.051397 +#> 3: 1 0.57 0.6161300 3.098316 28.57109 3.2106330 2.252254e+02 91.731287 +#> 4: 1 1.12 0.6161300 3.098316 28.57109 5.2205712 1.604898e+02 149.157413 +#> 5: 1 2.02 0.6161300 3.098316 28.57109 7.0029152 9.217720e+01 200.080924 +#> --- +#> 128: 12 5.07 0.7474507 2.568545 16.74782 10.5246424 7.248343e+00 176.264827 +#> 129: 12 7.07 0.7474507 2.568545 16.74782 8.0231008 1.625588e+00 134.369455 +#> 130: 12 9.03 0.7474507 2.568545 16.74782 6.0023063 3.756358e-01 100.525552 +#> 131: 12 12.05 0.7474507 2.568545 16.74782 3.7919892 3.930361e-02 63.507556 +#> 132: 12 24.15 0.7474507 2.568545 16.74782 0.5932976 4.640341e-06 9.936442 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 ea796ab02..95b1796f1 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 d33084635..cc58e0660 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_48f49ff1bdb73275bf9c3d4f4f7a6d4b model ( ready). 
-#> DLL: /tmp/RtmpVppdYK/rxode2/rx_48f49ff1bdb73275bf9c3d4f4f7a6d4b__.rxd/rx_48f49ff1bdb73275bf9c3d4f4f7a6d4b_.so
+#> rxode2 2.0.14.9000 model named rx_db80e478121f8e784e2d30c54fcb1081 model ( ready). 
+#> DLL: /tmp/RtmpBVbnb0/rxode2/rx_db80e478121f8e784e2d30c54fcb1081__.rxd/rx_db80e478121f8e784e2d30c54fcb1081_.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_3eab9f1a7cd21d7e0c4190243c7f019a model ( ready). -#> DLL: /tmp/RtmpVppdYK/rxode2/rx_3eab9f1a7cd21d7e0c4190243c7f019a__.rxd/rx_3eab9f1a7cd21d7e0c4190243c7f019a_.so +#> rxode2 2.0.14.9000 model named rx_f983050b4d043a2d1bddc53cae8763af model ( ready). +#> DLL: /tmp/RtmpBVbnb0/rxode2/rx_f983050b4d043a2d1bddc53cae8763af__.rxd/rx_f983050b4d043a2d1bddc53cae8763af_.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_63d7d624d1370120af0f9008bf535be6 model ( ready). -#> DLL: /tmp/RtmpVppdYK/rxode2/rx_63d7d624d1370120af0f9008bf535be6__.rxd/rx_63d7d624d1370120af0f9008bf535be6_.so +#> rxode2 2.0.14.9000 model named rx_76abba9a614b701fe51948c96c81d359 model ( ready). +#> DLL: /tmp/RtmpBVbnb0/rxode2/rx_76abba9a614b701fe51948c96c81d359__.rxd/rx_76abba9a614b701fe51948c96c81d359_.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_c75664d6ede0dda7c3827e94125ef4ef model ( ready). -#> DLL: /tmp/RtmpVppdYK/rxode2/rx_c75664d6ede0dda7c3827e94125ef4ef__.rxd/rx_c75664d6ede0dda7c3827e94125ef4ef_.so +#> rxode2 2.0.14.9000 model named rx_248313db0b0e6bea5a35842a1e380bd0 model ( ready). +#> DLL: /tmp/RtmpBVbnb0/rxode2/rx_248313db0b0e6bea5a35842a1e380bd0__.rxd/rx_248313db0b0e6bea5a35842a1e380bd0_.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.81682 278.74905 288.89859 281.46215 284.61841 404.48874 -#> runSapply() 272.56090 278.64349 290.84184 281.62528 290.58622 398.81243 -#> runSingleThread() 26.99561 27.13204 27.74932 27.24601 27.36167 41.59049 -#> run2Thread() 15.83949 16.06777 17.14434 16.15578 16.38853 27.38163 +#> runFor() 273.36087 280.71252 290.49464 284.72726 289.38028 409.27682 +#> runSapply() 276.32420 283.62340 296.42514 287.06816 291.55511 437.66808 +#> runSingleThread() 27.51829 27.77083 28.47065 27.93337 28.26201 39.87901 +#> run2Thread() 16.35011 16.59553 17.71113 16.88060 17.39516 28.67465 #> 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) 27.05900 27.31811 29.19751 28.66136 28.87044 47.00146 100 -#> runThread(2) 15.94458 16.49794 19.08869 17.10799 20.58453 31.53423 100 -#> runThread(3) 17.32382 19.11146 19.78856 19.61431 20.10179 27.24244 100 -#> runThread(4) 15.49043 15.85613 17.41446 16.35305 16.62235 46.11001 100

+#> runThread(1) 27.63272 27.89356 29.22176 28.47336 29.27854 48.51933 100 +#> runThread(2) 16.43687 16.95996 19.19192 17.46009 20.66838 30.34426 100 +#> runThread(3) 17.73138 19.69827 20.25311 20.04284 20.74516 26.34111 100 +#> runThread(4) 16.15400 16.50777 18.65692 17.05824 17.78745 39.49936 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 188.9396 302.5346 309.2947 304.3297 312.9451 368.0733 100 -#> fastCompile 189.3077 302.9680 310.4792 307.2130 315.3269 369.2718 100 +#> standardCompile 190.8017 312.5958 323.3947 320.4098 332.6561 386.7279 100 +#> fastCompile 185.2849 307.3699 314.7468 310.4266 320.2949 369.1369 100 autoplot(bench)

@@ -764,7 +764,7 @@

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

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

@@ -805,7 +805,7 @@ 

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

+#> Time difference of 0.1119692 secs

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