Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development Idea: Library of model snippets and model expansion #541

Closed
billdenney opened this issue Jul 2, 2021 · 4 comments
Closed

Development Idea: Library of model snippets and model expansion #541

billdenney opened this issue Jul 2, 2021 · 4 comments

Comments

@billdenney
Copy link
Contributor

Somewhat related to #540

To be very clear from the outset, I think that this would likely reside in another package than nlmixr, but it would be very tightly related. One common naming syntax for packages like this is something like nlmixrExtra.

My thought here is something like an nlmixr_tran() function that would perform pre-processing of models to expand commonly-used model structures.

library(nlmixrExtra)
onecmt <- function() {
  ini({
    lCl <- 1.6
    lVc <- log(18)
    lVmax <- log(0.1)
    lC50 <- log(100)
    eta_Cl ~ 0.1
    prop_err <- c(0, 0.2, 1)
  })
  model({
    Cl <- exp(lCl + eta_Cl)
    Vc <- exp(lVc)
    Vmax <- exp(lVmax)
    mm_c50 <- exp(lC50)
    cp <- TMDD_Michaelis_Menten(CL=Cl, Vc=Vc, Vmax=Vmax, C50=mm_c50, compartment=central)
    cp ~ prop(prop_err)
  })
}
onecmt_expanded <- nlmixr_tran(onecmt)

nlmixr_tran() would modify the model and return that modified model (or perhaps go ahead and call nlmixr with that modified model if estimate=TRUE or something like that).

The output of onecmt_expanded would expand out the linear_pk() function to look like:

function() {
  ini({
    lCl <- 1.6
    lVc <- log(18)
    lVmax <- log(0.1)
    lC50 <- log(100)
    eta_Cl ~ 0.1
    prop_err <- c(0, 0.2, 1)
  })
  model({
    Cl <- exp(lCl + eta_Cl)
    Vc <- exp(lVc)
    Vmax <- exp(lVmax)
    mm_c50 <- exp(lC50)
    d/dt(central) = -central*Cl/Vc - central*Vmax/(central/Vc + mm_c50)
    cp <- central/Vc
    cp ~ prop(prop_err)
  })
}

With an expansion mechanism (as suggested with nlmixr_trans()), it would be comparatively straight-forward to make the substitution functions like TMDD_Michaelis_Menten().

@mattfidler
Copy link
Contributor

I think this is a fine idea!

@billdenney
Copy link
Contributor Author

Great! Do you think it's reasonable to create an nlmixrExtra package under the nlmixrdevelopment aegis here on GitHub?

@mattfidler
Copy link
Contributor

Sounds fine to me. Created it.

@billdenney
Copy link
Contributor Author

And, now it's there! https://github.com/nlmixrdevelopment/nlmixrExtra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants