How can I modify the rxode2
model structure at a lower level than the piping interface?
#271
-
For the common case of changing the model structure one line at a time or adding/modifying the initial estimates, I know how to do that with I want to dive deeper into the model. Specifically, for How can I make such modifications? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 13 replies
-
However, in theory if you wanted to, you could
This is what is done in a similar function in This is an example of how it works: And this is the code: |
Beta Was this translation helpful? Give feedback.
-
Hi Matt and Bill, I am very excited to get started with the newly released rxode2 and nlmixr2. I am particularly interested in testing model modification via piping functionality. Do I understand correctly that rxode2 objects can now be modified via piping as well as nlmixr2 objects (available in the previous releases)? What is the right syntaxis? Lets take a simple 2cmt model (specified below) as an example. Lets say I would like to add inter individual variability to CL parameter (CL = tvCL*exp(eta.CL)). What is the right way of doing this? I tried first: so tried to use functionality of addding a line %>% model(lines, append=TRUE): Will be really nice to have an example with rxode2 model modification via piping. ode2cmp <- rxode2({ #model |
Beta Was this translation helpful? Give feedback.
-
@mattfidler Hi Matt, Let me follow up on rxode2 model modification via piping. I have the latest rxode2 2.0.11 from CRAN and would like to make a change in model equations. Lets take a simple 1cmt model example. My goal is to change definition of cl parameter. ocmt_rx0 <- rxode2( { ocmt_rx1 <- rxode2( { ocmt_rx2 <- rxode2( { Dosing and parameters: ocmt_rx0 %>% model( cl <- tvcl*2, append = TRUE ) %>% ocmt_rx1 %>% model( cl <- tvcl*2 ) %>% Is it possible to specify a position in the model code where equation is inserted via model piping? |
Beta Was this translation helpful? Give feedback.
fit$fun
is a calculated object, so in essence it is read-only.However, in theory if you wanted to, you could
This is what is done in a similar function in
nlmixr2est
. Thisuses aui$iniDf
and a quoted model block to produce a new ui object.This is an example of how it works:
https://github.com/nlmixr2/nlmixr2extra/blob/cb1c507f217bd208e003cfe1a461c6bb69bb027b/R/precondition.R#L73-L75
And this is the code:
https://github.com/nlmixr2/nlmixr2extra/blob/cb1c507f217bd208e003cfe1a461c6bb69bb027b/R/precondition.R#L6-L19