knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(RxODE)

Single Subject solving

Originally, RxODE was only created to solve ODEs for one individual. That is a single system without any changes in individual parameters.

Of course this is still supported, the classic examples are found in RxODE intro.

This article discusses the differences between multiple subject and single subject solving. There are three differences:

The first obvious difference is in speed; With multiple subjects you can run each subject ID in parallel. For more information and examples of the speed gains with multiple subject solving see the Speeding up RxODE vignette.

The next difference is the amount of information output in the final data.

Taking the 2 compartment indirect response model originally in the tutorial:

mod1 <-RxODE({
    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;
    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
});

et <- et(amount.units='mg', time.units='hours') %>%
    et(dose=10000, addl=9, ii=12) %>%
    et(amt=20000, nbr.doses=5, start.time=120, dosing.interval=24) %>%
    et(0:240) # sampling

Now a simple solve

x <- rxSolve(mod1, et)
x

print(x)

plot(x, C2, eff)

To better see the differences between the single solve, you can solve for 2 individuals

x2 <- rxSolve(mod1, et %>% et(id=1:2), params=data.frame(CL=c(18.6, 7.6)))
print(x2)

plot(x2, C2, eff)

By observing the two solves, you can see:

The last feature that is not as obvious, modifying the individual parameters. For single subject data, you can modify the RxODE data frame changing initial conditions and parameter values as if they were part of the data frame, as described in the RxODE Data Frames.

For multiple subject solving, this feature still works, but requires care when supplying each individual's parameter value, otherwise you may change the solve and drop parameter for key individuals.

Summary of Single solve vs Multiple subject solving

| Feature | Single Subject Solve | Multiple Subject Solve | |-------------|------------------------------------------------|-----------------------------------------------------------| | Parallel | None | Each Subject | | $params | data.frame with one parameter value | data.frame with one parameter per subject (w/ID column) | | solved data | Can modify individual parameters with $ syntax | Have to modify all the parameters to update solved object |

Session Information

The session information:

sessionInfo()


nlmixrdevelopment/RxODE.doc documentation built on Oct. 17, 2019, 1:27 a.m.