-
Notifications
You must be signed in to change notification settings - Fork 1
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
object 'lag(depot2)' not found - When trying to create NONMEM export #149
Comments
Probably an error
…On Fri, Dec 20, 2024, 5:47 PM John Harrold ***@***.***> wrote:
In the example below I'm trying to convert a model from the nlmixr2lib
model library into NONMEM. It's giving me an error that suggests it doesn't
understand the lag portion of the model. Is there something I'm doing wrong?
rm(list=ls())
library(rxode2)#> rxode2 3.0.3 using 1 threads (see ?getRxThreads)#> no cache: create with `rxCreateCache()`#> ========================================#> rxode2 has not detected OpenMP support and will run in single-threaded mode#> This is a Mac. Please read https://mac.r-project.org/openmp/#> ========================================
library(nlmixr2)#> Loading required package: nlmixr2data
rx_fun = function() {
description <- "PK double absorption model with simultaneous zero order and first order absorptions"
ini({
tk01 <- 0.4
label("Zero order absorption rate from first site (K01)")
lka2 <- 0.45
label("First order Absorption rate (Ka)")
lcl <- 1
label("Clearance (CL)")
lvc <- 3
label("Central volume of distribution (V)")
propSd <- c(0, 0.5)
label("Proportional residual error (fraction)")
lgfdepot1 <- 1.38629436111989
lalag <- 2.19722457733622
TV_PAR <- 0.1
ETA.PAR ~ 1
})
model({
POP_PAR <- exp(TV_PAR + ETA.PAR)
k01 <- exp(tk01)
ka2 <- exp(lka2)
cl <- exp(lcl)
vc <- exp(lvc)
fdepot1 <- expit(lgfdepot1, 0, 1)
alag <- exp(lalag)
kel <- cl/vc
d/dt(depot1) <- -k01
f(depot1) <- fdepot1
d/dt(depot2) <- -ka2 * depot2
lag(depot2) <- alag
f(depot2) <- 1 - fdepot1
d/dt(central) <- k01 + ka2 * depot2 - kel * central
Cc <- central/vc
Cc ~ prop(propSd)
})
}
rx_obj = rxode2::rxode2(rx_fun)#> ℹ parameter labels from comments are typically ignored in non-interactive mode#> ℹ Need to run with the source intact to parse commentsdataset = data.frame(
id = c(1L, 1L, 2L, 2L),
time = c(0, 1, 0, 1),
cmt = c("Cc", "Cc", "Cc", "Cc"),
evid = c(0L, 0L, 0L, 0L),
dv = c(0, 0, 0, 0))
res = nlmixr2::nlmixr2(rx_obj, dataset, "nonmem", babelmixr2::nonmemControl(modelName="test_nm", runCommand=NA))#> → loading into symengine environment...#> → pruning branches (`if`/`else`) of full model...#> ✔ done#> Error in get(.tmp, envir = rxUiGetNonememModelEnv$rxS) : #> object 'lag(depot2)' not found#> Error: object 'lag(depot2)' not found
sessionInfo()#> R version 4.4.1 (2024-06-14)#> Platform: aarch64-apple-darwin20#> Running under: macOS Sonoma 14.7.1#> #> Matrix products: default#> BLAS: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib #> LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0#> #> locale:#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8#> #> time zone: America/Los_Angeles#> tzcode source: internal#> #> attached base packages:#> [1] stats graphics grDevices utils datasets methods base #> #> other attached packages:#> [1] nlmixr2_3.0.1.9000 nlmixr2data_2.0.9 rxode2_3.0.3 #> #> loaded via a namespace (and not attached):#> [1] generics_0.1.3 lattice_0.22-6 digest_0.6.37 #> [4] magrittr_2.0.3 nonmem2rx_0.1.6 evaluate_1.0.1 #> [7] grid_4.4.1 fastmap_1.2.0 lotri_1.0.0 #> [10] backports_1.5.0 nlmixr2est_3.0.2 scales_1.3.0 #> [13] lazyeval_0.2.2 RApiSerialize_0.1.4 cli_3.6.3 #> [16] crayon_1.5.3 symengine_0.2.6 rlang_1.1.4 #> [19] units_0.8-5 monolix2rx_0.0.4 munsell_0.5.1 #> [22] reprex_2.1.1 withr_3.0.2 cachem_1.1.0 #> [25] yaml_2.3.10 tools_4.4.1 qs_0.27.2 #> [28] nlmixr2plot_3.0.0 lbfgsb3c_2024-3.5 memoise_2.0.1 #> [31] checkmate_2.3.2 dplyr_1.1.4 colorspace_2.1-1 #> [34] ggplot2_3.5.1 n1qn1_6.0.1-12 vctrs_0.6.5 #> [37] R6_2.5.1 lifecycle_1.0.4 fs_1.6.5 #> [40] stringfish_0.16.0 PreciseSums_0.7 pkgconfig_2.0.3 #> [43] rex_1.2.1 RcppParallel_5.1.9 pillar_1.10.0 #> [46] gtable_0.3.6 data.table_1.16.4 glue_1.8.0 #> [49] Rcpp_1.0.13-1 xfun_0.49 tibble_3.2.1 #> [52] tidyselect_1.2.1 sys_3.4.3 knitr_1.49 #> [55] babelmixr2_0.1.5.9000 dparser_1.3.1-13 htmltools_0.5.8.1 #> [58] nlme_3.1-166 rmarkdown_2.29 compiler_4.4.1
—
Reply to this email directly, view it on GitHub
<#149>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD5VWQF34QRHVNNLEMJWGT2GST73AVCNFSM6AAAAABUAAPTR6VHI2DSMVQWIX3LMV43ASLTON2WKOZSG42TGNRUGAYTSOI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the example below I'm trying to convert a model from the nlmixr2lib model library into NONMEM. It's giving me an error that suggests it doesn't understand the lag portion of the model. Is there something I'm doing wrong?
The text was updated successfully, but these errors were encountered: