rxode2 calculating derived PK model parameters

By Matthew Fidler in rxode2 nlmixr2

August 5, 2024

One of the things that can be useful from time to time is to calculate different PK parameters based on whatever parameters you have estimated.

There is a great function, calc_derived() in pmxTools that allows this calculation of the derived parameters (by my collaborators Justin Wilkins and Bill Denney).

I think this is an underrated function that can help many people with typical calculations.

rxode2 has the same type of function, which can be helpful to test the linCmt() functions, rxDerived().

You may notice that this does not have as many arguments as the calc_derived() this is because this uses the same method to detect the parameters that linCmt() does (described here).

There is both advantages and disadvantages to have the algorithm detect the variables. One of advantages is calculating does not require as much manual intervention (which I am for automation as much as possible), but the disadvantage is incorrect detection of the parameters.

Here are the examples from the manual:

## Note that rxode2 parses the names to figure out the best PK parameter
params <- rxDerived(cl = 29.4, v = 23.4, Vp = 114, vp2 = 4614, q = 270, q2 = 73)

print(params)
##     vc     kel      k12      k21      k13        k31  vp  vp2    vss   cl   q
## 1 23.4 1.25641 11.53846 2.368421 3.119658 0.01582141 114 4614 4751.4 29.4 270
##   q2   t12alpha  t12beta t12gamma   alpha      beta       gamma          A
## 1 73 0.03916129 1.165945 154.9193 17.6998 0.5944938 0.004474246 0.03827859
##             B            C    fracA     fracB       fracC
## 1 0.004346657 0.0001097954 0.895719 0.1017118 0.002569213
## That is why this gives the same results as the value before

params <- rxDerived(CL = 29.4, V1 = 23.4, V2 = 114, V3 = 4614, Q2 = 270, Q3 = 73)
print(params)
##     vc     kel      k12      k21      k13        k31  vp  vp2    vss   cl   q
## 1 23.4 1.25641 11.53846 2.368421 3.119658 0.01582141 114 4614 4751.4 29.4 270
##   q2   t12alpha  t12beta t12gamma   alpha      beta       gamma          A
## 1 73 0.03916129 1.165945 154.9193 17.6998 0.5944938 0.004474246 0.03827859
##             B            C    fracA     fracB       fracC
## 1 0.004346657 0.0001097954 0.895719 0.1017118 0.002569213
## You may also use micro-constants alpha/beta etc.

params <- rxDerived(k12 = 0.1, k21 = 0.2, k13 = 0.3, k31 = 0.4, kel = 10, v = 10)
print(params)
##   vc kel k12 k21 k13 k31 vp vp2  vss  cl q q2   t12alpha  t12beta t12gamma
## 1 10  10 0.1 0.2 0.3 0.4  5 7.5 22.5 100 1  3 0.06655954 1.785817 3.502186
##      alpha      beta     gamma          A            B            C     fracA
## 1 10.41394 0.3881401 0.1979185 0.09986136 0.0001169989 2.164562e-05 0.9986136
##         fracB        fracC
## 1 0.001169989 0.0002164562
## or you can mix vectors and scalars
params <- rxDerived(CL = 29.4, V = 1:3)
print(params)
##   vc  kel vss   cl   t12alpha alpha         A fracA
## 1  1 29.4   1 29.4 0.02357643  29.4 1.0000000     1
## 2  2 14.7   2 29.4 0.04715287  14.7 0.5000000     1
## 3  3  9.8   3 29.4 0.07072930   9.8 0.3333333     1
## If you want, you can round to a number of significant digits
## with the `digits` argument:

params <- rxDerived(CL = 29.4, V = 1:3, digits = 2)
print(params)
##   vc  kel vss cl t12alpha alpha    A fracA
## 1  1 29.0   1 29    0.024  29.0 1.00     1
## 2  2 15.0   2 29    0.047  15.0 0.50     1
## 3  3  9.8   3 29    0.071   9.8 0.33     1

Note that none of these show a data-frame, so an additional example of this is:

df <- data.frame(CL=1:10, V=20:29)

rxDerived(df)
##    vc       kel vss cl  t12alpha     alpha          A fracA
## 1  20 0.0500000  20  1 13.862944 0.0500000 0.05000000     1
## 2  21 0.0952381  21  2  7.278045 0.0952381 0.04761905     1
## 3  22 0.1363636  22  3  5.083079 0.1363636 0.04545455     1
## 4  23 0.1739130  23  4  3.985596 0.1739130 0.04347826     1
## 5  24 0.2083333  24  5  3.327106 0.2083333 0.04166667     1
## 6  25 0.2400000  25  6  2.888113 0.2400000 0.04000000     1
## 7  26 0.2692308  26  7  2.574547 0.2692308 0.03846154     1
## 8  27 0.2962963  27  8  2.339372 0.2962963 0.03703704     1
## 9  28 0.3214286  28  9  2.156458 0.3214286 0.03571429     1
## 10 29 0.3448276  29 10  2.010127 0.3448276 0.03448276     1

This is not really present in calc_derived() and not all the same parameters are output (rxode2 seems to have the microconstants but calc_derived() does not seem to have these yet)

Regardless of which you use, these functions are generally useful for doing PK translations and can save you from doing these by hand.

Notes

The icon comes from here

Posted on:
August 5, 2024
Length:
4 minute read, 744 words
Categories:
rxode2 nlmixr2
Tags:
mu
See Also:
nlmixr2/rxode2 mu referencing 2.0