Simulx is a function of the R package mlxR. Simulx allows one to simulate complex models for longitudinal data by interfacing the C++ MlxLibrary with R.

Implementing complex ODEs based mixed effects models becomes extremely easy using the model coding language Mlxtran.

Example: \[ \begin{align} \dot{f}(t) &= -\frac{k \, f(t)}{c+f(t)} \quad \quad \quad \ \ ; \quad f(0) = A \\ y_{ij} &= f(t_{ij} ; k_i, c) + a\, \varepsilon_{ij} \quad ; \quad \varepsilon_{ij} \mathop{\sim}_{\rm i.i.d.} {\cal N}(0,1)\\ k_i &= k_{\rm pop} \, e^{\eta_{i}} \quad \quad \quad \quad \quad \ ; \quad \eta_{i} \mathop{\sim}_{\rm i.i.d.} {\cal N}(0,\omega^2) \end{align} \] This model is implemented as home.txt:
input = {A, k, c, a}
t0    = 0 
f_0   = A
ddt_f = -k*f/(c+f)
y = {distribution=normal, prediction=f, sd=a}

input = {k_pop, omega}
k = {distribution=lognormal, prediction=k_pop, sd=omega}

Then, home.txt can be used as a R function thanks to Simulx.

f <- list(name='f', time=seq(0, 30, by=0.1))
y <- list(name='y', time=seq(0, 30, by=2))

res <- simulx(model     = 'model/home.txt', 
              parameter = c(A=100, k_pop=6, omega=0.3, c=10, a=1), 
              output    = list(f,y),
              group     = list(size=4, level='individual'))

ggplot() + geom_line(data=res$f, aes(x=time, y=f, color=id)) + geom_point(data=res$y, aes(x=time, y=y, color=id))