diff --git a/LICENSE.html b/LICENSE.html index 5eb0e89..21e825d 100644 --- a/LICENSE.html +++ b/LICENSE.html @@ -42,7 +42,7 @@
diff --git a/articles/convert-nlmixr2.html b/articles/convert-nlmixr2.html index 347b7aa..8cd78c6 100644 --- a/articles/convert-nlmixr2.html +++ b/articles/convert-nlmixr2.html @@ -76,7 +76,7 @@

Converting Monolix fit to nlmixr2 fit

- Source: vignettes/articles/convert-nlmixr2.Rmd + Source: vignettes/articles/convert-nlmixr2.Rmd
convert-nlmixr2.Rmd
diff --git a/articles/create-augPred.html b/articles/create-augPred.html index 94ec023..ec35a27 100644 --- a/articles/create-augPred.html +++ b/articles/create-augPred.html @@ -76,7 +76,7 @@

Created Augmented pred/ipred plots with `augPred()`

- Source: vignettes/articles/create-augPred.Rmd + Source: vignettes/articles/create-augPred.Rmd
create-augPred.Rmd
@@ -156,7 +156,7 @@

Step 2: convert the rx #> ── Time (sec fit$time): ── #> #> setup optimize covariance table compress as.nlmixr2 -#> elapsed 0.031719 4e-06 5e-06 0.055 0.006 2.039 +#> elapsed 0.031842 4e-06 5e-06 0.056 0.007 2.091 #> #> ── Population Parameters (fit$parFixed or fit$parFixedDf): ── #> diff --git a/articles/create-office.html b/articles/create-office.html index 7f36e09..63c2a70 100644 --- a/articles/create-office.html +++ b/articles/create-office.html @@ -76,7 +76,7 @@

Create PowerPoint and Word documents using monolix2rx

- Source: vignettes/articles/create-office.Rmd + Source: vignettes/articles/create-office.Rmd
create-office.Rmd
diff --git a/articles/create-vpc.html b/articles/create-vpc.html index 9109631..e12b917 100644 --- a/articles/create-vpc.html +++ b/articles/create-vpc.html @@ -76,7 +76,7 @@

Easily Create a VPC using monolix2rx

- Source: vignettes/articles/create-vpc.Rmd + Source: vignettes/articles/create-vpc.Rmd
create-vpc.Rmd
@@ -153,7 +153,7 @@

Step 2: convert the rx #> ── Time (sec fit$time): ── #> #> setup optimize covariance table compress as.nlmixr2 -#> elapsed 0.031406 5e-06 6e-06 0.054 0.005 2.023 +#> elapsed 0.032426 5e-06 6e-06 0.056 0.006 2.139 #> #> ── Population Parameters (fit$parFixed or fit$parFixedDf): ── #> diff --git a/articles/mod-PowerPoint.pptx b/articles/mod-PowerPoint.pptx index 1c8166e..b8f19ac 100644 Binary files a/articles/mod-PowerPoint.pptx and b/articles/mod-PowerPoint.pptx differ diff --git a/articles/mod-Word.docx b/articles/mod-Word.docx index 349d7b7..8fb4178 100644 Binary files a/articles/mod-Word.docx and b/articles/mod-Word.docx differ diff --git a/articles/rxode2-validate.html b/articles/rxode2-validate.html index e75a532..a665837 100644 --- a/articles/rxode2-validate.html +++ b/articles/rxode2-validate.html @@ -76,7 +76,7 @@

Qualify rxode2 model against Monolix

- Source: vignettes/articles/rxode2-validate.Rmd + Source: vignettes/articles/rxode2-validate.Rmd
rxode2-validate.Rmd
diff --git a/articles/simulate-extra-items.html b/articles/simulate-extra-items.html index 0b9fbd6..465fb8e 100644 --- a/articles/simulate-extra-items.html +++ b/articles/simulate-extra-items.html @@ -76,7 +76,7 @@

Simulate Derived Variables from imported Monolix model

- Source: vignettes/articles/simulate-extra-items.Rmd + Source: vignettes/articles/simulate-extra-items.Rmd
simulate-extra-items.Rmd
diff --git a/articles/simulate-new-dosing.html b/articles/simulate-new-dosing.html index 350cbb1..2bac567 100644 --- a/articles/simulate-new-dosing.html +++ b/articles/simulate-new-dosing.html @@ -76,7 +76,7 @@

Simulate New dosing from Monolix model

- Source: vignettes/articles/simulate-new-dosing.Rmd + Source: vignettes/articles/simulate-new-dosing.Rmd
simulate-new-dosing.Rmd
diff --git a/articles/simulate-uncertainty.html b/articles/simulate-uncertainty.html index dbbbfd4..d702c30 100644 --- a/articles/simulate-uncertainty.html +++ b/articles/simulate-uncertainty.html @@ -76,7 +76,7 @@

Simulate using Parameter Uncertainty

- Source: vignettes/articles/simulate-uncertainty.Rmd + Source: vignettes/articles/simulate-uncertainty.Rmd
simulate-uncertainty.Rmd
diff --git a/authors.html b/authors.html index 91fa344..526306e 100644 --- a/authors.html +++ b/authors.html @@ -59,7 +59,7 @@

Authors

Citation

-

Source: DESCRIPTION

+

Source: DESCRIPTION

Fidler M (2024). monolix2rx: Converts 'Monolix' Models to 'rxode2'. diff --git a/bad-library.html b/bad-library.html index edf1588..05ea0e8 100644 --- a/bad-library.html +++ b/bad-library.html @@ -42,7 +42,7 @@

diff --git a/news/index.html b/news/index.html index 8a9d273..7df33f2 100644 --- a/news/index.html +++ b/news/index.html @@ -42,11 +42,11 @@
-

monolix2rx 0.0.4

+

monolix2rx 0.0.4

CRAN release: 2024-11-28

  • Added ignoreline support #22
diff --git a/pkgdown.yml b/pkgdown.yml index dcd3418..5679b05 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -10,4 +10,4 @@ articles: articles/simulate-extra-items: simulate-extra-items.html articles/simulate-new-dosing: simulate-new-dosing.html articles/simulate-uncertainty: simulate-uncertainty.html -last_built: 2024-11-28T20:59Z +last_built: 2024-11-29T00:43Z diff --git a/reference/autoplot.monolix2rx.html b/reference/autoplot.monolix2rx.html index 883d1eb..c768bc2 100644 --- a/reference/autoplot.monolix2rx.html +++ b/reference/autoplot.monolix2rx.html @@ -42,7 +42,7 @@
diff --git a/reference/dot-getNbdoses.html b/reference/dot-getNbdoses.html index cd978b1..51674d8 100644 --- a/reference/dot-getNbdoses.html +++ b/reference/dot-getNbdoses.html @@ -42,7 +42,7 @@
diff --git a/reference/dot-getStiff.html b/reference/dot-getStiff.html index 22cc38c..d461da6 100644 --- a/reference/dot-getStiff.html +++ b/reference/dot-getStiff.html @@ -42,7 +42,7 @@
diff --git a/reference/dot-monolixGetMlxtran.html b/reference/dot-monolixGetMlxtran.html index 95769e9..ec67b4e 100644 --- a/reference/dot-monolixGetMlxtran.html +++ b/reference/dot-monolixGetMlxtran.html @@ -42,7 +42,7 @@
diff --git a/reference/mlxTxt.html b/reference/mlxTxt.html index 4f69e18..93d54e5 100644 --- a/reference/mlxTxt.html +++ b/reference/mlxTxt.html @@ -42,7 +42,7 @@
diff --git a/reference/mlxtran.html b/reference/mlxtran.html index 5f8652b..818c9b9 100644 --- a/reference/mlxtran.html +++ b/reference/mlxtran.html @@ -42,7 +42,7 @@
diff --git a/reference/monolix2rx.html b/reference/monolix2rx.html index cb8f0fa..f0fe9ff 100644 --- a/reference/monolix2rx.html +++ b/reference/monolix2rx.html @@ -42,7 +42,7 @@
@@ -248,11 +248,11 @@

Examples#> omega_V = -4.39519e-06, omega_Cl = -1.31481e-05, #> a = -0.000214637, b = 5.66332e-05) #> }) -#> validation <- c("ipred relative difference compared to Monolix ipred: 0.4%; 95% percentile: (0.02%,3.18%); rtol=0.00396", -#> "ipred absolute difference compared to Monolix ipred: 95% percentile: (8.49e-05, 0.166); atol=0.0175", +#> validation <- c("ipred relative difference compared to Monolix ipred: 0.39%; 95% percentile: (0.02%,3.18%); rtol=0.00394", +#> "ipred absolute difference compared to Monolix ipred: 95% percentile: (8.49e-05, 0.166); atol=0.0176", #> "pred relative difference compared to Monolix pred: 0%; 95% percentile: (0%,0%); rtol=1.21e-06", #> "pred absolute difference compared to Monolix pred: 95% percentile: (1.87e-08, 4.92e-05); atol=6.07e-06", -#> "iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.24%,204.01%); rtol=0.0818", +#> "iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.24%,204.01%); rtol=0.0794", #> "iwres absolute difference compared to Monolix pred: 95% percentile: (0.0026, 0.33); atol=0.0364") #> ini({ #> Tlag_pop <- -0.259498000083172 diff --git a/reference/reexports.html b/reference/reexports.html index 02c7141..bac676d 100644 --- a/reference/reexports.html +++ b/reference/reexports.html @@ -80,7 +80,7 @@
diff --git a/search.json b/search.json index 516a1fe..a03d211 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 monolix2rx authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"/articles/convert-nlmixr2.html","id":"creating-a-nlmixr2-compatible-model","dir":"Articles","previous_headings":"","what":"Creating a nlmixr2 compatible model","title":"Converting Monolix fit to nlmixr2 fit","text":"Unlike nonmem2rx, residuals specification can converted efficiently nlmixr2 residual syntax.","code":""},{"path":"/articles/convert-nlmixr2.html","id":"example","dir":"Articles","previous_headings":"","what":"Example","title":"Converting Monolix fit to nlmixr2 fit","text":"","code":"library(babelmixr2) # will re-export much of monolix2rx #> Loading required package: nlmixr2 #> Loading required package: nlmixr2data # You use the path to the monolix mlxtran file # In this case we will us the theophylline project included in monolix2rx pkgTheo <- system.file(\"theo/theophylline_project.mlxtran\", package=\"monolix2rx\") # Note you have to setup monolix2rx to use the model library or save the model as a separate file mod <- monolix2rx(pkgTheo) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning in .dataRenameFromMlxtran(data, .mlxtran): NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done print(mod) #> ── rxode2-based free-form 2-cmt ODE model ────────────────────────────────────── #> ── Initalization: ── #> Fixed Effects ($theta): #> ka_pop V_pop Cl_pop a b #> 0.42699448 -0.78635157 -3.21457598 0.43327956 0.05425953 #> #> Omega ($omega): #> omega_ka omega_V omega_Cl #> omega_ka 0.4503145 0.00000000 0.00000000 #> omega_V 0.0000000 0.01594701 0.00000000 #> omega_Cl 0.0000000 0.00000000 0.07323701 #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 depot #> 2 2 central #> ── μ-referencing ($muRefTable): ── #> theta eta level #> 1 ka_pop omega_ka id #> 2 V_pop omega_V id #> 3 Cl_pop omega_Cl id #> #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is extravascular with a first order absorption (rate constant ka).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\\nThis has been modified so that it will run without the model library\" #> dfObs <- 120 #> dfSub <- 12 #> thetaMat <- lotri({ #> ka_pop ~ 0.09785 #> V_pop ~ c(0.00082606, 0.00041937) #> Cl_pop ~ c(-4.2833e-05, -6.7957e-06, 1.1318e-05) #> omega_ka ~ c(omega_ka = 0.022259) #> omega_V ~ c(omega_ka = -7.6443e-05, omega_V = 0.0014578) #> omega_Cl ~ c(omega_ka = 3.062e-06, omega_V = -1.2912e-05, #> omega_Cl = 0.0039578) #> a ~ c(omega_ka = -0.0001227, omega_V = -6.5914e-05, omega_Cl = -0.00041194, #> a = 0.015333) #> b ~ c(omega_ka = -1.3886e-05, omega_V = -3.1105e-05, #> omega_Cl = 5.2805e-05, a = -0.0026458, b = 0.00056232) #> }) #> validation <- c(\"ipred relative difference compared to Monolix ipred: 0.04%; 95% percentile: (0%,0.52%); rtol=0.00038\", #> \"ipred absolute difference compared to Monolix ipred: 95% percentile: (0.000362, 0.00848); atol=0.00254\", #> \"pred relative difference compared to Monolix pred: 0%; 95% percentile: (0%,0%); rtol=6.6e-07\", #> \"pred absolute difference compared to Monolix pred: 95% percentile: (1.6e-07, 1.27e-05); atol=3.66e-06\", #> \"iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.06%,32.22%); rtol=0.0153\", #> \"iwres absolute difference compared to Monolix pred: 95% percentile: (0.000403, 0.0138); atol=0.00305\") #> ini({ #> ka_pop <- 0.426994483535611 #> V_pop <- -0.786351566327091 #> Cl_pop <- -3.21457597916301 #> a <- c(0, 0.433279557549051) #> b <- c(0, 0.0542595276206251) #> omega_ka ~ 0.450314511978718 #> omega_V ~ 0.0159470121255372 #> omega_Cl ~ 0.0732370098834837 #> }) #> model({ #> cmt(depot) #> cmt(central) #> ka <- exp(ka_pop + omega_ka) #> V <- exp(V_pop + omega_V) #> Cl <- exp(Cl_pop + omega_Cl) #> d/dt(depot) <- -ka * depot #> d/dt(central) <- +ka * depot - Cl/V * central #> Cc <- central/V #> CONC <- Cc #> CONC ~ add(a) + prop(b) + combined1() #> }) #> }"},{"path":"/articles/convert-nlmixr2.html","id":"converting-the-model-to-a-nlmixr2-fit","dir":"Articles","previous_headings":"Example","what":"Converting the model to a nlmixr2 fit","title":"Converting Monolix fit to nlmixr2 fit","text":"rxode2() model : Qualifies NONMEM model, nlmixr2 compatible residuals can convert nlmixr2 fit object babelmixr2:","code":"library(babelmixr2) fit <- as.nlmixr2(mod) #> → loading into symengine environment... #> → pruning branches (`if`/`else`) of full model... #> ✔ done #> → finding duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → optimizing duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → compiling EBE model... #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ✔ done #> rxode2 3.0.2.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()` #> → Calculating residuals/tables #> ✔ done #> → compress origData in nlmixr2 object, save 7168 #> ℹ monolix parameter history integrated into fit object # If you want you can use nlmixr2, to add cwres to this fit: fit <- addCwres(fit) #> → loading into symengine environment... #> → pruning branches (`if`/`else`) of full model... #> ✔ done #> → calculate jacobian #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → calculate sensitivities #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → calculate ∂(f)/∂(η) #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → calculate ∂(R²)/∂(η) #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → finding duplicate expressions in inner model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → optimizing duplicate expressions in inner model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → finding duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → optimizing duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → compiling inner model... #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ✔ done #> → finding duplicate expressions in FD model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → optimizing duplicate expressions in FD model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → compiling EBE model... #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ✔ done #> → compiling events FD model... #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ✔ done #> → Calculating residuals/tables #> ✔ done library(ggplot2) ggplot(fit, aes(PRED, CWRES)) + geom_point() + rxode2::rxTheme()"},{"path":"/articles/create-augPred.html","id":"step-1-convert-the-monolix-model-to-rxode2","dir":"Articles","previous_headings":"","what":"Step 1: Convert the Monolix model to rxode2:","title":"Created Augmented pred/ipred plots with `augPred()`","text":"","code":"library(monolix2rx) # First we need the location of the monolix mlxtran file. Since we are # running an example, we will use one of the built-in examples in # `monolix2rx` pkgTheo <- system.file(\"theo/theophylline_project.mlxtran\", package=\"monolix2rx\") # You can use a control stream or other file. With the development # version of `babelmixr2`, you can simply point to the listing file mod <- monolix2rx(pkgTheo) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning in .dataRenameFromMlxtran(data, .mlxtran): NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done"},{"path":"/articles/create-augPred.html","id":"step-2-convert-the-rxode2-model-to-nlmixr2","dir":"Articles","previous_headings":"","what":"Step 2: convert the rxode2 model to nlmixr2","title":"Created Augmented pred/ipred plots with `augPred()`","text":"can convert model, mod, nlmixr2 fit object:","code":"library(babelmixr2) # provides as.nlmixr2 #> Loading required package: nlmixr2 #> Loading required package: nlmixr2data fit <- as.nlmixr2(mod) #> → loading into symengine environment... #> → pruning branches (`if`/`else`) of full model... #> ✔ done #> → finding duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → optimizing duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → compiling EBE model... #> ✔ done #> rxode2 3.0.2.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()` #> → Calculating residuals/tables #> ✔ done #> → compress origData in nlmixr2 object, save 7168 #> ℹ monolix parameter history integrated into fit object fit #> ── nlmixr² monolix2rx reading Monolix ver 5.1.1 ── #> #> OBJF AIC BIC Log-likelihood Condition#(Cov) #> monolix 118.9368 355.482 377.7819 -169.741 21.26161 #> Condition#(Cor) #> monolix 1.383153 #> #> ── Time (sec fit$time): ── #> #> setup optimize covariance table compress as.nlmixr2 #> elapsed 0.031719 4e-06 5e-06 0.055 0.006 2.039 #> #> ── Population Parameters (fit$parFixed or fit$parFixedDf): ── #> #> Est. SE %RSE Back-transformed(95%CI) BSV(CV%) Shrink(SD)% #> ka_pop 0.427 0.204 47.8 1.53 (1.03, 2.29) 75.4 1.05% #> V_pop -0.786 0.045 5.72 0.456 (0.417, 0.497) 12.7 13.3% #> Cl_pop -3.21 0.0837 2.61 0.0402 (0.0341, 0.0473) 27.6 2.65% #> a 0.433 0.433 #> b 0.0543 0.0543 #> #> Covariance Type (fit$covMethod): monolix2rx #> No correlations in between subject variability (BSV) matrix #> Full BSV covariance (fit$omega) or correlation (fit$omegaR; diagonals=SDs) #> Distribution stats (mean/skewness/kurtosis/p-value) available in fit$shrink #> Censoring (fit$censInformation): No censoring #> Minimization message (fit$message): #> IPRED relative difference compared to Monolix IPRED: 0.04%; 95% percentile: (0%,0.52%); rtol=0.000379 #> PRED relative difference compared to Monolix PRED: 0%; 95% percentile: (0%,0%); rtol=4.94e-07 #> IPRED absolute difference compared to Monolix IPRED: atol=0.00253; 95% percentile: (0.000364, 0.00848) #> PRED absolute difference compared to Monolix PRED: atol=4.94e-07; 95% percentile: (1.13e-08, 0.000308) #> #> ── Fit Data (object fit is a modified tibble): ── #> # A tibble: 120 × 20 #> ID TIME DV PRED RES IPRED IRES IWRES omega_ka omega_V #> #> 1 1 0.25 2.84 2.78 0.0636 3.73 -0.887 -1.40 0.132 -0.183 #> 2 1 0.57 6.57 5.00 1.57 6.57 0.00239 0.00303 0.132 -0.183 #> 3 1 1.12 10.5 6.80 3.70 8.75 1.75 1.93 0.132 -0.183 #> # ℹ 117 more rows #> # ℹ 10 more variables: omega_Cl , CONC , depot , central , #> # ka , V , Cl , Cc , tad , dosenum "},{"path":"/articles/create-augPred.html","id":"step-3-create-and-plot-an-augmented-prediction","dir":"Articles","previous_headings":"","what":"Step 3: Create and plot an augmented prediction","title":"Created Augmented pred/ipred plots with `augPred()`","text":"","code":"ap <- augPred(fit) #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ head(ap) #> values ind id time Endpoint #> 1 0.000000 Individual 1 0.000 depot #> 2 3.726962 Individual 1 0.250 depot #> 3 6.030526 Individual 1 0.493 depot #> 4 6.567601 Individual 1 0.570 depot #> 5 8.414706 Individual 1 0.986 depot #> 6 8.746028 Individual 1 1.120 depot # This augpred looks odd: plot(ap)"},{"path":"/articles/create-office.html","id":"step-1-import-the-model-into-monolix2rx","dir":"Articles","previous_headings":"","what":"Step 1: import the model into monolix2rx","title":"Create PowerPoint and Word documents using monolix2rx","text":"","code":"library(monolix2rx) library(babelmixr2) #> Loading required package: nlmixr2 #> Loading required package: nlmixr2data library(nlmixr2rpt) library(onbrand) library(nonmem2rx) # First we need the location of the monolix mlxtran file. Since we are # running an example, we will use one of the built-in examples in # `monolix2rx` pkgTheo <- system.file(\"theo/theophylline_project.mlxtran\", package=\"monolix2rx\") # You can use a control stream or other file. With the development # version of `babelmixr2`, you can simply point to the listing file mod <- monolix2rx(pkgTheo) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning in .dataRenameFromMlxtran(data, .mlxtran): NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done"},{"path":"/articles/create-office.html","id":"step-2-convert-the-rxode2-model-to-nlmixr2","dir":"Articles","previous_headings":"","what":"Step 2: convert the rxode2 model to nlmixr2","title":"Create PowerPoint and Word documents using monolix2rx","text":"can convert model, mod, nlmixr2 fit object: cmt(depot)cmt(central)ka=exp(ka_pop+omega_ka)V=exp(V_pop+omega_V)Cl=exp(Cl_pop+omega_Cl)ddepotdt=−ka×depotdcentraldt=+ka×depot−ClV×centralCc=centralVCONC=CcCONC∼add()+prop(b)+combined1()\\begin{align*} cmt({depot}) \\\\ cmt({central}) \\\\ {ka} & = \\exp\\left({ka\\_pop}+{omega\\_ka}\\right) \\\\ {V} & = \\exp\\left({V\\_pop}+{omega\\_V}\\right) \\\\ {Cl} & = \\exp\\left({Cl\\_pop}+{omega\\_Cl}\\right) \\\\ \\frac{d \\: depot}{dt} & = -{ka} {\\times} {depot} \\\\ \\frac{d \\: central}{dt} & = +{ka} {\\times} {depot}-\\frac{{Cl}}{{V}} {\\times} {central} \\\\ {Cc} & = \\frac{{central}}{{V}} \\\\ {CONC} & = {Cc} \\\\ {CONC} & \\sim add({})+prop({b})+combined1() \\end{align*}","code":"fit <- as.nlmixr2(mod) #> → loading into symengine environment... #> → pruning branches (`if`/`else`) of full model... #> ✔ done #> → finding duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → optimizing duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → compiling EBE model... #> ✔ done #> rxode2 3.0.2.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()` #> → Calculating residuals/tables #> ✔ done #> → compress origData in nlmixr2 object, save 7168 #> ℹ monolix parameter history integrated into fit object fit"},{"path":"/articles/create-office.html","id":"step-3-create-a-powerpoint-file","dir":"Articles","previous_headings":"","what":"Step 3: Create a PowerPoint file","title":"Create PowerPoint and Word documents using monolix2rx","text":"PowerPoint can created custom powerpoint templates, example use ones come nlmixr2rpt directly: gives powerpoint ","code":"obnd_pptx = read_template( template = system.file(package=\"nlmixr2rpt\", \"templates\",\"nlmixr_obnd_template.pptx\"), mapping = system.file(package=\"nlmixr2rpt\", \"templates\",\"nlmixr_obnd_template.yaml\")) obnd_pptx = report_fit( fit = fit, obnd = obnd_pptx) #> #> Attaching package: 'xpose' #> The following object is masked from 'package:stats': #> #> filter #> Registered S3 method overwritten by 'GGally': #> method from #> +.gg ggplot2 #> #> Attaching package: 'ggPMX' #> The following object is masked from 'package:xpose': #> #> get_data #> → Calculating residuals/tables #> ✔ done #> Warning in xpose.nlmixr2::xpose_data_nlmixr(fit): Added CWRES to fit (using #> nlmixr2::addCwres)... #> Skipping table: skip_table (NA found, not generated) #> Skipping figure: res_vs_pred_idv (NA found, not generated) #> Skipping figure: eta_cont (NA found, not generated) #> Skipping figure: eta_cat (NA found, not generated) #> Skipping figure: skip_figure (NA found, not generated) save_report(obnd_pptx, \"mod-PowerPoint.pptx\") #> $isgood #> [1] TRUE #> #> $msgs #> NULL"},{"path":"/articles/create-office.html","id":"step-4-create-a-word-file","dir":"Articles","previous_headings":"","what":"Step 4: Create a Word file","title":"Create PowerPoint and Word documents using monolix2rx","text":"Just like PowerPoint, can customizeown custom word templates, example use ones come nlmixr2rpt directly: gives word document ","code":"obnd_docx = read_template( template = system.file(package=\"nlmixr2rpt\", \"templates\",\"nlmixr_obnd_template.docx\"), mapping = system.file(package=\"nlmixr2rpt\", \"templates\",\"nlmixr_obnd_template.yaml\")) obnd_docx = report_fit( fit = fit, obnd = obnd_docx) #> → Calculating residuals/tables #> ✔ done #> Warning in xpose.nlmixr2::xpose_data_nlmixr(fit): Added CWRES to fit (using #> nlmixr2::addCwres)... #> Skipping figure: res_vs_pred_idv (NA found, not generated) #> Skipping figure: skip_figure (NA found, not generated) #> Skipping figure: eta_cont (NA found, not generated) #> Skipping figure: eta_cat (NA found, not generated) save_report(obnd_docx, \"mod-Word.docx\") #> $isgood #> [1] TRUE #> #> $msgs #> NULL"},{"path":"/articles/create-vpc.html","id":"step-1-convert-the-monolix-model-to-rxode2","dir":"Articles","previous_headings":"","what":"Step 1: Convert the Monolix model to rxode2:","title":"Easily Create a VPC using monolix2rx","text":"","code":"library(babelmixr2) #> Loading required package: nlmixr2 #> Loading required package: nlmixr2data library(monolix2rx) # First we need the location of the monolix mlxtran file. Since we are # running an example, we will use one of the built-in examples in # `monolix2rx` pkgTheo <- system.file(\"theo/theophylline_project.mlxtran\", package=\"monolix2rx\") # You can use a control stream or other file. With the development # version of `babelmixr2`, you can simply point to the listing file mod <- monolix2rx(pkgTheo) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning in .dataRenameFromMlxtran(data, .mlxtran): NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done"},{"path":"/articles/create-vpc.html","id":"step-2-convert-the-rxode2-model-to-nlmixr2","dir":"Articles","previous_headings":"","what":"Step 2: convert the rxode2 model to nlmixr2","title":"Easily Create a VPC using monolix2rx","text":"can convert model, mod, nlmixr2 fit object:","code":"fit <- as.nlmixr2(mod) #> → loading into symengine environment... #> → pruning branches (`if`/`else`) of full model... #> ✔ done #> → finding duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → optimizing duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → compiling EBE model... #> ✔ done #> rxode2 3.0.2.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()` #> → Calculating residuals/tables #> ✔ done #> → compress origData in nlmixr2 object, save 7168 #> ℹ monolix parameter history integrated into fit object fit #> ── nlmixr² monolix2rx reading Monolix ver 5.1.1 ── #> #> OBJF AIC BIC Log-likelihood Condition#(Cov) #> monolix 118.9368 355.482 377.7819 -169.741 21.26161 #> Condition#(Cor) #> monolix 1.383153 #> #> ── Time (sec fit$time): ── #> #> setup optimize covariance table compress as.nlmixr2 #> elapsed 0.031406 5e-06 6e-06 0.054 0.005 2.023 #> #> ── Population Parameters (fit$parFixed or fit$parFixedDf): ── #> #> Est. SE %RSE Back-transformed(95%CI) BSV(CV%) Shrink(SD)% #> ka_pop 0.427 0.204 47.8 1.53 (1.03, 2.29) 75.4 1.05% #> V_pop -0.786 0.045 5.72 0.456 (0.417, 0.497) 12.7 13.3% #> Cl_pop -3.21 0.0837 2.61 0.0402 (0.0341, 0.0473) 27.6 2.65% #> a 0.433 0.433 #> b 0.0543 0.0543 #> #> Covariance Type (fit$covMethod): monolix2rx #> No correlations in between subject variability (BSV) matrix #> Full BSV covariance (fit$omega) or correlation (fit$omegaR; diagonals=SDs) #> Distribution stats (mean/skewness/kurtosis/p-value) available in fit$shrink #> Censoring (fit$censInformation): No censoring #> Minimization message (fit$message): #> IPRED relative difference compared to Monolix IPRED: 0.04%; 95% percentile: (0%,0.52%); rtol=0.000379 #> PRED relative difference compared to Monolix PRED: 0%; 95% percentile: (0%,0%); rtol=4.94e-07 #> IPRED absolute difference compared to Monolix IPRED: atol=0.00253; 95% percentile: (0.000364, 0.00848) #> PRED absolute difference compared to Monolix PRED: atol=4.94e-07; 95% percentile: (1.13e-08, 0.000308) #> #> ── Fit Data (object fit is a modified tibble): ── #> # A tibble: 120 × 20 #> ID TIME DV PRED RES IPRED IRES IWRES omega_ka omega_V #> #> 1 1 0.25 2.84 2.78 0.0636 3.73 -0.887 -1.40 0.132 -0.183 #> 2 1 0.57 6.57 5.00 1.57 6.57 0.00239 0.00303 0.132 -0.183 #> 3 1 1.12 10.5 6.80 3.70 8.75 1.75 1.93 0.132 -0.183 #> # ℹ 117 more rows #> # ℹ 10 more variables: omega_Cl , CONC , depot , central , #> # ka , V , Cl , Cc , tad , dosenum "},{"path":"/articles/create-vpc.html","id":"step-3-perform-the-vpc","dir":"Articles","previous_headings":"","what":"Step 3: Perform the VPC","title":"Easily Create a VPC using monolix2rx","text":"simply use vpcPlot() conjunction vpc package get regular prediction-corrected VPCs arrange single plot:","code":"library(ggplot2) p1 <- vpcPlot(fit, show=list(obs_dv=TRUE)) #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ p1 <- p1 + ylab(\"Concentrations\") + rxode2::rxTheme() + xlab(\"Time (hr)\") + xgxr::xgx_scale_x_time_units(\"hour\", \"hour\") p1a <- p1 + xgxr::xgx_scale_y_log10() ## A prediction-corrected VPC p2 <- vpcPlot(fit, pred_corr = TRUE, show=list(obs_dv=TRUE)) p2 <- p2 + ylab(\"Prediction-Corrected Concentrations\") + rxode2::rxTheme() + xlab(\"Time (hr)\") + xgxr::xgx_scale_x_time_units(\"hour\", \"hour\") p2a <- p2 + xgxr::xgx_scale_y_log10() library(patchwork) (p1 * p1a) / (p2 * p2a) #> Warning in transformation$transform(x): NaNs produced #> Warning in ggplot2::scale_y_log10(..., breaks = breaks, minor_breaks = #> minor_breaks, : log-10 transformation introduced infinite #> values. #> Warning in transformation$transform(x): NaNs produced #> Warning in ggplot2::scale_y_log10(..., breaks = breaks, minor_breaks = #> minor_breaks, : log-10 transformation introduced infinite #> values."},{"path":"/articles/rxode2-validate.html","id":"comparing-differences-between-monolix-and-rxode2","dir":"Articles","previous_headings":"","what":"Comparing differences between Monolix and rxode2","title":"Qualify rxode2 model against Monolix","text":"may wish see differences predictions Monolix rxode2. rxode2 generated outputs compared Monolix generated outputs following items: Population Predictions: shows model translation adequate simulate general trends; validate structural model’s population parameters coupled model structure. Individual Predictions: shows model translation able replicate values subjects within modeling data-set. validates model can reproduce subject variability observed study. Individual Weighted Residuals: one step individual parameter validation, couples individual predictions, observations residual specification generate individual weighted residuals. included consistent nonmem2rx residuals. However, since needed manually adjust residual errors, simply looks errors converted correctly. Note: part validated three metrics subject covariance matrix, omega. assume correct long read correctly.","code":""},{"path":"/articles/rxode2-validate.html","id":"comparing-numerically","dir":"Articles","previous_headings":"","what":"Comparing numerically","title":"Qualify rxode2 model against Monolix","text":"want numerical differences, can also get modified returned ui object. rtol, atol follows : can see exactly match close (say validate). However can explore difference wish looking ipredCompare predCompare datasets: cases can see Monolix seems round values 5 digits, rxode2 keeps everything since solved R directly. Note observation data compared. Dosing predictions excluded comparisons. can also explore Monolix translated input dataset used make validation predictions (dosing observations) $monolixData item:","code":"mod$iwresAtol #> 50% #> 0.003054349 mod$iwresRtol #> 50% #> 0.01526897 mod$ipredAtol #> 50% #> 0.002537436 mod$ipredRtol #> 50% #> 0.0003802867 mod$predAtol #> 50% #> 3.657152e-06 mod$predAtol #> 50% #> 3.657152e-06 head(mod$iwresCompare) #> id time monolixIwres iwres cmt #> 1 1 0.25 -1.397760000 -1.395682322 CONC #> 2 1 0.57 0.000121543 0.003040162 CONC #> 3 1 1.12 1.928970000 1.932039320 CONC #> 4 1 12.12 0.440294000 0.431149277 CONC #> 5 1 2.02 0.196493000 0.198287572 CONC #> 6 1 24.37 0.713742000 0.699508374 CONC head(mod$ipredCompare) #> id time monolixIpred ipred cmt #> 1 1 0.25 3.72839 3.726960 CONC #> 2 1 0.57 6.56990 6.567599 CONC #> 3 1 1.12 8.74855 8.746027 CONC #> 4 1 12.12 5.61508 5.621679 CONC #> 5 1 2.02 9.47386 9.472175 CONC #> 6 1 24.37 2.85999 2.868060 CONC head(mod$predCompare) #> id time monolixPred cmt pred #> 1 1 0.25 2.77640 CONC 2.776402 #> 2 1 0.57 4.99610 CONC 4.996088 #> 3 1 1.12 6.80090 CONC 6.800893 #> 4 1 12.12 3.21554 CONC 3.215548 #> 5 1 2.02 7.41259 CONC 7.412585 #> 6 1 24.37 1.09158 CONC 1.091582 head(mod$monolixData) # with nlme loaded you can also use getData(mod) #> id amt time dv WEIGHT SEX cmt admd #> 1 1 4.02 0.00 NA 79.6 NA NA #> 2 1 NA 0.25 2.84 79.6 NA NA #> 3 1 NA 0.57 6.57 79.6 NA NA #> 4 1 NA 1.12 10.50 79.6 NA NA #> 5 1 NA 2.02 9.66 79.6 NA NA #> 6 1 NA 3.82 8.58 79.6 NA NA"},{"path":"/articles/rxode2-validate.html","id":"comparing-visually","dir":"Articles","previous_headings":"","what":"Comparing visually","title":"Qualify rxode2 model against Monolix","text":"easiest way visually compare differences plot method:","code":"plot(mod) # for general plot # you can also see individual comparisons plot(mod, log=\"y\", ncol=2, nrow=2, xlab=\"Time (hr)\", ylab=\"Concentrations\", page=1) # If you want all pages you could use: # plot(mod, log=\"y\", ncol=2, nrow=2, xlab=\"Time (hr)\", ylab=\"Concentrations\", page=TRUE)"},{"path":"/articles/rxode2-validate.html","id":"notes-on-validation","dir":"Articles","previous_headings":"","what":"Notes on validation","title":"Qualify rxode2 model against Monolix","text":"validation model uses best data available Monolix estimates. : theta population parameters eta individual parameters omega sigma matrices captured. nlmixr2 model fully qualified, IWRES validation ensures residual errors specified correctly. Otherwise omega sigma values contribute validation. Also overall covariance captured, used validation.","code":""},{"path":"/articles/simulate-extra-items.html","id":"step-1-import-the-model","dir":"Articles","previous_headings":"","what":"Step 1: Import the model","title":"Simulate Derived Variables from imported Monolix model","text":"","code":"library(monolix2rx) library(rxode2) # First we need the location of the nonmem control stream Since we are running an example, we will use one of the built-in examples in `nonmem2rx` ctlFile <- system.file(\"mods/cpt/runODE032.ctl\", package=\"nonmem2rx\") # You can use a control stream or other file. With the development # version of `babelmixr2`, you can simply point to the listing file # You use the path to the monolix mlxtran file # In this case we will us the theophylline project included in monolix2rx pkgTheo <- system.file(\"theo/theophylline_project.mlxtran\", package=\"monolix2rx\") # Note you have to setup monolix2rx to use the model library or save # the model as a separate file mod <- monolix2rx(pkgTheo) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning in .dataRenameFromMlxtran(data, .mlxtran): NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done print(mod) #> ── rxode2-based free-form 2-cmt ODE model ────────────────────────────────────── #> ── Initalization: ── #> Fixed Effects ($theta): #> ka_pop V_pop Cl_pop a b #> 0.42699448 -0.78635157 -3.21457598 0.43327956 0.05425953 #> #> Omega ($omega): #> omega_ka omega_V omega_Cl #> omega_ka 0.4503145 0.00000000 0.00000000 #> omega_V 0.0000000 0.01594701 0.00000000 #> omega_Cl 0.0000000 0.00000000 0.07323701 #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 depot #> 2 2 central #> ── μ-referencing ($muRefTable): ── #> theta eta level #> 1 ka_pop omega_ka id #> 2 V_pop omega_V id #> 3 Cl_pop omega_Cl id #> #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is extravascular with a first order absorption (rate constant ka).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\\nThis has been modified so that it will run without the model library\" #> dfObs <- 120 #> dfSub <- 12 #> thetaMat <- lotri({ #> ka_pop ~ 0.09785 #> V_pop ~ c(0.00082606, 0.00041937) #> Cl_pop ~ c(-4.2833e-05, -6.7957e-06, 1.1318e-05) #> omega_ka ~ c(omega_ka = 0.022259) #> omega_V ~ c(omega_ka = -7.6443e-05, omega_V = 0.0014578) #> omega_Cl ~ c(omega_ka = 3.062e-06, omega_V = -1.2912e-05, #> omega_Cl = 0.0039578) #> a ~ c(omega_ka = -0.0001227, omega_V = -6.5914e-05, omega_Cl = -0.00041194, #> a = 0.015333) #> b ~ c(omega_ka = -1.3886e-05, omega_V = -3.1105e-05, #> omega_Cl = 5.2805e-05, a = -0.0026458, b = 0.00056232) #> }) #> validation <- c(\"ipred relative difference compared to Monolix ipred: 0.04%; 95% percentile: (0%,0.52%); rtol=0.00038\", #> \"ipred absolute difference compared to Monolix ipred: 95% percentile: (0.000362, 0.00848); atol=0.00254\", #> \"pred relative difference compared to Monolix pred: 0%; 95% percentile: (0%,0%); rtol=6.6e-07\", #> \"pred absolute difference compared to Monolix pred: 95% percentile: (1.6e-07, 1.27e-05); atol=3.66e-06\", #> \"iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.06%,32.22%); rtol=0.0153\", #> \"iwres absolute difference compared to Monolix pred: 95% percentile: (0.000403, 0.0138); atol=0.00305\") #> ini({ #> ka_pop <- 0.426994483535611 #> V_pop <- -0.786351566327091 #> Cl_pop <- -3.21457597916301 #> a <- c(0, 0.433279557549051) #> b <- c(0, 0.0542595276206251) #> omega_ka ~ 0.450314511978718 #> omega_V ~ 0.0159470121255372 #> omega_Cl ~ 0.0732370098834837 #> }) #> model({ #> cmt(depot) #> cmt(central) #> ka <- exp(ka_pop + omega_ka) #> V <- exp(V_pop + omega_V) #> Cl <- exp(Cl_pop + omega_Cl) #> d/dt(depot) <- -ka * depot #> d/dt(central) <- +ka * depot - Cl/V * central #> Cc <- central/V #> CONC <- Cc #> CONC ~ add(a) + prop(b) + combined1() #> }) #> }"},{"path":"/articles/simulate-extra-items.html","id":"step-2-add-auc-calculation","dir":"Articles","previous_headings":"","what":"Step 2: Add AUC calculation","title":"Simulate Derived Variables from imported Monolix model","text":"concentration case Cc model, trick get AUC additional ODE d/dt(AUC) <- Cc use reset get per dosing period. However, additional parameter part original model. calculation AUC depend number observations model, sparse data wouldn’t terribly accurate. One thing can use model piping append d/dt(AUC) <- Cc imported model: can also use append=NA pre-pend append=f put ODE right f line model.","code":"modAuc <- mod %>% model(d/dt(AUC) <- Cc, append=TRUE) #> → significant model change detected #> → kept in model: '$monolixData' #> → removed from model: '$admd', '$etaData', '$ipredAtol', '$ipredCompare', '$ipredRtol', '$iwresAtol', '$iwresCompare', '$iwresRtol', '$mlxtran', '$predAtol', '$predCompare', '$predIpredData', '$predRtol' modAuc #> ── rxode2-based free-form 3-cmt ODE model ────────────────────────────────────── #> ── Initalization: ── #> Fixed Effects ($theta): #> ka_pop V_pop Cl_pop a b #> 0.42699448 -0.78635157 -3.21457598 0.43327956 0.05425953 #> #> Omega ($omega): #> omega_ka omega_V omega_Cl #> omega_ka 0.4503145 0.00000000 0.00000000 #> omega_V 0.0000000 0.01594701 0.00000000 #> omega_Cl 0.0000000 0.00000000 0.07323701 #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 depot #> 2 2 central #> 3 3 AUC #> ── μ-referencing ($muRefTable): ── #> theta eta level #> 1 ka_pop omega_ka id #> 2 V_pop omega_V id #> 3 Cl_pop omega_Cl id #> #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is extravascular with a first order absorption (rate constant ka).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\\nThis has been modified so that it will run without the model library\" #> dfObs <- 120 #> dfSub <- 12 #> thetaMat <- lotri({ #> ka_pop ~ 0.09785 #> V_pop ~ c(0.00082606, 0.00041937) #> Cl_pop ~ c(-4.2833e-05, -6.7957e-06, 1.1318e-05) #> omega_ka ~ c(omega_ka = 0.022259) #> omega_V ~ c(omega_ka = -7.6443e-05, omega_V = 0.0014578) #> omega_Cl ~ c(omega_ka = 3.062e-06, omega_V = -1.2912e-05, #> omega_Cl = 0.0039578) #> a ~ c(omega_ka = -0.0001227, omega_V = -6.5914e-05, omega_Cl = -0.00041194, #> a = 0.015333) #> b ~ c(omega_ka = -1.3886e-05, omega_V = -3.1105e-05, #> omega_Cl = 5.2805e-05, a = -0.0026458, b = 0.00056232) #> }) #> validation <- c(\"ipred relative difference compared to Monolix ipred: 0.04%; 95% percentile: (0%,0.52%); rtol=0.00038\", #> \"ipred absolute difference compared to Monolix ipred: 95% percentile: (0.000362, 0.00848); atol=0.00254\", #> \"pred relative difference compared to Monolix pred: 0%; 95% percentile: (0%,0%); rtol=6.6e-07\", #> \"pred absolute difference compared to Monolix pred: 95% percentile: (1.6e-07, 1.27e-05); atol=3.66e-06\", #> \"iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.06%,32.22%); rtol=0.0153\", #> \"iwres absolute difference compared to Monolix pred: 95% percentile: (0.000403, 0.0138); atol=0.00305\") #> ini({ #> ka_pop <- 0.426994483535611 #> V_pop <- -0.786351566327091 #> Cl_pop <- -3.21457597916301 #> a <- c(0, 0.433279557549051) #> b <- c(0, 0.0542595276206251) #> omega_ka ~ 0.450314511978718 #> omega_V ~ 0.0159470121255372 #> omega_Cl ~ 0.0732370098834837 #> }) #> model({ #> cmt(depot) #> cmt(central) #> ka <- exp(ka_pop + omega_ka) #> V <- exp(V_pop + omega_V) #> Cl <- exp(Cl_pop + omega_Cl) #> d/dt(depot) <- -ka * depot #> d/dt(central) <- +ka * depot - Cl/V * central #> Cc <- central/V #> CONC <- Cc #> CONC ~ add(a) + prop(b) + combined1() #> d/dt(AUC) <- Cc #> }) #> }"},{"path":"/articles/simulate-extra-items.html","id":"step-3-setup-event-table-to-calculate-the-auc-for-a-different-dosing-paradigm","dir":"Articles","previous_headings":"","what":"Step 3: Setup event table to calculate the AUC for a different dosing paradigm:","title":"Simulate Derived Variables from imported Monolix model","text":"Lets say case instead single dose, want see concentration profile single day BID dosing. case done creating quick event table. case since also wanting AUC per dosing period, can add reset dose AUC compartment every time dose given (track AUC current dose):","code":"ev <- et(amt=4, ii=12, until=24) %>% et(amt=0, ii=12, until=24, cmt=\"AUC\", evid=5) %>% # replace AUC with zero at dosing et(c(0, 4, 8, 11.999, 12, 12.01, 14, 20, 23.999, 24, 24.001, 28, 32, 36)) %>% et(id=1:10)"},{"path":"/articles/simulate-extra-items.html","id":"step-4-solve-using-rxode2","dir":"Articles","previous_headings":"","what":"Step 4: Solve using rxode2","title":"Simulate Derived Variables from imported Monolix model","text":"step, solve model new event table 10 subjects: Note since derived nonmem2rx model, default solving match tolerances methods specified NONMEM model.","code":"s <- rxSolve(modAuc, ev) #> ℹ using locf interpolation like Monolix, specify directly to change #> ℹ using Monolix specified atol=1e-06 #> ℹ using Monolix specified rtol=1e-06 #> ℹ Since Monolix doesn't use ssRtol, set ssRtol=100 #> ℹ Since Monolix doesn't use ssRtol, set ssAtol=100 #> ℹ Since Monolix uses a set number of doses for steady state use maxSS=8, minSS=7 #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’"},{"path":"/articles/simulate-extra-items.html","id":"step-5-exploring-the-simulation-by-plotting-and-summarizing-dplyr","dir":"Articles","previous_headings":"","what":"Step 5: Exploring the simulation (by plotting), and summarizing (dplyr)","title":"Simulate Derived Variables from imported Monolix model","text":"solved object acts rxode2 solved object, can use plot() function see individual running AUC profiles simulated: can also select points near dosing get AUC interval:","code":"library(ggplot2) plot(s, AUC) + ylab(\"Running AUC\") library(dplyr) #> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:data.table': #> #> between, first, last #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union s %>% filter(time %in% c(11.999, 23.999)) %>% mutate(time=round(time)) %>% select(id, time, AUC) #> id time AUC #> 1 1 12 71.67319 #> 2 1 24 102.46378 #> 3 2 12 62.73231 #> 4 2 24 91.10876 #> 5 3 12 62.42782 #> 6 3 24 86.37406 #> 7 4 12 44.99681 #> 8 4 24 59.71716 #> 9 5 12 58.29805 #> 10 5 24 81.99565 #> 11 6 12 51.33952 #> 12 6 24 66.40563 #> 13 7 12 71.35170 #> 14 7 24 95.19523 #> 15 8 12 57.10391 #> 16 8 24 81.70183 #> 17 9 12 51.23582 #> 18 9 24 67.72999 #> 19 10 12 45.90700 #> 20 10 24 61.53054"},{"path":"/articles/simulate-new-dosing.html","id":"step-1-import-the-model","dir":"Articles","previous_headings":"","what":"Step 1: Import the model","title":"Simulate New dosing from Monolix model","text":"","code":"library(monolix2rx) library(rxode2) # You use the path to the monolix mlxtran file # In this case we will us the theophylline project included in monolix2rx pkgTheo <- system.file(\"theo/theophylline_project.mlxtran\", package=\"monolix2rx\") # Note you have to setup monolix2rx to use the model library or save # the model as a separate file mod <- monolix2rx(pkgTheo) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning in .dataRenameFromMlxtran(data, .mlxtran): NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done print(mod) #> ── rxode2-based free-form 2-cmt ODE model ────────────────────────────────────── #> ── Initalization: ── #> Fixed Effects ($theta): #> ka_pop V_pop Cl_pop a b #> 0.42699448 -0.78635157 -3.21457598 0.43327956 0.05425953 #> #> Omega ($omega): #> omega_ka omega_V omega_Cl #> omega_ka 0.4503145 0.00000000 0.00000000 #> omega_V 0.0000000 0.01594701 0.00000000 #> omega_Cl 0.0000000 0.00000000 0.07323701 #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 depot #> 2 2 central #> ── μ-referencing ($muRefTable): ── #> theta eta level #> 1 ka_pop omega_ka id #> 2 V_pop omega_V id #> 3 Cl_pop omega_Cl id #> #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is extravascular with a first order absorption (rate constant ka).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\\nThis has been modified so that it will run without the model library\" #> dfObs <- 120 #> dfSub <- 12 #> thetaMat <- lotri({ #> ka_pop ~ 0.09785 #> V_pop ~ c(0.00082606, 0.00041937) #> Cl_pop ~ c(-4.2833e-05, -6.7957e-06, 1.1318e-05) #> omega_ka ~ c(omega_ka = 0.022259) #> omega_V ~ c(omega_ka = -7.6443e-05, omega_V = 0.0014578) #> omega_Cl ~ c(omega_ka = 3.062e-06, omega_V = -1.2912e-05, #> omega_Cl = 0.0039578) #> a ~ c(omega_ka = -0.0001227, omega_V = -6.5914e-05, omega_Cl = -0.00041194, #> a = 0.015333) #> b ~ c(omega_ka = -1.3886e-05, omega_V = -3.1105e-05, #> omega_Cl = 5.2805e-05, a = -0.0026458, b = 0.00056232) #> }) #> validation <- c(\"ipred relative difference compared to Monolix ipred: 0.04%; 95% percentile: (0%,0.52%); rtol=0.00038\", #> \"ipred absolute difference compared to Monolix ipred: 95% percentile: (0.000362, 0.00848); atol=0.00254\", #> \"pred relative difference compared to Monolix pred: 0%; 95% percentile: (0%,0%); rtol=6.6e-07\", #> \"pred absolute difference compared to Monolix pred: 95% percentile: (1.6e-07, 1.27e-05); atol=3.66e-06\", #> \"iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.06%,32.22%); rtol=0.0153\", #> \"iwres absolute difference compared to Monolix pred: 95% percentile: (0.000403, 0.0138); atol=0.00305\") #> ini({ #> ka_pop <- 0.426994483535611 #> V_pop <- -0.786351566327091 #> Cl_pop <- -3.21457597916301 #> a <- c(0, 0.433279557549051) #> b <- c(0, 0.0542595276206251) #> omega_ka ~ 0.450314511978718 #> omega_V ~ 0.0159470121255372 #> omega_Cl ~ 0.0732370098834837 #> }) #> model({ #> cmt(depot) #> cmt(central) #> ka <- exp(ka_pop + omega_ka) #> V <- exp(V_pop + omega_V) #> Cl <- exp(Cl_pop + omega_Cl) #> d/dt(depot) <- -ka * depot #> d/dt(central) <- +ka * depot - Cl/V * central #> Cc <- central/V #> CONC <- Cc #> CONC ~ add(a) + prop(b) + combined1() #> }) #> }"},{"path":"/articles/simulate-new-dosing.html","id":"step-2-look-at-a-different-dosing-paradigm","dir":"Articles","previous_headings":"","what":"Step 2: Look at a different dosing paradigm","title":"Simulate New dosing from Monolix model","text":"Lets say case instead single dose, want see concentration profile single day BID dosing. case done creating quick event table:","code":"ev <- et(amt=4, ii=12, until=24) %>% et(list(c(0, 2), # add observations in windows c(4, 6), c(8, 12), c(14, 18), c(20, 26), c(28, 32), c(32, 36), c(36, 44))) %>% et(id=1:10)"},{"path":"/articles/simulate-new-dosing.html","id":"step-3-solve-using-rxode2","dir":"Articles","previous_headings":"","what":"Step 3: solve using rxode2","title":"Simulate New dosing from Monolix model","text":"step, solve model new event table 10 subjects: Note since nonmem2rx model, default solving match tolerances methods specified NONMEM model.","code":"s <- rxSolve(mod, ev) #> ℹ using locf interpolation like Monolix, specify directly to change #> ℹ using Monolix specified atol=1e-06 #> ℹ using Monolix specified rtol=1e-06 #> ℹ Since Monolix doesn't use ssRtol, set ssRtol=100 #> ℹ Since Monolix doesn't use ssRtol, set ssAtol=100 #> ℹ Since Monolix uses a set number of doses for steady state use maxSS=8, minSS=7 #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’"},{"path":"/articles/simulate-new-dosing.html","id":"step-4-exploring-the-simulation-by-plotting","dir":"Articles","previous_headings":"","what":"Step 4: exploring the simulation (by plotting)","title":"Simulate New dosing from Monolix model","text":"solved object acts rxode2 solved object, can use plot() function see individual profiles simulated:","code":"library(ggplot2) plot(s, ipredSim) + ylab(\"Concentrations\")"},{"path":"/articles/simulate-uncertainty.html","id":"step-1-import-the-model","dir":"Articles","previous_headings":"","what":"Step 1: Import the model","title":"Simulate using Parameter Uncertainty","text":"","code":"library(monolix2rx) library(rxode2) # its best practice to set the seed for the simulations set.seed(42) rxSetSeed(42) # You use the path to the monolix mlxtran file # In this case we will us the theophylline project included in monolix2rx pkgTheo <- system.file(\"theo/theophylline_project.mlxtran\", package=\"monolix2rx\") # Note you have to setup monolix2rx to use the model library or save # the model as a separate file mod <- monolix2rx(pkgTheo) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning in .dataRenameFromMlxtran(data, .mlxtran): NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done print(mod) #> ── rxode2-based free-form 2-cmt ODE model ────────────────────────────────────── #> ── Initalization: ── #> Fixed Effects ($theta): #> ka_pop V_pop Cl_pop a b #> 0.42699448 -0.78635157 -3.21457598 0.43327956 0.05425953 #> #> Omega ($omega): #> omega_ka omega_V omega_Cl #> omega_ka 0.4503145 0.00000000 0.00000000 #> omega_V 0.0000000 0.01594701 0.00000000 #> omega_Cl 0.0000000 0.00000000 0.07323701 #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 depot #> 2 2 central #> ── μ-referencing ($muRefTable): ── #> theta eta level #> 1 ka_pop omega_ka id #> 2 V_pop omega_V id #> 3 Cl_pop omega_Cl id #> #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is extravascular with a first order absorption (rate constant ka).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\\nThis has been modified so that it will run without the model library\" #> dfObs <- 120 #> dfSub <- 12 #> thetaMat <- lotri({ #> ka_pop ~ 0.09785 #> V_pop ~ c(0.00082606, 0.00041937) #> Cl_pop ~ c(-4.2833e-05, -6.7957e-06, 1.1318e-05) #> omega_ka ~ c(omega_ka = 0.022259) #> omega_V ~ c(omega_ka = -7.6443e-05, omega_V = 0.0014578) #> omega_Cl ~ c(omega_ka = 3.062e-06, omega_V = -1.2912e-05, #> omega_Cl = 0.0039578) #> a ~ c(omega_ka = -0.0001227, omega_V = -6.5914e-05, omega_Cl = -0.00041194, #> a = 0.015333) #> b ~ c(omega_ka = -1.3886e-05, omega_V = -3.1105e-05, #> omega_Cl = 5.2805e-05, a = -0.0026458, b = 0.00056232) #> }) #> validation <- c(\"ipred relative difference compared to Monolix ipred: 0.04%; 95% percentile: (0%,0.52%); rtol=0.00038\", #> \"ipred absolute difference compared to Monolix ipred: 95% percentile: (0.000362, 0.00848); atol=0.00254\", #> \"pred relative difference compared to Monolix pred: 0%; 95% percentile: (0%,0%); rtol=6.6e-07\", #> \"pred absolute difference compared to Monolix pred: 95% percentile: (1.6e-07, 1.27e-05); atol=3.66e-06\", #> \"iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.06%,32.22%); rtol=0.0153\", #> \"iwres absolute difference compared to Monolix pred: 95% percentile: (0.000403, 0.0138); atol=0.00305\") #> ini({ #> ka_pop <- 0.426994483535611 #> V_pop <- -0.786351566327091 #> Cl_pop <- -3.21457597916301 #> a <- c(0, 0.433279557549051) #> b <- c(0, 0.0542595276206251) #> omega_ka ~ 0.450314511978718 #> omega_V ~ 0.0159470121255372 #> omega_Cl ~ 0.0732370098834837 #> }) #> model({ #> cmt(depot) #> cmt(central) #> ka <- exp(ka_pop + omega_ka) #> V <- exp(V_pop + omega_V) #> Cl <- exp(Cl_pop + omega_Cl) #> d/dt(depot) <- -ka * depot #> d/dt(central) <- +ka * depot - Cl/V * central #> Cc <- central/V #> CONC <- Cc #> CONC ~ add(a) + prop(b) + combined1() #> }) #> }"},{"path":"/articles/simulate-uncertainty.html","id":"step-2-look-at-a-different-dosing-paradigm","dir":"Articles","previous_headings":"","what":"Step 2: Look at a different dosing paradigm","title":"Simulate using Parameter Uncertainty","text":"Lets say case instead single dose, want see concentration profile single day BID dosing. case done creating quick event table.","code":"ev <- et(amt=4, ii=12, until=24) %>% et(c(1:6, seq(8, 24, by=2))) %>% et(id=1:100)"},{"path":"/articles/simulate-uncertainty.html","id":"step-3-solve-using-the-uncertainty-in-the-nonmem-model","dir":"Articles","previous_headings":"","what":"Step 3: Solve using the uncertainty in the NONMEM model","title":"Simulate using Parameter Uncertainty","text":"use uncertainty model, simple matter telling many times rxode2() sample nStud=X. case use 100.","code":"s <- rxSolve(mod, ev, nStud=100) #> ℹ using locf interpolation like Monolix, specify directly to change #> ℹ using dfSub=12 from Monolix #> ℹ using dfObs=120 from Monolix #> ℹ using thetaMat from Monolix #> ℹ using Monolix specified atol=1e-06 #> ℹ using Monolix specified rtol=1e-06 #> ℹ Since Monolix doesn't use ssRtol, set ssRtol=100 #> ℹ Since Monolix doesn't use ssRtol, set ssAtol=100 #> ℹ Since Monolix uses a set number of doses for steady state use maxSS=8, minSS=7 #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 s #> ── Solved rxode2 object ── #> ── Parameters (x$params): ── #> # A tibble: 10,000 × 10 #> sim.id id ka_pop V_pop Cl_pop a b omega_ka omega_V omega_Cl #> #> 1 1 1 0.281 -0.770 -3.22 0.475 0.0653 0.470 -0.208 0.483 #> 2 1 2 0.281 -0.770 -3.22 0.475 0.0653 0.654 0.0861 0.129 #> 3 1 3 0.281 -0.770 -3.22 0.475 0.0653 -0.0747 0.168 0.500 #> 4 1 4 0.281 -0.770 -3.22 0.475 0.0653 0.126 -0.0226 0.479 #> 5 1 5 0.281 -0.770 -3.22 0.475 0.0653 -0.162 0.000264 -0.205 #> 6 1 6 0.281 -0.770 -3.22 0.475 0.0653 -1.13 -0.239 0.0941 #> 7 1 7 0.281 -0.770 -3.22 0.475 0.0653 -0.335 0.0134 0.00490 #> 8 1 8 0.281 -0.770 -3.22 0.475 0.0653 -0.869 -0.239 0.000511 #> 9 1 9 0.281 -0.770 -3.22 0.475 0.0653 1.35 -0.122 0.667 #> 10 1 10 0.281 -0.770 -3.22 0.475 0.0653 0.314 0.0494 -0.552 #> # ℹ 9,990 more rows #> ── Initial Conditions (x$inits): ── #> depot central #> 0 0 #> #> Simulation with uncertainty in: #> • parameters (x$thetaMat for changes) #> • omega matrix (x$omegaList) #> • sigma matrix (x$sigmaList) #> #> ── First part of data (object): ── #> # A tibble: 150,000 × 12 #> sim.id id time ka V Cl Cc CONC ipredSim sim depot #> #> 1 1 1 1 2.12 0.376 0.0646 8.36 8.36 8.36 8.50 0.481 #> 2 1 1 2 2.12 0.376 0.0646 8.04 8.04 8.04 9.71 0.0577 #> 3 1 1 3 2.12 0.376 0.0646 6.90 6.90 6.90 7.77 0.00694 #> 4 1 1 4 2.12 0.376 0.0646 5.82 5.82 5.82 5.07 0.000833 #> 5 1 1 5 2.12 0.376 0.0646 4.91 4.91 4.91 4.91 0.000100 #> 6 1 1 6 2.12 0.376 0.0646 4.13 4.13 4.13 3.79 0.0000121 #> # ℹ 149,994 more rows #> # ℹ 1 more variable: central "},{"path":"/articles/simulate-uncertainty.html","id":"step-4-summarize-and-plot","dir":"Articles","previous_headings":"","what":"Step 4: Summarize and plot","title":"Simulate using Parameter Uncertainty","text":"Since bunch data, confidence band simulation uncertainty helpful. One way select interesting components, create confidence interval plot confidence bands:","code":"sci <- confint(s, parm=c(\"CONC\", \"sim\")) #> summarizing data...done sci #> # A tibble: 90 × 7 #> p1 time trt p2.5 p50 p97.5 Percentile #> #> 1 0.0250 1 CONC 0.741 2.40 4.39 2.5% #> 2 0.5 1 CONC 4.21 6.21 7.25 50% #> 3 0.975 1 CONC 7.89 9.32 11.1 97.5% #> 4 0.0250 2 CONC 1.33 3.80 5.59 2.5% #> 5 0.5 2 CONC 5.76 6.94 7.45 50% #> 6 0.975 2 CONC 8.22 9.14 10.6 97.5% #> 7 0.0250 3 CONC 1.79 4.36 5.42 2.5% #> 8 0.5 3 CONC 6.04 6.66 7.05 50% #> 9 0.975 3 CONC 7.79 8.71 9.99 97.5% #> 10 0.0250 4 CONC 2.12 4.36 5.26 2.5% #> # ℹ 80 more rows p1 <- plot(sci) p2 <- plot(sci, log=\"y\") library(patchwork) p1/p2"},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Matthew Fidler. Author, maintainer. Justin Wilkins. Contributor.","code":""},{"path":"/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Fidler M (2024). monolix2rx: Converts 'Monolix' Models 'rxode2'. R package version 0.0.4, https://github.com/nlmixr2/monolix2rx/, https://nlmixr2.github.io/monolix2rx/.","code":"@Manual{, title = {monolix2rx: Converts 'Monolix' Models to 'rxode2'}, author = {Matthew Fidler}, year = {2024}, note = {R package version 0.0.4, https://github.com/nlmixr2/monolix2rx/}, url = {https://nlmixr2.github.io/monolix2rx/}, }"},{"path":"/index.html","id":"monolix2rx-","dir":"","previous_headings":"","what":"Converts Monolix Models to rxode2","title":"Converts Monolix Models to rxode2","text":"goal monolix2rx convert Monolix rxode2 use simulation sharing model open-source framework.","code":""},{"path":"/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Converts Monolix Models to rxode2","text":"can install development version monolix2rx GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"nlmixr2/monolix2rx\")"},{"path":"/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Converts Monolix Models to rxode2","text":"trying convert Monolix rxode2 model simply need path mlxtran file. example, classic demo theophylline included monolix2rx can imported :","code":"library(monolix2rx) # First load in the model; in this case the theo model # This is modified from the Monolix demos by saving the model # file as a text file (hence you can access without model library). # Additionally some of the file paths were shortened so they could # be included with monolix2rx pkgTheo <- system.file(\"theo\", package=\"monolix2rx\") mlxtranFile <- file.path(pkgTheo, \"theophylline_project.mlxtran\") rx <- monolix2rx(mlxtranFile) #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done rx #> ── rxode2-based free-form 2-cmt ODE model ────────────────────────────────────── #> ── Initalization: ── #> Fixed Effects ($theta): #> ka_pop V_pop Cl_pop a b #> 0.42699448 -0.78635157 -3.21457598 0.43327956 0.05425953 #> #> Omega ($omega): #> omega_ka omega_V omega_Cl #> omega_ka 0.4503145 0.00000000 0.00000000 #> omega_V 0.0000000 0.01594701 0.00000000 #> omega_Cl 0.0000000 0.00000000 0.07323701 #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 depot #> 2 2 central #> ── μ-referencing ($muRefTable): ── #> theta eta level #> 1 ka_pop omega_ka id #> 2 V_pop omega_V id #> 3 Cl_pop omega_Cl id #> #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is extravascular with a first order absorption (rate constant ka).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\\nThis has been modified so that it will run without the model library\" #> dfObs <- 120 #> dfSub <- 12 #> thetaMat <- lotri({ #> ka_pop + V_pop + Cl_pop ~ c(0.09785, 0.00082606, 0.00041937, #> -4.2833e-05, -6.7957e-06, 1.1318e-05) #> a + b ~ c(0.015333, -0.0026458, 0.00056232) #> }) #> validation <- c(\"ipred relative difference compared to Monolix ipred: 0.04%; 95% percentile: (0%,0.52%); rtol=0.00038\", #> \"ipred absolute difference compared to Monolix ipred: 95% percentile: (0.000362, 0.00848); atol=0.00254\", #> \"pred relative difference compared to Monolix pred: 0%; 95% percentile: (0%,0%); rtol=6.6e-07\", #> \"pred absolute difference compared to Monolix pred: 95% percentile: (1.6e-07, 1.27e-05); atol=3.66e-06\", #> \"iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.06%,32.22%); rtol=0.0153\", #> \"iwres absolute difference compared to Monolix pred: 95% percentile: (0.000403, 0.0138); atol=0.00305\") #> ini({ #> ka_pop <- 0.426994483535611 #> V_pop <- -0.786351566327091 #> Cl_pop <- -3.21457597916301 #> a <- c(0, 0.433279557549051) #> b <- c(0, 0.0542595276206251) #> omega_ka ~ 0.450314511978718 #> omega_V ~ 0.0159470121255372 #> omega_Cl ~ 0.0732370098834837 #> }) #> model({ #> cmt(depot) #> cmt(central) #> ka <- exp(ka_pop + omega_ka) #> V <- exp(V_pop + omega_V) #> Cl <- exp(Cl_pop + omega_Cl) #> d/dt(depot) <- -ka * depot #> d/dt(central) <- +ka * depot - Cl/V * central #> Cc <- central/V #> CONC <- Cc #> CONC ~ add(a) + prop(b) + combined1() #> }) #> } # If you are only interseted in the parsing you can use `mlxtran` mlx <- mlxtran(mlxtranFile) #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done mlx #> DESCRIPTION: #> The administration is extravascular with a first order absorption (rate constant ka). #> The PK model has one compartment (volume V) and a linear elimination (clearance Cl). #> This has been modified so that it will run without the model library #> #> #> [FILEINFO] #> ; parsed: $DATAFILE$FILEINFO$FILEINFO #> file = 'data/theophylline_data.txt' #> delimiter = tab #> header = {ID, AMT, TIME, CONC, WEIGHT, SEX} #> #> [CONTENT] #> ; parsed: $DATAFILE$CONTENT$CONTENT #> ID = {use=identifier} #> TIME = {use=time} #> AMT = {use=amount} #> CONC = {use=observation, name=CONC, type=continuous} #> WEIGHT = {use=covariate, type=continuous} #> SEX = {use=covariate, type=categorical} #> #> #> [INDIVIDUAL] #> ; parsed: $MODEL$INDIVIDUAL$INDIVIDUAL #> input = {ka_pop, omega_ka, V_pop, omega_V, Cl_pop, omega_Cl} #> #> DEFINITION: #> ; parsed: $MODEL$INDIVIDUAL$DEFINITION #> ka = {distribution=lognormal, typical=ka_pop, sd=omega_ka} #> V = {distribution=lognormal, typical=V_pop, sd=omega_V} #> Cl = {distribution=lognormal, typical=Cl_pop, sd=omega_Cl} #> #> [LONGITUDINAL] #> ; parsed: $MODEL$LONGITUDINAL$LONGITUDINAL #> input = {a, b, ka, V, Cl} #> file = 'oral1_1cpt_kaVCl.txt' #> #> DEFINITION: #> ; parsed: $MODEL$LONGITUDINAL$DEFINITION #> CONC = {distribution=normal, prediction=Cc, errorModel=combined1(a, b)} #> #> EQUATION: #> #> ; PK model definition #> Cc = pkmodel(ka, V, Cl) #> #> OUTPUT: #> ; parsed: $MODEL$LONGITUDINAL$OUTPUT #> output = Cc #> #> #> ; parsed: $FIT$FIT #> data = {CONC} #> model = {CONC} #> #> #> ; parsed: $PARAMETER$PARAMETER #> Cl_pop = {value=0.1, method=MLE} #> V_pop = {value=0.5, method=MLE} #> a = {value=1, method=MLE} #> b = {value=0.3, method=MLE} #> ka_pop = {value=1, method=MLE} #> omega_Cl = {value=1, method=MLE} #> omega_V = {value=1, method=MLE} #> omega_ka = {value=1, method=MLE} #> #> #> [TASKS] #> ; parsed: $MONOLIX$TASKS$TASKS #> populationParameters() #> individualParameters(method = {conditionalMean, conditionalMode}) #> fim(method = Linearization) #> logLikelihood(method = Linearization) #> plotResult(method = {indfits, obspred, vpc, residualsscatter, residualsdistribution, parameterdistribution, covariatemodeldiagnosis, randomeffects, covariancemodeldiagnosis, saemresults}) #> #> [SETTINGS] #> GLOBAL: #> ; parsed: $MONOLIX$SETTINGS$GLOBAL #> exportpath = 'tp' #> #> ; unparsed sections: #> ; $MODEL$LONGITUDINAL$EQUATION # this can be converted to a list mlx <- as.list(mlx) mlx$DATAFILE$FILEINFO$FILEINFO #> $file #> [1] \"data/theophylline_data.txt\" #> #> $header #> [1] \"ID\" \"AMT\" \"TIME\" \"CONC\" \"WEIGHT\" \"SEX\" #> #> $delimiter #> [1] \"tab\""},{"path":"/index.html","id":"translating-models-from-the-monolix-model-library","dir":"","previous_headings":"","what":"Translating models from the Monolix model library","title":"Converts Monolix Models to rxode2","text":"models using Monolix’s model library, models may accessible text files versions Monolix. mlxtran files may see something like: older versions Monolix, model libraries group text files. can find looking file Monolix library like bolus_1cpt_TlagVCl.txt. case pk/bolus_1cpt_TlagVCl.txt. parent directory model library. access files (even old version Monolix) can make monolix2rx aware model library using: Unix, can symbolic link whatever model library like use. can check see works trying translate model file rxode2: computer setup correctly (like ) see translated model. Note since isn’t mlxtran file relationship population parameters, subject variability etc initial parameter estimates model. model library setup correctly see found old model library get: newer versions Monolix, model library turned binary database accessed GUI lixoftConnectors. lixoftConnectors system can successfully load model lixoftConnectors::getLibraryModelContent() monolix2rx also load model correctly (use version text files setup) means need import models rxode2 need : model built model library need: path text file Monolix Library setup monolix2rx.library options(monolix2rx.library=\"~/src/monolix/library/\") lixoftConnectors installed connected newer (licensed) version Monolix can get model library content lixoftConnectors::getLibraryModelContent() without options, need save model text file outside model library can import model.","code":"lib:bolus_1cpt_TlagVCl.txt # If the model library was located in ~/src/monolix/library # Then you would set the model library up as follows: options(monolix2rx.library=\"~/src/monolix/library/\") monolix2rx(\"lib:bolus_1cpt_TlagVCl.txt\") #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ℹ cannot find individual parameter estimates #> ── rxode2-based free-form 1-cmt ODE model ────────────────────────────────────── #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 central #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is via a bolus with a lag time (Tlag).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\" #> model({ #> cmt(central) #> d/dt(central) <- -Cl/V * central #> alag(central) <- Tlag #> Cc <- central/V #> }) #> } try(monolix2rx(\"lib:notThere.txt\")) #> Warning in .mlxtranLib(file): while options('monolix2rx.library') is set, could not find model file 'lib:notThere.txt' #> please save the model to translate #> Error : could not find the model file"},{"path":"/index.html","id":"note-on-testing","dir":"","previous_headings":"","what":"Note on testing","title":"Converts Monolix Models to rxode2","text":"tests package include testing Monolix demo files, Monolix library files (available), Monolix validation suite. Since part Monolix , included package. can setup monolix2rx run tests files well setting options:","code":"# setup monolix library (and will test that the parsing and translation are as expected) options(monolix2rx.library=\"~/src/monolix/library/\") # setup monolix demos to be tested options(monolix2rx.demo=\"~/src/monolix/demos/\")"},{"path":"/reference/autoplot.monolix2rx.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplot monolix2rx object — autoplot.monolix2rx","title":"Autoplot monolix2rx object — autoplot.monolix2rx","text":"Autoplot monolix2rx object","code":""},{"path":"/reference/autoplot.monolix2rx.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplot monolix2rx object — autoplot.monolix2rx","text":"","code":"# S3 method for class 'monolix2rx' autoplot( object, ..., ncol = 3, nrow = 3, log = \"\", xlab = \"Time\", ylab = \"Predictions\", page = FALSE )"},{"path":"/reference/autoplot.monolix2rx.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplot monolix2rx object — autoplot.monolix2rx","text":"object object, whose class determine behaviour autoplot ... ignored parameters monolix2rx objects nrow, ncol Number rows columns log \"\" (neither x y), \"x\", \"y\", \"xy\" (\"yx\") log-scale? xlab, ylab x y axis labels page number page(s) individual plots, default (FALSE) pages print; can use TRUE pages print, list pages want print","code":""},{"path":"/reference/autoplot.monolix2rx.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplot monolix2rx object — autoplot.monolix2rx","text":"ggplot2 object","code":""},{"path":"/reference/dot-getNbdoses.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the number of doses for steady state for monolix2rx — .getNbdoses","title":"Get the number of doses for steady state for monolix2rx — .getNbdoses","text":"Get number doses steady state monolix2rx","code":""},{"path":"/reference/dot-getNbdoses.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the number of doses for steady state for monolix2rx — .getNbdoses","text":"","code":".getNbdoses(x)"},{"path":"/reference/dot-getNbdoses.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the number of doses for steady state for monolix2rx — .getNbdoses","text":"x monolix2rx object","code":""},{"path":"/reference/dot-getNbdoses.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the number of doses for steady state for monolix2rx — .getNbdoses","text":"Number doses monolix2rx object","code":""},{"path":"/reference/dot-getNbdoses.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Get the number of doses for steady state for monolix2rx — .getNbdoses","text":"Matthew L. Fidler","code":""},{"path":"/reference/dot-getStiff.html","id":null,"dir":"Reference","previous_headings":"","what":"Get if the model object is stiff — .getStiff","title":"Get if the model object is stiff — .getStiff","text":"Get model object stiff","code":""},{"path":"/reference/dot-getStiff.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get if the model object is stiff — .getStiff","text":"","code":".getStiff(x)"},{"path":"/reference/dot-getStiff.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get if the model object is stiff — .getStiff","text":"x monolix2rx object","code":""},{"path":"/reference/dot-getStiff.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get if the model object is stiff — .getStiff","text":"boolean indicating object stiff system (indicated monolix)","code":""},{"path":"/reference/dot-getStiff.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Get if the model object is stiff — .getStiff","text":"Matthew L. Fidler","code":""},{"path":"/reference/dot-monolixGetMlxtran.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the best mlxtran info or return NULL — .monolixGetMlxtran","title":"Get the best mlxtran info or return NULL — .monolixGetMlxtran","text":"Get best mlxtran info return NULL","code":""},{"path":"/reference/dot-monolixGetMlxtran.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the best mlxtran info or return NULL — .monolixGetMlxtran","text":"","code":".monolixGetMlxtran(x)"},{"path":"/reference/dot-monolixGetMlxtran.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the best mlxtran info or return NULL — .monolixGetMlxtran","text":"x item try extract mlxtran info","code":""},{"path":"/reference/dot-monolixGetMlxtran.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the best mlxtran info or return NULL — .monolixGetMlxtran","text":"mlxtran info","code":""},{"path":"/reference/dot-monolixGetMlxtran.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Get the best mlxtran info or return NULL — .monolixGetMlxtran","text":"Matthew L. Fidler","code":""},{"path":"/reference/mlxTxt.html","id":null,"dir":"Reference","previous_headings":"","what":"Get equation block from a Monolix model txt file — mlxTxt","title":"Get equation block from a Monolix model txt file — mlxTxt","text":"Get equation block Monolix model txt file","code":""},{"path":"/reference/mlxTxt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get equation block from a Monolix model txt file — mlxTxt","text":"","code":"mlxTxt(file, retFile = FALSE)"},{"path":"/reference/mlxTxt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get equation block from a Monolix model txt file — mlxTxt","text":"file string representing model text file. Can lib:fileName.txt library setup/available retFile boolean tells mlxTxt() return file name instead error file exist","code":""},{"path":"/reference/mlxTxt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get equation block from a Monolix model txt file — mlxTxt","text":"parsed equation file name","code":""},{"path":"/reference/mlxTxt.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Get equation block from a Monolix model txt file — mlxTxt","text":"Matthew L. Fidler","code":""},{"path":"/reference/mlxTxt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get equation block from a Monolix model txt file — mlxTxt","text":"","code":"# First load in the model; in this case the theo model # This is modified from the Monolix demos by saving the model # File as a text file (hence you can access without model library) # setup. # # This example is also included in the monolix2rx package, so # you refer to the location with `system.file()`: pkgTheo <- system.file(\"theo\", package=\"monolix2rx\") mod <- mlxTxt(file.path(pkgTheo, \"oral1_1cpt_kaVCl.txt\")) mod #> DESCRIPTION: #> The administration is extravascular with a first order absorption (rate constant ka). #> The PK model has one compartment (volume V) and a linear elimination (clearance Cl). #> This has been modified so that it will run without the model library #> #> #> [LONGITUDINAL] #> ; parsed: $MODEL$LONGITUDINAL$LONGITUDINAL #> input = {ka, V, Cl} #> #> EQUATION: #> ; parsed: $MODEL$LONGITUDINAL$EQUATION #> ; PK model definition #> Cc = pkmodel(ka, V, Cl) #> #> OUTPUT: #> ; parsed: $MODEL$LONGITUDINAL$OUTPUT #> output = Cc"},{"path":"/reference/mlxtran.html","id":null,"dir":"Reference","previous_headings":"","what":"Read and parse mlxtran lines — mlxtran","title":"Read and parse mlxtran lines — mlxtran","text":"Read parse mlxtran lines","code":""},{"path":"/reference/mlxtran.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read and parse mlxtran lines — mlxtran","text":"","code":"mlxtran(file, equation = FALSE, update = FALSE)"},{"path":"/reference/mlxtran.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read and parse mlxtran lines — mlxtran","text":"file mlxtran file process equation parse equation block rxode2 (models translated) update true, try update parameter block final parameter estimates","code":""},{"path":"/reference/mlxtran.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read and parse mlxtran lines — mlxtran","text":"mlxtran object","code":""},{"path":"/reference/mlxtran.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Read and parse mlxtran lines — mlxtran","text":"Matthew L. Fidler","code":""},{"path":"/reference/mlxtran.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read and parse mlxtran lines — mlxtran","text":"","code":"# First load in the model; in this case the theo model # This is modified from the Monolix demos by saving the model # File as a text file (hence you can access without model library) # setup. # # This example is also included in the monolix2rx package, so # you refer to the location with `system.file()`: pkgTheo <- system.file(\"theo\", package=\"monolix2rx\") mlx <- mlxtran(file.path(pkgTheo, \"theophylline_project.mlxtran\")) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done mlx #> DESCRIPTION: #> The administration is extravascular with a first order absorption (rate constant ka). #> The PK model has one compartment (volume V) and a linear elimination (clearance Cl). #> This has been modified so that it will run without the model library #> #> #> [FILEINFO] #> ; parsed: $DATAFILE$FILEINFO$FILEINFO #> file = 'data/theophylline_data.txt' #> delimiter = tab #> header = {ID, AMT, TIME, CONC, WEIGHT, SEX} #> #> [CONTENT] #> ; parsed: $DATAFILE$CONTENT$CONTENT #> ID = {use=identifier} #> TIME = {use=time} #> AMT = {use=amount} #> CONC = {use=observation, name=CONC, type=continuous} #> WEIGHT = {use=covariate, type=continuous} #> SEX = {use=covariate, type=categorical} #> #> #> [INDIVIDUAL] #> ; parsed: $MODEL$INDIVIDUAL$INDIVIDUAL #> input = {ka_pop, omega_ka, V_pop, omega_V, Cl_pop, omega_Cl} #> #> DEFINITION: #> ; parsed: $MODEL$INDIVIDUAL$DEFINITION #> ka = {distribution=lognormal, typical=ka_pop, sd=omega_ka} #> V = {distribution=lognormal, typical=V_pop, sd=omega_V} #> Cl = {distribution=lognormal, typical=Cl_pop, sd=omega_Cl} #> #> [LONGITUDINAL] #> ; parsed: $MODEL$LONGITUDINAL$LONGITUDINAL #> input = {a, b, ka, V, Cl} #> #> DEFINITION: #> ; parsed: $MODEL$LONGITUDINAL$DEFINITION #> CONC = {distribution=normal, prediction=Cc, errorModel=combined1(a, b)} #> #> EQUATION: #> #> ; PK model definition #> Cc = pkmodel(ka, V, Cl) #> #> OUTPUT: #> ; parsed: $MODEL$LONGITUDINAL$OUTPUT #> output = Cc #> #> #> ; parsed: $FIT$FIT #> data = {CONC} #> model = {CONC} #> #> #> ; parsed: $PARAMETER$PARAMETER #> Cl_pop = {value=0.1, method=MLE} #> V_pop = {value=0.5, method=MLE} #> a = {value=1, method=MLE} #> b = {value=0.3, method=MLE} #> ka_pop = {value=1, method=MLE} #> omega_Cl = {value=1, method=MLE} #> omega_V = {value=1, method=MLE} #> omega_ka = {value=1, method=MLE} #> #> #> [TASKS] #> ; parsed: $MONOLIX$TASKS$TASKS #> populationParameters() #> individualParameters(method = {conditionalMean, conditionalMode}) #> fim(method = Linearization) #> logLikelihood(method = Linearization) #> plotResult(method = {indfits, obspred, vpc, residualsscatter, residualsdistribution, parameterdistribution, covariatemodeldiagnosis, randomeffects, covariancemodeldiagnosis, saemresults}) #> #> [SETTINGS] #> GLOBAL: #> ; parsed: $MONOLIX$SETTINGS$GLOBAL #> exportpath = 'tp' #> #> ; unparsed sections: #> ; $MODEL$LONGITUDINAL$EQUATION"},{"path":"/reference/monolix2rx.html","id":null,"dir":"Reference","previous_headings":"","what":"Translate a monolix file to rxode2 — monolix2rx","title":"Translate a monolix file to rxode2 — monolix2rx","text":"Translate monolix file rxode2","code":""},{"path":"/reference/monolix2rx.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Translate a monolix file to rxode2 — monolix2rx","text":"","code":"monolix2rx( mlxtran, update = TRUE, thetaMatType = c(\"sa\", \"lin\"), sd = 1, cor = 1e-05, theta = 0.5, ci = 0.95, sigdig = 3, envir = parent.frame() )"},{"path":"/reference/monolix2rx.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Translate a monolix file to rxode2 — monolix2rx","text":"mlxtran file name mlxtran translate rxode2 update boolean represents final parameter estimates used translation (present) thetaMatType lists preferred source thetaMat covariance matrix. default sa simulated annealing, though use lin linearized covariance calculation. one present, use whatever present sd Default standard deviation subject variability/inter-occasion variability missing. cor Default correlation missing correlations estimate theta default population estimate ci confidence interval validation, default 0.95 sigdig number significant digits validation, default 3 envir represents environment used evaluating corresponding rxode2 function","code":""},{"path":"/reference/monolix2rx.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Translate a monolix file to rxode2 — monolix2rx","text":"rxode2 model","code":""},{"path":"/reference/monolix2rx.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Translate a monolix file to rxode2 — monolix2rx","text":"Matthew L. Fidler","code":""},{"path":"/reference/monolix2rx.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Translate a monolix file to rxode2 — monolix2rx","text":"","code":"# First load in the model; in this case the theo model # This is modified from the Monolix demos by saving the model # File as a text file (hence you can access without model library) # setup. # # This example is also included in the monolix2rx package, so # you refer to the location with `system.file()`: pkgTheo <- system.file(\"theo\", package=\"monolix2rx\") rx <- monolix2rx(file.path(pkgTheo, \"theophylline_project.mlxtran\")) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning: NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> #> #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done pkgCov <- system.file(\"cov\", package=\"monolix2rx\") rx <- monolix2rx(file.path(pkgCov, \"warfarin_covariate3_project.mlxtran\")) #> ℹ integrated model file 'oral1_1cpt_TlagkaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesSA.txt #> ℹ done #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> #> #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done rx #> ── rxode2-based free-form 2-cmt ODE model ────────────────────────────────────── #> ── Initalization: ── #> Fixed Effects ($theta): #> Tlag_pop ka_pop V_pop Cl_pop beta_V_tSex_F #> -0.25949800 0.35610590 2.13606937 -2.00665359 -0.38227857 #> beta_Cl_tSex_F a b #> -0.09383651 0.24818991 0.05086658 #> #> Omega ($omega): #> omega_Tlag omega_ka omega_V omega_Cl #> omega_Tlag 0.3836648 0.0000000 0.00000000 0.00000000 #> omega_ka 0.0000000 0.9857194 0.00000000 0.00000000 #> omega_V 0.0000000 0.0000000 0.02782834 0.00000000 #> omega_Cl 0.0000000 0.0000000 0.00000000 0.08142194 #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 depot #> 2 2 central #> ── μ-referencing ($muRefTable): ── #> theta eta level covariates #> 1 Tlag_pop omega_Tlag id #> 2 ka_pop omega_ka id #> 3 V_pop omega_V id (tSex == \"F\")*beta_V_tSex_F #> 4 Cl_pop omega_Cl id (tSex == \"F\")*beta_Cl_tSex_F #> #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is extravascular with a first order absorption (rate constant ka) and a lag time (Tlag).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\" #> dfObs <- 479 #> dfSub <- 32 #> thetaMat <- lotri({ #> Tlag_pop ~ c(Tlag_pop = 0.0695270111760315) #> ka_pop ~ c(Tlag_pop = 0.00420093609313868, ka_pop = 0.195044017895198) #> V_pop ~ c(Tlag_pop = -1.96027567180685e-05, ka_pop = -0.00923639238851991, #> V_pop = 0.0894995626339569) #> beta_V_tSex_F ~ c(Tlag_pop = 0.000672864307227817, ka_pop = 0.00146099695978716, #> V_pop = -0.0105938787089785, beta_V_tSex_F = 0.00724034) #> Cl_pop ~ c(Tlag_pop = 3.33517518294536e-05, ka_pop = -0.000198349948605509, #> V_pop = 1.64480523051151e-05, beta_V_tSex_F = -2.52790128781238e-06, #> Cl_pop = 5.67721912406063e-05) #> beta_Cl_tSex_F ~ c(Tlag_pop = 4.97719167561125e-05, ka_pop = 0.00116960996255074, #> V_pop = -0.000127036295934593, beta_V_tSex_F = -1.29385e-06, #> Cl_pop = -0.000421700477175592, beta_Cl_tSex_F = 0.0199246) #> omega_Tlag ~ c(Tlag_pop = -0.0670860109353223, ka_pop = 0.00570893614027221, #> V_pop = 0.00299407684209903, beta_V_tSex_F = -0.00119581, #> Cl_pop = 2.03533460988456e-06, beta_Cl_tSex_F = -0.00034514, #> omega_Tlag = 0.116943) #> omega_ka ~ c(Tlag_pop = -0.0133385617208073, ka_pop = 0.0172356179141179, #> V_pop = 0.00171771988746332, beta_V_tSex_F = -0.000442385, #> Cl_pop = 7.3966470999696e-05, beta_Cl_tSex_F = -0.000725679, #> omega_Tlag = 0.0139898, omega_ka = 0.0694802) #> omega_V ~ c(Tlag_pop = -0.000154212149163577, ka_pop = 0.000300664573505569, #> V_pop = 4.67557030887738e-05, beta_V_tSex_F = -1.72411e-06, #> Cl_pop = -2.66907442804329e-06, beta_Cl_tSex_F = 2.11319e-05, #> omega_Tlag = 0.000296489, omega_ka = -0.000253742, #> omega_V = 0.000656055) #> omega_Cl ~ c(Tlag_pop = -0.00020876675474306, ka_pop = 0.000203991029463676, #> V_pop = -4.25014903301396e-05, beta_V_tSex_F = 1.01086e-05, #> Cl_pop = -4.27528356071897e-07, beta_Cl_tSex_F = -3.1184e-05, #> omega_Tlag = 0.000190543, omega_ka = -0.000195656, #> omega_V = 3.1147e-06, omega_Cl = 0.00133407) #> a ~ c(Tlag_pop = 0.000459922525965396, ka_pop = -0.000402122537073151, #> V_pop = -0.00035759769526248, beta_V_tSex_F = -5.67417e-07, #> Cl_pop = 4.93306085861609e-06, beta_Cl_tSex_F = 5.18592e-05, #> omega_Tlag = -0.000767474, omega_ka = -0.000402704, #> omega_V = -3.56563e-05, omega_Cl = 5.77815e-05, a = 0.00146135) #> b ~ c(Tlag_pop = -4.42123891106805e-05, ka_pop = 6.74134848256571e-05, #> V_pop = 0.000102247569651447, beta_V_tSex_F = -4.84525e-06, #> Cl_pop = -7.84308816660971e-07, beta_Cl_tSex_F = -4.64896e-06, #> omega_Tlag = 5.67197e-05, omega_ka = 4.06959e-05, #> omega_V = -4.39519e-06, omega_Cl = -1.31481e-05, #> a = -0.000214637, b = 5.66332e-05) #> }) #> validation <- c(\"ipred relative difference compared to Monolix ipred: 0.4%; 95% percentile: (0.02%,3.18%); rtol=0.00396\", #> \"ipred absolute difference compared to Monolix ipred: 95% percentile: (8.49e-05, 0.166); atol=0.0175\", #> \"pred relative difference compared to Monolix pred: 0%; 95% percentile: (0%,0%); rtol=1.21e-06\", #> \"pred absolute difference compared to Monolix pred: 95% percentile: (1.87e-08, 4.92e-05); atol=6.07e-06\", #> \"iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.24%,204.01%); rtol=0.0818\", #> \"iwres absolute difference compared to Monolix pred: 95% percentile: (0.0026, 0.33); atol=0.0364\") #> ini({ #> Tlag_pop <- -0.259498000083172 #> ka_pop <- 0.356105897545116 #> V_pop <- 2.1360693683596 #> Cl_pop <- -2.00665359474148 #> beta_V_tSex_F <- -0.382278567256413 #> beta_Cl_tSex_F <- -0.0938365059053137 #> a <- c(0, 0.24818990819019) #> b <- c(0, 0.0508665778176092) #> omega_Tlag ~ 0.383664766381593 #> omega_ka ~ 0.985719433448741 #> omega_V ~ 0.0278283386496708 #> omega_Cl ~ 0.0814219400052839 #> }) #> model({ #> cmt(depot) #> cmt(central) #> if (sex == 0) { #> tSex <- \"F\" #> } #> else if (sex == 1) { #> tSex <- \"M\" #> } #> else { #> tSex <- \"M\" #> } #> Tlag <- exp(Tlag_pop + omega_Tlag) #> ka <- exp(ka_pop + omega_ka) #> V <- exp(V_pop + beta_V_tSex_F * (tSex == \"F\") + omega_V) #> Cl <- exp(Cl_pop + beta_Cl_tSex_F * (tSex == \"F\") + omega_Cl) #> d/dt(depot) <- -ka * depot #> alag(depot) <- Tlag #> d/dt(central) <- +ka * depot - Cl/V * central #> Cc <- central/V #> concentration <- Cc #> concentration ~ add(a) + prop(b) + combined1() #> }) #> }"},{"path":"/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. ggplot2 autoplot lotri lotri magrittr %>% rxode2 expit, ini, logit, model, model<-, rxode, RxODE, rxode2, rxRename, rxSolve, rxUiGet","code":""},{"path":"/news/index.html","id":"monolix2rx-004","dir":"Changelog","previous_headings":"","what":"monolix2rx 0.0.4","title":"monolix2rx 0.0.4","text":"Added ignoreline support #22","code":""},{"path":"/news/index.html","id":"monolix2rx-003","dir":"Changelog","previous_headings":"","what":"monolix2rx 0.0.3","title":"monolix2rx 0.0.3","text":"CRAN release: 2024-10-24 initial conditions starting rxCov_ don’t add ini","code":""},{"path":"/news/index.html","id":"monolix2rx-002","dir":"Changelog","previous_headings":"","what":"monolix2rx 0.0.2","title":"monolix2rx 0.0.2","text":"CRAN release: 2024-09-20 Remove rxode2parse LinkingTo Add urls website Remove sentence residual specification always captured. Right now ‘Monolix’ always .","code":""},{"path":"/news/index.html","id":"monolix2rx-001","dir":"Changelog","previous_headings":"","what":"monolix2rx 0.0.1","title":"monolix2rx 0.0.1","text":"CRAN release: 2024-09-20 Initial CRAN submission.","code":""}] +[{"path":"/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 monolix2rx authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"/articles/convert-nlmixr2.html","id":"creating-a-nlmixr2-compatible-model","dir":"Articles","previous_headings":"","what":"Creating a nlmixr2 compatible model","title":"Converting Monolix fit to nlmixr2 fit","text":"Unlike nonmem2rx, residuals specification can converted efficiently nlmixr2 residual syntax.","code":""},{"path":"/articles/convert-nlmixr2.html","id":"example","dir":"Articles","previous_headings":"","what":"Example","title":"Converting Monolix fit to nlmixr2 fit","text":"","code":"library(babelmixr2) # will re-export much of monolix2rx #> Loading required package: nlmixr2 #> Loading required package: nlmixr2data # You use the path to the monolix mlxtran file # In this case we will us the theophylline project included in monolix2rx pkgTheo <- system.file(\"theo/theophylline_project.mlxtran\", package=\"monolix2rx\") # Note you have to setup monolix2rx to use the model library or save the model as a separate file mod <- monolix2rx(pkgTheo) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning in .dataRenameFromMlxtran(data, .mlxtran): NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done print(mod) #> ── rxode2-based free-form 2-cmt ODE model ────────────────────────────────────── #> ── Initalization: ── #> Fixed Effects ($theta): #> ka_pop V_pop Cl_pop a b #> 0.42699448 -0.78635157 -3.21457598 0.43327956 0.05425953 #> #> Omega ($omega): #> omega_ka omega_V omega_Cl #> omega_ka 0.4503145 0.00000000 0.00000000 #> omega_V 0.0000000 0.01594701 0.00000000 #> omega_Cl 0.0000000 0.00000000 0.07323701 #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 depot #> 2 2 central #> ── μ-referencing ($muRefTable): ── #> theta eta level #> 1 ka_pop omega_ka id #> 2 V_pop omega_V id #> 3 Cl_pop omega_Cl id #> #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is extravascular with a first order absorption (rate constant ka).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\\nThis has been modified so that it will run without the model library\" #> dfObs <- 120 #> dfSub <- 12 #> thetaMat <- lotri({ #> ka_pop ~ 0.09785 #> V_pop ~ c(0.00082606, 0.00041937) #> Cl_pop ~ c(-4.2833e-05, -6.7957e-06, 1.1318e-05) #> omega_ka ~ c(omega_ka = 0.022259) #> omega_V ~ c(omega_ka = -7.6443e-05, omega_V = 0.0014578) #> omega_Cl ~ c(omega_ka = 3.062e-06, omega_V = -1.2912e-05, #> omega_Cl = 0.0039578) #> a ~ c(omega_ka = -0.0001227, omega_V = -6.5914e-05, omega_Cl = -0.00041194, #> a = 0.015333) #> b ~ c(omega_ka = -1.3886e-05, omega_V = -3.1105e-05, #> omega_Cl = 5.2805e-05, a = -0.0026458, b = 0.00056232) #> }) #> validation <- c(\"ipred relative difference compared to Monolix ipred: 0.04%; 95% percentile: (0%,0.52%); rtol=0.00038\", #> \"ipred absolute difference compared to Monolix ipred: 95% percentile: (0.000362, 0.00848); atol=0.00254\", #> \"pred relative difference compared to Monolix pred: 0%; 95% percentile: (0%,0%); rtol=6.6e-07\", #> \"pred absolute difference compared to Monolix pred: 95% percentile: (1.6e-07, 1.27e-05); atol=3.66e-06\", #> \"iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.06%,32.22%); rtol=0.0153\", #> \"iwres absolute difference compared to Monolix pred: 95% percentile: (0.000403, 0.0138); atol=0.00305\") #> ini({ #> ka_pop <- 0.426994483535611 #> V_pop <- -0.786351566327091 #> Cl_pop <- -3.21457597916301 #> a <- c(0, 0.433279557549051) #> b <- c(0, 0.0542595276206251) #> omega_ka ~ 0.450314511978718 #> omega_V ~ 0.0159470121255372 #> omega_Cl ~ 0.0732370098834837 #> }) #> model({ #> cmt(depot) #> cmt(central) #> ka <- exp(ka_pop + omega_ka) #> V <- exp(V_pop + omega_V) #> Cl <- exp(Cl_pop + omega_Cl) #> d/dt(depot) <- -ka * depot #> d/dt(central) <- +ka * depot - Cl/V * central #> Cc <- central/V #> CONC <- Cc #> CONC ~ add(a) + prop(b) + combined1() #> }) #> }"},{"path":"/articles/convert-nlmixr2.html","id":"converting-the-model-to-a-nlmixr2-fit","dir":"Articles","previous_headings":"Example","what":"Converting the model to a nlmixr2 fit","title":"Converting Monolix fit to nlmixr2 fit","text":"rxode2() model : Qualifies NONMEM model, nlmixr2 compatible residuals can convert nlmixr2 fit object babelmixr2:","code":"library(babelmixr2) fit <- as.nlmixr2(mod) #> → loading into symengine environment... #> → pruning branches (`if`/`else`) of full model... #> ✔ done #> → finding duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → optimizing duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → compiling EBE model... #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ✔ done #> rxode2 3.0.2.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()` #> → Calculating residuals/tables #> ✔ done #> → compress origData in nlmixr2 object, save 7168 #> ℹ monolix parameter history integrated into fit object # If you want you can use nlmixr2, to add cwres to this fit: fit <- addCwres(fit) #> → loading into symengine environment... #> → pruning branches (`if`/`else`) of full model... #> ✔ done #> → calculate jacobian #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → calculate sensitivities #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → calculate ∂(f)/∂(η) #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → calculate ∂(R²)/∂(η) #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → finding duplicate expressions in inner model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → optimizing duplicate expressions in inner model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → finding duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → optimizing duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → compiling inner model... #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ✔ done #> → finding duplicate expressions in FD model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → optimizing duplicate expressions in FD model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → compiling EBE model... #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ✔ done #> → compiling events FD model... #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ✔ done #> → Calculating residuals/tables #> ✔ done library(ggplot2) ggplot(fit, aes(PRED, CWRES)) + geom_point() + rxode2::rxTheme()"},{"path":"/articles/create-augPred.html","id":"step-1-convert-the-monolix-model-to-rxode2","dir":"Articles","previous_headings":"","what":"Step 1: Convert the Monolix model to rxode2:","title":"Created Augmented pred/ipred plots with `augPred()`","text":"","code":"library(monolix2rx) # First we need the location of the monolix mlxtran file. Since we are # running an example, we will use one of the built-in examples in # `monolix2rx` pkgTheo <- system.file(\"theo/theophylline_project.mlxtran\", package=\"monolix2rx\") # You can use a control stream or other file. With the development # version of `babelmixr2`, you can simply point to the listing file mod <- monolix2rx(pkgTheo) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning in .dataRenameFromMlxtran(data, .mlxtran): NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done"},{"path":"/articles/create-augPred.html","id":"step-2-convert-the-rxode2-model-to-nlmixr2","dir":"Articles","previous_headings":"","what":"Step 2: convert the rxode2 model to nlmixr2","title":"Created Augmented pred/ipred plots with `augPred()`","text":"can convert model, mod, nlmixr2 fit object:","code":"library(babelmixr2) # provides as.nlmixr2 #> Loading required package: nlmixr2 #> Loading required package: nlmixr2data fit <- as.nlmixr2(mod) #> → loading into symengine environment... #> → pruning branches (`if`/`else`) of full model... #> ✔ done #> → finding duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → optimizing duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → compiling EBE model... #> ✔ done #> rxode2 3.0.2.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()` #> → Calculating residuals/tables #> ✔ done #> → compress origData in nlmixr2 object, save 7168 #> ℹ monolix parameter history integrated into fit object fit #> ── nlmixr² monolix2rx reading Monolix ver 5.1.1 ── #> #> OBJF AIC BIC Log-likelihood Condition#(Cov) #> monolix 118.9368 355.482 377.7819 -169.741 21.26161 #> Condition#(Cor) #> monolix 1.383153 #> #> ── Time (sec fit$time): ── #> #> setup optimize covariance table compress as.nlmixr2 #> elapsed 0.031842 4e-06 5e-06 0.056 0.007 2.091 #> #> ── Population Parameters (fit$parFixed or fit$parFixedDf): ── #> #> Est. SE %RSE Back-transformed(95%CI) BSV(CV%) Shrink(SD)% #> ka_pop 0.427 0.204 47.8 1.53 (1.03, 2.29) 75.4 1.05% #> V_pop -0.786 0.045 5.72 0.456 (0.417, 0.497) 12.7 13.3% #> Cl_pop -3.21 0.0837 2.61 0.0402 (0.0341, 0.0473) 27.6 2.65% #> a 0.433 0.433 #> b 0.0543 0.0543 #> #> Covariance Type (fit$covMethod): monolix2rx #> No correlations in between subject variability (BSV) matrix #> Full BSV covariance (fit$omega) or correlation (fit$omegaR; diagonals=SDs) #> Distribution stats (mean/skewness/kurtosis/p-value) available in fit$shrink #> Censoring (fit$censInformation): No censoring #> Minimization message (fit$message): #> IPRED relative difference compared to Monolix IPRED: 0.04%; 95% percentile: (0%,0.52%); rtol=0.000379 #> PRED relative difference compared to Monolix PRED: 0%; 95% percentile: (0%,0%); rtol=4.94e-07 #> IPRED absolute difference compared to Monolix IPRED: atol=0.00253; 95% percentile: (0.000364, 0.00848) #> PRED absolute difference compared to Monolix PRED: atol=4.94e-07; 95% percentile: (1.13e-08, 0.000308) #> #> ── Fit Data (object fit is a modified tibble): ── #> # A tibble: 120 × 20 #> ID TIME DV PRED RES IPRED IRES IWRES omega_ka omega_V #> #> 1 1 0.25 2.84 2.78 0.0636 3.73 -0.887 -1.40 0.132 -0.183 #> 2 1 0.57 6.57 5.00 1.57 6.57 0.00239 0.00303 0.132 -0.183 #> 3 1 1.12 10.5 6.80 3.70 8.75 1.75 1.93 0.132 -0.183 #> # ℹ 117 more rows #> # ℹ 10 more variables: omega_Cl , CONC , depot , central , #> # ka , V , Cl , Cc , tad , dosenum "},{"path":"/articles/create-augPred.html","id":"step-3-create-and-plot-an-augmented-prediction","dir":"Articles","previous_headings":"","what":"Step 3: Create and plot an augmented prediction","title":"Created Augmented pred/ipred plots with `augPred()`","text":"","code":"ap <- augPred(fit) #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ head(ap) #> values ind id time Endpoint #> 1 0.000000 Individual 1 0.000 depot #> 2 3.726962 Individual 1 0.250 depot #> 3 6.030526 Individual 1 0.493 depot #> 4 6.567601 Individual 1 0.570 depot #> 5 8.414706 Individual 1 0.986 depot #> 6 8.746028 Individual 1 1.120 depot # This augpred looks odd: plot(ap)"},{"path":"/articles/create-office.html","id":"step-1-import-the-model-into-monolix2rx","dir":"Articles","previous_headings":"","what":"Step 1: import the model into monolix2rx","title":"Create PowerPoint and Word documents using monolix2rx","text":"","code":"library(monolix2rx) library(babelmixr2) #> Loading required package: nlmixr2 #> Loading required package: nlmixr2data library(nlmixr2rpt) library(onbrand) library(nonmem2rx) # First we need the location of the monolix mlxtran file. Since we are # running an example, we will use one of the built-in examples in # `monolix2rx` pkgTheo <- system.file(\"theo/theophylline_project.mlxtran\", package=\"monolix2rx\") # You can use a control stream or other file. With the development # version of `babelmixr2`, you can simply point to the listing file mod <- monolix2rx(pkgTheo) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning in .dataRenameFromMlxtran(data, .mlxtran): NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done"},{"path":"/articles/create-office.html","id":"step-2-convert-the-rxode2-model-to-nlmixr2","dir":"Articles","previous_headings":"","what":"Step 2: convert the rxode2 model to nlmixr2","title":"Create PowerPoint and Word documents using monolix2rx","text":"can convert model, mod, nlmixr2 fit object: cmt(depot)cmt(central)ka=exp(ka_pop+omega_ka)V=exp(V_pop+omega_V)Cl=exp(Cl_pop+omega_Cl)ddepotdt=−ka×depotdcentraldt=+ka×depot−ClV×centralCc=centralVCONC=CcCONC∼add()+prop(b)+combined1()\\begin{align*} cmt({depot}) \\\\ cmt({central}) \\\\ {ka} & = \\exp\\left({ka\\_pop}+{omega\\_ka}\\right) \\\\ {V} & = \\exp\\left({V\\_pop}+{omega\\_V}\\right) \\\\ {Cl} & = \\exp\\left({Cl\\_pop}+{omega\\_Cl}\\right) \\\\ \\frac{d \\: depot}{dt} & = -{ka} {\\times} {depot} \\\\ \\frac{d \\: central}{dt} & = +{ka} {\\times} {depot}-\\frac{{Cl}}{{V}} {\\times} {central} \\\\ {Cc} & = \\frac{{central}}{{V}} \\\\ {CONC} & = {Cc} \\\\ {CONC} & \\sim add({})+prop({b})+combined1() \\end{align*}","code":"fit <- as.nlmixr2(mod) #> → loading into symengine environment... #> → pruning branches (`if`/`else`) of full model... #> ✔ done #> → finding duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → optimizing duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → compiling EBE model... #> ✔ done #> rxode2 3.0.2.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()` #> → Calculating residuals/tables #> ✔ done #> → compress origData in nlmixr2 object, save 7168 #> ℹ monolix parameter history integrated into fit object fit"},{"path":"/articles/create-office.html","id":"step-3-create-a-powerpoint-file","dir":"Articles","previous_headings":"","what":"Step 3: Create a PowerPoint file","title":"Create PowerPoint and Word documents using monolix2rx","text":"PowerPoint can created custom powerpoint templates, example use ones come nlmixr2rpt directly: gives powerpoint ","code":"obnd_pptx = read_template( template = system.file(package=\"nlmixr2rpt\", \"templates\",\"nlmixr_obnd_template.pptx\"), mapping = system.file(package=\"nlmixr2rpt\", \"templates\",\"nlmixr_obnd_template.yaml\")) obnd_pptx = report_fit( fit = fit, obnd = obnd_pptx) #> #> Attaching package: 'xpose' #> The following object is masked from 'package:stats': #> #> filter #> Registered S3 method overwritten by 'GGally': #> method from #> +.gg ggplot2 #> #> Attaching package: 'ggPMX' #> The following object is masked from 'package:xpose': #> #> get_data #> → Calculating residuals/tables #> ✔ done #> Warning in xpose.nlmixr2::xpose_data_nlmixr(fit): Added CWRES to fit (using #> nlmixr2::addCwres)... #> Skipping table: skip_table (NA found, not generated) #> Skipping figure: res_vs_pred_idv (NA found, not generated) #> Skipping figure: eta_cont (NA found, not generated) #> Skipping figure: eta_cat (NA found, not generated) #> Skipping figure: skip_figure (NA found, not generated) save_report(obnd_pptx, \"mod-PowerPoint.pptx\") #> $isgood #> [1] TRUE #> #> $msgs #> NULL"},{"path":"/articles/create-office.html","id":"step-4-create-a-word-file","dir":"Articles","previous_headings":"","what":"Step 4: Create a Word file","title":"Create PowerPoint and Word documents using monolix2rx","text":"Just like PowerPoint, can customizeown custom word templates, example use ones come nlmixr2rpt directly: gives word document ","code":"obnd_docx = read_template( template = system.file(package=\"nlmixr2rpt\", \"templates\",\"nlmixr_obnd_template.docx\"), mapping = system.file(package=\"nlmixr2rpt\", \"templates\",\"nlmixr_obnd_template.yaml\")) obnd_docx = report_fit( fit = fit, obnd = obnd_docx) #> → Calculating residuals/tables #> ✔ done #> Warning in xpose.nlmixr2::xpose_data_nlmixr(fit): Added CWRES to fit (using #> nlmixr2::addCwres)... #> Skipping figure: res_vs_pred_idv (NA found, not generated) #> Skipping figure: skip_figure (NA found, not generated) #> Skipping figure: eta_cont (NA found, not generated) #> Skipping figure: eta_cat (NA found, not generated) save_report(obnd_docx, \"mod-Word.docx\") #> $isgood #> [1] TRUE #> #> $msgs #> NULL"},{"path":"/articles/create-vpc.html","id":"step-1-convert-the-monolix-model-to-rxode2","dir":"Articles","previous_headings":"","what":"Step 1: Convert the Monolix model to rxode2:","title":"Easily Create a VPC using monolix2rx","text":"","code":"library(babelmixr2) #> Loading required package: nlmixr2 #> Loading required package: nlmixr2data library(monolix2rx) # First we need the location of the monolix mlxtran file. Since we are # running an example, we will use one of the built-in examples in # `monolix2rx` pkgTheo <- system.file(\"theo/theophylline_project.mlxtran\", package=\"monolix2rx\") # You can use a control stream or other file. With the development # version of `babelmixr2`, you can simply point to the listing file mod <- monolix2rx(pkgTheo) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning in .dataRenameFromMlxtran(data, .mlxtran): NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done"},{"path":"/articles/create-vpc.html","id":"step-2-convert-the-rxode2-model-to-nlmixr2","dir":"Articles","previous_headings":"","what":"Step 2: convert the rxode2 model to nlmixr2","title":"Easily Create a VPC using monolix2rx","text":"can convert model, mod, nlmixr2 fit object:","code":"fit <- as.nlmixr2(mod) #> → loading into symengine environment... #> → pruning branches (`if`/`else`) of full model... #> ✔ done #> → finding duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → optimizing duplicate expressions in EBE model... #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 #> → compiling EBE model... #> ✔ done #> rxode2 3.0.2.9000 using 2 threads (see ?getRxThreads) #> no cache: create with `rxCreateCache()` #> → Calculating residuals/tables #> ✔ done #> → compress origData in nlmixr2 object, save 7168 #> ℹ monolix parameter history integrated into fit object fit #> ── nlmixr² monolix2rx reading Monolix ver 5.1.1 ── #> #> OBJF AIC BIC Log-likelihood Condition#(Cov) #> monolix 118.9368 355.482 377.7819 -169.741 21.26161 #> Condition#(Cor) #> monolix 1.383153 #> #> ── Time (sec fit$time): ── #> #> setup optimize covariance table compress as.nlmixr2 #> elapsed 0.032426 5e-06 6e-06 0.056 0.006 2.139 #> #> ── Population Parameters (fit$parFixed or fit$parFixedDf): ── #> #> Est. SE %RSE Back-transformed(95%CI) BSV(CV%) Shrink(SD)% #> ka_pop 0.427 0.204 47.8 1.53 (1.03, 2.29) 75.4 1.05% #> V_pop -0.786 0.045 5.72 0.456 (0.417, 0.497) 12.7 13.3% #> Cl_pop -3.21 0.0837 2.61 0.0402 (0.0341, 0.0473) 27.6 2.65% #> a 0.433 0.433 #> b 0.0543 0.0543 #> #> Covariance Type (fit$covMethod): monolix2rx #> No correlations in between subject variability (BSV) matrix #> Full BSV covariance (fit$omega) or correlation (fit$omegaR; diagonals=SDs) #> Distribution stats (mean/skewness/kurtosis/p-value) available in fit$shrink #> Censoring (fit$censInformation): No censoring #> Minimization message (fit$message): #> IPRED relative difference compared to Monolix IPRED: 0.04%; 95% percentile: (0%,0.52%); rtol=0.000379 #> PRED relative difference compared to Monolix PRED: 0%; 95% percentile: (0%,0%); rtol=4.94e-07 #> IPRED absolute difference compared to Monolix IPRED: atol=0.00253; 95% percentile: (0.000364, 0.00848) #> PRED absolute difference compared to Monolix PRED: atol=4.94e-07; 95% percentile: (1.13e-08, 0.000308) #> #> ── Fit Data (object fit is a modified tibble): ── #> # A tibble: 120 × 20 #> ID TIME DV PRED RES IPRED IRES IWRES omega_ka omega_V #> #> 1 1 0.25 2.84 2.78 0.0636 3.73 -0.887 -1.40 0.132 -0.183 #> 2 1 0.57 6.57 5.00 1.57 6.57 0.00239 0.00303 0.132 -0.183 #> 3 1 1.12 10.5 6.80 3.70 8.75 1.75 1.93 0.132 -0.183 #> # ℹ 117 more rows #> # ℹ 10 more variables: omega_Cl , CONC , depot , central , #> # ka , V , Cl , Cc , tad , dosenum "},{"path":"/articles/create-vpc.html","id":"step-3-perform-the-vpc","dir":"Articles","previous_headings":"","what":"Step 3: Perform the VPC","title":"Easily Create a VPC using monolix2rx","text":"simply use vpcPlot() conjunction vpc package get regular prediction-corrected VPCs arrange single plot:","code":"library(ggplot2) p1 <- vpcPlot(fit, show=list(obs_dv=TRUE)) #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ p1 <- p1 + ylab(\"Concentrations\") + rxode2::rxTheme() + xlab(\"Time (hr)\") + xgxr::xgx_scale_x_time_units(\"hour\", \"hour\") p1a <- p1 + xgxr::xgx_scale_y_log10() ## A prediction-corrected VPC p2 <- vpcPlot(fit, pred_corr = TRUE, show=list(obs_dv=TRUE)) p2 <- p2 + ylab(\"Prediction-Corrected Concentrations\") + rxode2::rxTheme() + xlab(\"Time (hr)\") + xgxr::xgx_scale_x_time_units(\"hour\", \"hour\") p2a <- p2 + xgxr::xgx_scale_y_log10() library(patchwork) (p1 * p1a) / (p2 * p2a) #> Warning in transformation$transform(x): NaNs produced #> Warning in ggplot2::scale_y_log10(..., breaks = breaks, minor_breaks = #> minor_breaks, : log-10 transformation introduced infinite #> values. #> Warning in transformation$transform(x): NaNs produced #> Warning in ggplot2::scale_y_log10(..., breaks = breaks, minor_breaks = #> minor_breaks, : log-10 transformation introduced infinite #> values."},{"path":"/articles/rxode2-validate.html","id":"comparing-differences-between-monolix-and-rxode2","dir":"Articles","previous_headings":"","what":"Comparing differences between Monolix and rxode2","title":"Qualify rxode2 model against Monolix","text":"may wish see differences predictions Monolix rxode2. rxode2 generated outputs compared Monolix generated outputs following items: Population Predictions: shows model translation adequate simulate general trends; validate structural model’s population parameters coupled model structure. Individual Predictions: shows model translation able replicate values subjects within modeling data-set. validates model can reproduce subject variability observed study. Individual Weighted Residuals: one step individual parameter validation, couples individual predictions, observations residual specification generate individual weighted residuals. included consistent nonmem2rx residuals. However, since needed manually adjust residual errors, simply looks errors converted correctly. Note: part validated three metrics subject covariance matrix, omega. assume correct long read correctly.","code":""},{"path":"/articles/rxode2-validate.html","id":"comparing-numerically","dir":"Articles","previous_headings":"","what":"Comparing numerically","title":"Qualify rxode2 model against Monolix","text":"want numerical differences, can also get modified returned ui object. rtol, atol follows : can see exactly match close (say validate). However can explore difference wish looking ipredCompare predCompare datasets: cases can see Monolix seems round values 5 digits, rxode2 keeps everything since solved R directly. Note observation data compared. Dosing predictions excluded comparisons. can also explore Monolix translated input dataset used make validation predictions (dosing observations) $monolixData item:","code":"mod$iwresAtol #> 50% #> 0.003054349 mod$iwresRtol #> 50% #> 0.01526897 mod$ipredAtol #> 50% #> 0.002537436 mod$ipredRtol #> 50% #> 0.0003802867 mod$predAtol #> 50% #> 3.657152e-06 mod$predAtol #> 50% #> 3.657152e-06 head(mod$iwresCompare) #> id time monolixIwres iwres cmt #> 1 1 0.25 -1.397760000 -1.395682322 CONC #> 2 1 0.57 0.000121543 0.003040162 CONC #> 3 1 1.12 1.928970000 1.932039320 CONC #> 4 1 12.12 0.440294000 0.431149277 CONC #> 5 1 2.02 0.196493000 0.198287572 CONC #> 6 1 24.37 0.713742000 0.699508374 CONC head(mod$ipredCompare) #> id time monolixIpred ipred cmt #> 1 1 0.25 3.72839 3.726960 CONC #> 2 1 0.57 6.56990 6.567599 CONC #> 3 1 1.12 8.74855 8.746027 CONC #> 4 1 12.12 5.61508 5.621679 CONC #> 5 1 2.02 9.47386 9.472175 CONC #> 6 1 24.37 2.85999 2.868060 CONC head(mod$predCompare) #> id time monolixPred cmt pred #> 1 1 0.25 2.77640 CONC 2.776402 #> 2 1 0.57 4.99610 CONC 4.996088 #> 3 1 1.12 6.80090 CONC 6.800893 #> 4 1 12.12 3.21554 CONC 3.215548 #> 5 1 2.02 7.41259 CONC 7.412585 #> 6 1 24.37 1.09158 CONC 1.091582 head(mod$monolixData) # with nlme loaded you can also use getData(mod) #> id amt time dv WEIGHT SEX cmt admd #> 1 1 4.02 0.00 NA 79.6 NA NA #> 2 1 NA 0.25 2.84 79.6 NA NA #> 3 1 NA 0.57 6.57 79.6 NA NA #> 4 1 NA 1.12 10.50 79.6 NA NA #> 5 1 NA 2.02 9.66 79.6 NA NA #> 6 1 NA 3.82 8.58 79.6 NA NA"},{"path":"/articles/rxode2-validate.html","id":"comparing-visually","dir":"Articles","previous_headings":"","what":"Comparing visually","title":"Qualify rxode2 model against Monolix","text":"easiest way visually compare differences plot method:","code":"plot(mod) # for general plot # you can also see individual comparisons plot(mod, log=\"y\", ncol=2, nrow=2, xlab=\"Time (hr)\", ylab=\"Concentrations\", page=1) # If you want all pages you could use: # plot(mod, log=\"y\", ncol=2, nrow=2, xlab=\"Time (hr)\", ylab=\"Concentrations\", page=TRUE)"},{"path":"/articles/rxode2-validate.html","id":"notes-on-validation","dir":"Articles","previous_headings":"","what":"Notes on validation","title":"Qualify rxode2 model against Monolix","text":"validation model uses best data available Monolix estimates. : theta population parameters eta individual parameters omega sigma matrices captured. nlmixr2 model fully qualified, IWRES validation ensures residual errors specified correctly. Otherwise omega sigma values contribute validation. Also overall covariance captured, used validation.","code":""},{"path":"/articles/simulate-extra-items.html","id":"step-1-import-the-model","dir":"Articles","previous_headings":"","what":"Step 1: Import the model","title":"Simulate Derived Variables from imported Monolix model","text":"","code":"library(monolix2rx) library(rxode2) # First we need the location of the nonmem control stream Since we are running an example, we will use one of the built-in examples in `nonmem2rx` ctlFile <- system.file(\"mods/cpt/runODE032.ctl\", package=\"nonmem2rx\") # You can use a control stream or other file. With the development # version of `babelmixr2`, you can simply point to the listing file # You use the path to the monolix mlxtran file # In this case we will us the theophylline project included in monolix2rx pkgTheo <- system.file(\"theo/theophylline_project.mlxtran\", package=\"monolix2rx\") # Note you have to setup monolix2rx to use the model library or save # the model as a separate file mod <- monolix2rx(pkgTheo) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning in .dataRenameFromMlxtran(data, .mlxtran): NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done print(mod) #> ── rxode2-based free-form 2-cmt ODE model ────────────────────────────────────── #> ── Initalization: ── #> Fixed Effects ($theta): #> ka_pop V_pop Cl_pop a b #> 0.42699448 -0.78635157 -3.21457598 0.43327956 0.05425953 #> #> Omega ($omega): #> omega_ka omega_V omega_Cl #> omega_ka 0.4503145 0.00000000 0.00000000 #> omega_V 0.0000000 0.01594701 0.00000000 #> omega_Cl 0.0000000 0.00000000 0.07323701 #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 depot #> 2 2 central #> ── μ-referencing ($muRefTable): ── #> theta eta level #> 1 ka_pop omega_ka id #> 2 V_pop omega_V id #> 3 Cl_pop omega_Cl id #> #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is extravascular with a first order absorption (rate constant ka).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\\nThis has been modified so that it will run without the model library\" #> dfObs <- 120 #> dfSub <- 12 #> thetaMat <- lotri({ #> ka_pop ~ 0.09785 #> V_pop ~ c(0.00082606, 0.00041937) #> Cl_pop ~ c(-4.2833e-05, -6.7957e-06, 1.1318e-05) #> omega_ka ~ c(omega_ka = 0.022259) #> omega_V ~ c(omega_ka = -7.6443e-05, omega_V = 0.0014578) #> omega_Cl ~ c(omega_ka = 3.062e-06, omega_V = -1.2912e-05, #> omega_Cl = 0.0039578) #> a ~ c(omega_ka = -0.0001227, omega_V = -6.5914e-05, omega_Cl = -0.00041194, #> a = 0.015333) #> b ~ c(omega_ka = -1.3886e-05, omega_V = -3.1105e-05, #> omega_Cl = 5.2805e-05, a = -0.0026458, b = 0.00056232) #> }) #> validation <- c(\"ipred relative difference compared to Monolix ipred: 0.04%; 95% percentile: (0%,0.52%); rtol=0.00038\", #> \"ipred absolute difference compared to Monolix ipred: 95% percentile: (0.000362, 0.00848); atol=0.00254\", #> \"pred relative difference compared to Monolix pred: 0%; 95% percentile: (0%,0%); rtol=6.6e-07\", #> \"pred absolute difference compared to Monolix pred: 95% percentile: (1.6e-07, 1.27e-05); atol=3.66e-06\", #> \"iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.06%,32.22%); rtol=0.0153\", #> \"iwres absolute difference compared to Monolix pred: 95% percentile: (0.000403, 0.0138); atol=0.00305\") #> ini({ #> ka_pop <- 0.426994483535611 #> V_pop <- -0.786351566327091 #> Cl_pop <- -3.21457597916301 #> a <- c(0, 0.433279557549051) #> b <- c(0, 0.0542595276206251) #> omega_ka ~ 0.450314511978718 #> omega_V ~ 0.0159470121255372 #> omega_Cl ~ 0.0732370098834837 #> }) #> model({ #> cmt(depot) #> cmt(central) #> ka <- exp(ka_pop + omega_ka) #> V <- exp(V_pop + omega_V) #> Cl <- exp(Cl_pop + omega_Cl) #> d/dt(depot) <- -ka * depot #> d/dt(central) <- +ka * depot - Cl/V * central #> Cc <- central/V #> CONC <- Cc #> CONC ~ add(a) + prop(b) + combined1() #> }) #> }"},{"path":"/articles/simulate-extra-items.html","id":"step-2-add-auc-calculation","dir":"Articles","previous_headings":"","what":"Step 2: Add AUC calculation","title":"Simulate Derived Variables from imported Monolix model","text":"concentration case Cc model, trick get AUC additional ODE d/dt(AUC) <- Cc use reset get per dosing period. However, additional parameter part original model. calculation AUC depend number observations model, sparse data wouldn’t terribly accurate. One thing can use model piping append d/dt(AUC) <- Cc imported model: can also use append=NA pre-pend append=f put ODE right f line model.","code":"modAuc <- mod %>% model(d/dt(AUC) <- Cc, append=TRUE) #> → significant model change detected #> → kept in model: '$monolixData' #> → removed from model: '$admd', '$etaData', '$ipredAtol', '$ipredCompare', '$ipredRtol', '$iwresAtol', '$iwresCompare', '$iwresRtol', '$mlxtran', '$predAtol', '$predCompare', '$predIpredData', '$predRtol' modAuc #> ── rxode2-based free-form 3-cmt ODE model ────────────────────────────────────── #> ── Initalization: ── #> Fixed Effects ($theta): #> ka_pop V_pop Cl_pop a b #> 0.42699448 -0.78635157 -3.21457598 0.43327956 0.05425953 #> #> Omega ($omega): #> omega_ka omega_V omega_Cl #> omega_ka 0.4503145 0.00000000 0.00000000 #> omega_V 0.0000000 0.01594701 0.00000000 #> omega_Cl 0.0000000 0.00000000 0.07323701 #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 depot #> 2 2 central #> 3 3 AUC #> ── μ-referencing ($muRefTable): ── #> theta eta level #> 1 ka_pop omega_ka id #> 2 V_pop omega_V id #> 3 Cl_pop omega_Cl id #> #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is extravascular with a first order absorption (rate constant ka).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\\nThis has been modified so that it will run without the model library\" #> dfObs <- 120 #> dfSub <- 12 #> thetaMat <- lotri({ #> ka_pop ~ 0.09785 #> V_pop ~ c(0.00082606, 0.00041937) #> Cl_pop ~ c(-4.2833e-05, -6.7957e-06, 1.1318e-05) #> omega_ka ~ c(omega_ka = 0.022259) #> omega_V ~ c(omega_ka = -7.6443e-05, omega_V = 0.0014578) #> omega_Cl ~ c(omega_ka = 3.062e-06, omega_V = -1.2912e-05, #> omega_Cl = 0.0039578) #> a ~ c(omega_ka = -0.0001227, omega_V = -6.5914e-05, omega_Cl = -0.00041194, #> a = 0.015333) #> b ~ c(omega_ka = -1.3886e-05, omega_V = -3.1105e-05, #> omega_Cl = 5.2805e-05, a = -0.0026458, b = 0.00056232) #> }) #> validation <- c(\"ipred relative difference compared to Monolix ipred: 0.04%; 95% percentile: (0%,0.52%); rtol=0.00038\", #> \"ipred absolute difference compared to Monolix ipred: 95% percentile: (0.000362, 0.00848); atol=0.00254\", #> \"pred relative difference compared to Monolix pred: 0%; 95% percentile: (0%,0%); rtol=6.6e-07\", #> \"pred absolute difference compared to Monolix pred: 95% percentile: (1.6e-07, 1.27e-05); atol=3.66e-06\", #> \"iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.06%,32.22%); rtol=0.0153\", #> \"iwres absolute difference compared to Monolix pred: 95% percentile: (0.000403, 0.0138); atol=0.00305\") #> ini({ #> ka_pop <- 0.426994483535611 #> V_pop <- -0.786351566327091 #> Cl_pop <- -3.21457597916301 #> a <- c(0, 0.433279557549051) #> b <- c(0, 0.0542595276206251) #> omega_ka ~ 0.450314511978718 #> omega_V ~ 0.0159470121255372 #> omega_Cl ~ 0.0732370098834837 #> }) #> model({ #> cmt(depot) #> cmt(central) #> ka <- exp(ka_pop + omega_ka) #> V <- exp(V_pop + omega_V) #> Cl <- exp(Cl_pop + omega_Cl) #> d/dt(depot) <- -ka * depot #> d/dt(central) <- +ka * depot - Cl/V * central #> Cc <- central/V #> CONC <- Cc #> CONC ~ add(a) + prop(b) + combined1() #> d/dt(AUC) <- Cc #> }) #> }"},{"path":"/articles/simulate-extra-items.html","id":"step-3-setup-event-table-to-calculate-the-auc-for-a-different-dosing-paradigm","dir":"Articles","previous_headings":"","what":"Step 3: Setup event table to calculate the AUC for a different dosing paradigm:","title":"Simulate Derived Variables from imported Monolix model","text":"Lets say case instead single dose, want see concentration profile single day BID dosing. case done creating quick event table. case since also wanting AUC per dosing period, can add reset dose AUC compartment every time dose given (track AUC current dose):","code":"ev <- et(amt=4, ii=12, until=24) %>% et(amt=0, ii=12, until=24, cmt=\"AUC\", evid=5) %>% # replace AUC with zero at dosing et(c(0, 4, 8, 11.999, 12, 12.01, 14, 20, 23.999, 24, 24.001, 28, 32, 36)) %>% et(id=1:10)"},{"path":"/articles/simulate-extra-items.html","id":"step-4-solve-using-rxode2","dir":"Articles","previous_headings":"","what":"Step 4: Solve using rxode2","title":"Simulate Derived Variables from imported Monolix model","text":"step, solve model new event table 10 subjects: Note since derived nonmem2rx model, default solving match tolerances methods specified NONMEM model.","code":"s <- rxSolve(modAuc, ev) #> ℹ using locf interpolation like Monolix, specify directly to change #> ℹ using Monolix specified atol=1e-06 #> ℹ using Monolix specified rtol=1e-06 #> ℹ Since Monolix doesn't use ssRtol, set ssRtol=100 #> ℹ Since Monolix doesn't use ssRtol, set ssAtol=100 #> ℹ Since Monolix uses a set number of doses for steady state use maxSS=8, minSS=7 #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’"},{"path":"/articles/simulate-extra-items.html","id":"step-5-exploring-the-simulation-by-plotting-and-summarizing-dplyr","dir":"Articles","previous_headings":"","what":"Step 5: Exploring the simulation (by plotting), and summarizing (dplyr)","title":"Simulate Derived Variables from imported Monolix model","text":"solved object acts rxode2 solved object, can use plot() function see individual running AUC profiles simulated: can also select points near dosing get AUC interval:","code":"library(ggplot2) plot(s, AUC) + ylab(\"Running AUC\") library(dplyr) #> #> Attaching package: 'dplyr' #> The following objects are masked from 'package:data.table': #> #> between, first, last #> The following objects are masked from 'package:stats': #> #> filter, lag #> The following objects are masked from 'package:base': #> #> intersect, setdiff, setequal, union s %>% filter(time %in% c(11.999, 23.999)) %>% mutate(time=round(time)) %>% select(id, time, AUC) #> id time AUC #> 1 1 12 71.67319 #> 2 1 24 102.46378 #> 3 2 12 62.73231 #> 4 2 24 91.10876 #> 5 3 12 62.42782 #> 6 3 24 86.37406 #> 7 4 12 44.99681 #> 8 4 24 59.71716 #> 9 5 12 58.29805 #> 10 5 24 81.99565 #> 11 6 12 51.33952 #> 12 6 24 66.40563 #> 13 7 12 71.35170 #> 14 7 24 95.19523 #> 15 8 12 57.10391 #> 16 8 24 81.70183 #> 17 9 12 51.23582 #> 18 9 24 67.72999 #> 19 10 12 45.90700 #> 20 10 24 61.53054"},{"path":"/articles/simulate-new-dosing.html","id":"step-1-import-the-model","dir":"Articles","previous_headings":"","what":"Step 1: Import the model","title":"Simulate New dosing from Monolix model","text":"","code":"library(monolix2rx) library(rxode2) # You use the path to the monolix mlxtran file # In this case we will us the theophylline project included in monolix2rx pkgTheo <- system.file(\"theo/theophylline_project.mlxtran\", package=\"monolix2rx\") # Note you have to setup monolix2rx to use the model library or save # the model as a separate file mod <- monolix2rx(pkgTheo) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning in .dataRenameFromMlxtran(data, .mlxtran): NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done print(mod) #> ── rxode2-based free-form 2-cmt ODE model ────────────────────────────────────── #> ── Initalization: ── #> Fixed Effects ($theta): #> ka_pop V_pop Cl_pop a b #> 0.42699448 -0.78635157 -3.21457598 0.43327956 0.05425953 #> #> Omega ($omega): #> omega_ka omega_V omega_Cl #> omega_ka 0.4503145 0.00000000 0.00000000 #> omega_V 0.0000000 0.01594701 0.00000000 #> omega_Cl 0.0000000 0.00000000 0.07323701 #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 depot #> 2 2 central #> ── μ-referencing ($muRefTable): ── #> theta eta level #> 1 ka_pop omega_ka id #> 2 V_pop omega_V id #> 3 Cl_pop omega_Cl id #> #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is extravascular with a first order absorption (rate constant ka).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\\nThis has been modified so that it will run without the model library\" #> dfObs <- 120 #> dfSub <- 12 #> thetaMat <- lotri({ #> ka_pop ~ 0.09785 #> V_pop ~ c(0.00082606, 0.00041937) #> Cl_pop ~ c(-4.2833e-05, -6.7957e-06, 1.1318e-05) #> omega_ka ~ c(omega_ka = 0.022259) #> omega_V ~ c(omega_ka = -7.6443e-05, omega_V = 0.0014578) #> omega_Cl ~ c(omega_ka = 3.062e-06, omega_V = -1.2912e-05, #> omega_Cl = 0.0039578) #> a ~ c(omega_ka = -0.0001227, omega_V = -6.5914e-05, omega_Cl = -0.00041194, #> a = 0.015333) #> b ~ c(omega_ka = -1.3886e-05, omega_V = -3.1105e-05, #> omega_Cl = 5.2805e-05, a = -0.0026458, b = 0.00056232) #> }) #> validation <- c(\"ipred relative difference compared to Monolix ipred: 0.04%; 95% percentile: (0%,0.52%); rtol=0.00038\", #> \"ipred absolute difference compared to Monolix ipred: 95% percentile: (0.000362, 0.00848); atol=0.00254\", #> \"pred relative difference compared to Monolix pred: 0%; 95% percentile: (0%,0%); rtol=6.6e-07\", #> \"pred absolute difference compared to Monolix pred: 95% percentile: (1.6e-07, 1.27e-05); atol=3.66e-06\", #> \"iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.06%,32.22%); rtol=0.0153\", #> \"iwres absolute difference compared to Monolix pred: 95% percentile: (0.000403, 0.0138); atol=0.00305\") #> ini({ #> ka_pop <- 0.426994483535611 #> V_pop <- -0.786351566327091 #> Cl_pop <- -3.21457597916301 #> a <- c(0, 0.433279557549051) #> b <- c(0, 0.0542595276206251) #> omega_ka ~ 0.450314511978718 #> omega_V ~ 0.0159470121255372 #> omega_Cl ~ 0.0732370098834837 #> }) #> model({ #> cmt(depot) #> cmt(central) #> ka <- exp(ka_pop + omega_ka) #> V <- exp(V_pop + omega_V) #> Cl <- exp(Cl_pop + omega_Cl) #> d/dt(depot) <- -ka * depot #> d/dt(central) <- +ka * depot - Cl/V * central #> Cc <- central/V #> CONC <- Cc #> CONC ~ add(a) + prop(b) + combined1() #> }) #> }"},{"path":"/articles/simulate-new-dosing.html","id":"step-2-look-at-a-different-dosing-paradigm","dir":"Articles","previous_headings":"","what":"Step 2: Look at a different dosing paradigm","title":"Simulate New dosing from Monolix model","text":"Lets say case instead single dose, want see concentration profile single day BID dosing. case done creating quick event table:","code":"ev <- et(amt=4, ii=12, until=24) %>% et(list(c(0, 2), # add observations in windows c(4, 6), c(8, 12), c(14, 18), c(20, 26), c(28, 32), c(32, 36), c(36, 44))) %>% et(id=1:10)"},{"path":"/articles/simulate-new-dosing.html","id":"step-3-solve-using-rxode2","dir":"Articles","previous_headings":"","what":"Step 3: solve using rxode2","title":"Simulate New dosing from Monolix model","text":"step, solve model new event table 10 subjects: Note since nonmem2rx model, default solving match tolerances methods specified NONMEM model.","code":"s <- rxSolve(mod, ev) #> ℹ using locf interpolation like Monolix, specify directly to change #> ℹ using Monolix specified atol=1e-06 #> ℹ using Monolix specified rtol=1e-06 #> ℹ Since Monolix doesn't use ssRtol, set ssRtol=100 #> ℹ Since Monolix doesn't use ssRtol, set ssAtol=100 #> ℹ Since Monolix uses a set number of doses for steady state use maxSS=8, minSS=7 #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’"},{"path":"/articles/simulate-new-dosing.html","id":"step-4-exploring-the-simulation-by-plotting","dir":"Articles","previous_headings":"","what":"Step 4: exploring the simulation (by plotting)","title":"Simulate New dosing from Monolix model","text":"solved object acts rxode2 solved object, can use plot() function see individual profiles simulated:","code":"library(ggplot2) plot(s, ipredSim) + ylab(\"Concentrations\")"},{"path":"/articles/simulate-uncertainty.html","id":"step-1-import-the-model","dir":"Articles","previous_headings":"","what":"Step 1: Import the model","title":"Simulate using Parameter Uncertainty","text":"","code":"library(monolix2rx) library(rxode2) # its best practice to set the seed for the simulations set.seed(42) rxSetSeed(42) # You use the path to the monolix mlxtran file # In this case we will us the theophylline project included in monolix2rx pkgTheo <- system.file(\"theo/theophylline_project.mlxtran\", package=\"monolix2rx\") # Note you have to setup monolix2rx to use the model library or save # the model as a separate file mod <- monolix2rx(pkgTheo) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning in .dataRenameFromMlxtran(data, .mlxtran): NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done print(mod) #> ── rxode2-based free-form 2-cmt ODE model ────────────────────────────────────── #> ── Initalization: ── #> Fixed Effects ($theta): #> ka_pop V_pop Cl_pop a b #> 0.42699448 -0.78635157 -3.21457598 0.43327956 0.05425953 #> #> Omega ($omega): #> omega_ka omega_V omega_Cl #> omega_ka 0.4503145 0.00000000 0.00000000 #> omega_V 0.0000000 0.01594701 0.00000000 #> omega_Cl 0.0000000 0.00000000 0.07323701 #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 depot #> 2 2 central #> ── μ-referencing ($muRefTable): ── #> theta eta level #> 1 ka_pop omega_ka id #> 2 V_pop omega_V id #> 3 Cl_pop omega_Cl id #> #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is extravascular with a first order absorption (rate constant ka).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\\nThis has been modified so that it will run without the model library\" #> dfObs <- 120 #> dfSub <- 12 #> thetaMat <- lotri({ #> ka_pop ~ 0.09785 #> V_pop ~ c(0.00082606, 0.00041937) #> Cl_pop ~ c(-4.2833e-05, -6.7957e-06, 1.1318e-05) #> omega_ka ~ c(omega_ka = 0.022259) #> omega_V ~ c(omega_ka = -7.6443e-05, omega_V = 0.0014578) #> omega_Cl ~ c(omega_ka = 3.062e-06, omega_V = -1.2912e-05, #> omega_Cl = 0.0039578) #> a ~ c(omega_ka = -0.0001227, omega_V = -6.5914e-05, omega_Cl = -0.00041194, #> a = 0.015333) #> b ~ c(omega_ka = -1.3886e-05, omega_V = -3.1105e-05, #> omega_Cl = 5.2805e-05, a = -0.0026458, b = 0.00056232) #> }) #> validation <- c(\"ipred relative difference compared to Monolix ipred: 0.04%; 95% percentile: (0%,0.52%); rtol=0.00038\", #> \"ipred absolute difference compared to Monolix ipred: 95% percentile: (0.000362, 0.00848); atol=0.00254\", #> \"pred relative difference compared to Monolix pred: 0%; 95% percentile: (0%,0%); rtol=6.6e-07\", #> \"pred absolute difference compared to Monolix pred: 95% percentile: (1.6e-07, 1.27e-05); atol=3.66e-06\", #> \"iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.06%,32.22%); rtol=0.0153\", #> \"iwres absolute difference compared to Monolix pred: 95% percentile: (0.000403, 0.0138); atol=0.00305\") #> ini({ #> ka_pop <- 0.426994483535611 #> V_pop <- -0.786351566327091 #> Cl_pop <- -3.21457597916301 #> a <- c(0, 0.433279557549051) #> b <- c(0, 0.0542595276206251) #> omega_ka ~ 0.450314511978718 #> omega_V ~ 0.0159470121255372 #> omega_Cl ~ 0.0732370098834837 #> }) #> model({ #> cmt(depot) #> cmt(central) #> ka <- exp(ka_pop + omega_ka) #> V <- exp(V_pop + omega_V) #> Cl <- exp(Cl_pop + omega_Cl) #> d/dt(depot) <- -ka * depot #> d/dt(central) <- +ka * depot - Cl/V * central #> Cc <- central/V #> CONC <- Cc #> CONC ~ add(a) + prop(b) + combined1() #> }) #> }"},{"path":"/articles/simulate-uncertainty.html","id":"step-2-look-at-a-different-dosing-paradigm","dir":"Articles","previous_headings":"","what":"Step 2: Look at a different dosing paradigm","title":"Simulate using Parameter Uncertainty","text":"Lets say case instead single dose, want see concentration profile single day BID dosing. case done creating quick event table.","code":"ev <- et(amt=4, ii=12, until=24) %>% et(c(1:6, seq(8, 24, by=2))) %>% et(id=1:100)"},{"path":"/articles/simulate-uncertainty.html","id":"step-3-solve-using-the-uncertainty-in-the-nonmem-model","dir":"Articles","previous_headings":"","what":"Step 3: Solve using the uncertainty in the NONMEM model","title":"Simulate using Parameter Uncertainty","text":"use uncertainty model, simple matter telling many times rxode2() sample nStud=X. case use 100.","code":"s <- rxSolve(mod, ev, nStud=100) #> ℹ using locf interpolation like Monolix, specify directly to change #> ℹ using dfSub=12 from Monolix #> ℹ using dfObs=120 from Monolix #> ℹ using thetaMat from Monolix #> ℹ using Monolix specified atol=1e-06 #> ℹ using Monolix specified rtol=1e-06 #> ℹ Since Monolix doesn't use ssRtol, set ssRtol=100 #> ℹ Since Monolix doesn't use ssRtol, set ssAtol=100 #> ℹ Since Monolix uses a set number of doses for steady state use maxSS=8, minSS=7 #> [====|====|====|====|====|====|====|====|====|====] 0:00:00 s #> ── Solved rxode2 object ── #> ── Parameters (x$params): ── #> # A tibble: 10,000 × 10 #> sim.id id ka_pop V_pop Cl_pop a b omega_ka omega_V omega_Cl #> #> 1 1 1 0.281 -0.770 -3.22 0.475 0.0653 0.470 -0.208 0.483 #> 2 1 2 0.281 -0.770 -3.22 0.475 0.0653 0.654 0.0861 0.129 #> 3 1 3 0.281 -0.770 -3.22 0.475 0.0653 -0.0747 0.168 0.500 #> 4 1 4 0.281 -0.770 -3.22 0.475 0.0653 0.126 -0.0226 0.479 #> 5 1 5 0.281 -0.770 -3.22 0.475 0.0653 -0.162 0.000264 -0.205 #> 6 1 6 0.281 -0.770 -3.22 0.475 0.0653 -1.13 -0.239 0.0941 #> 7 1 7 0.281 -0.770 -3.22 0.475 0.0653 -0.335 0.0134 0.00490 #> 8 1 8 0.281 -0.770 -3.22 0.475 0.0653 -0.869 -0.239 0.000511 #> 9 1 9 0.281 -0.770 -3.22 0.475 0.0653 1.35 -0.122 0.667 #> 10 1 10 0.281 -0.770 -3.22 0.475 0.0653 0.314 0.0494 -0.552 #> # ℹ 9,990 more rows #> ── Initial Conditions (x$inits): ── #> depot central #> 0 0 #> #> Simulation with uncertainty in: #> • parameters (x$thetaMat for changes) #> • omega matrix (x$omegaList) #> • sigma matrix (x$sigmaList) #> #> ── First part of data (object): ── #> # A tibble: 150,000 × 12 #> sim.id id time ka V Cl Cc CONC ipredSim sim depot #> #> 1 1 1 1 2.12 0.376 0.0646 8.36 8.36 8.36 8.50 0.481 #> 2 1 1 2 2.12 0.376 0.0646 8.04 8.04 8.04 9.71 0.0577 #> 3 1 1 3 2.12 0.376 0.0646 6.90 6.90 6.90 7.77 0.00694 #> 4 1 1 4 2.12 0.376 0.0646 5.82 5.82 5.82 5.07 0.000833 #> 5 1 1 5 2.12 0.376 0.0646 4.91 4.91 4.91 4.91 0.000100 #> 6 1 1 6 2.12 0.376 0.0646 4.13 4.13 4.13 3.79 0.0000121 #> # ℹ 149,994 more rows #> # ℹ 1 more variable: central "},{"path":"/articles/simulate-uncertainty.html","id":"step-4-summarize-and-plot","dir":"Articles","previous_headings":"","what":"Step 4: Summarize and plot","title":"Simulate using Parameter Uncertainty","text":"Since bunch data, confidence band simulation uncertainty helpful. One way select interesting components, create confidence interval plot confidence bands:","code":"sci <- confint(s, parm=c(\"CONC\", \"sim\")) #> summarizing data...done sci #> # A tibble: 90 × 7 #> p1 time trt p2.5 p50 p97.5 Percentile #> #> 1 0.0250 1 CONC 0.741 2.40 4.39 2.5% #> 2 0.5 1 CONC 4.21 6.21 7.25 50% #> 3 0.975 1 CONC 7.89 9.32 11.1 97.5% #> 4 0.0250 2 CONC 1.33 3.80 5.59 2.5% #> 5 0.5 2 CONC 5.76 6.94 7.45 50% #> 6 0.975 2 CONC 8.22 9.14 10.6 97.5% #> 7 0.0250 3 CONC 1.79 4.36 5.42 2.5% #> 8 0.5 3 CONC 6.04 6.66 7.05 50% #> 9 0.975 3 CONC 7.79 8.71 9.99 97.5% #> 10 0.0250 4 CONC 2.12 4.36 5.26 2.5% #> # ℹ 80 more rows p1 <- plot(sci) p2 <- plot(sci, log=\"y\") library(patchwork) p1/p2"},{"path":"/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Matthew Fidler. Author, maintainer. Justin Wilkins. Contributor.","code":""},{"path":"/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Fidler M (2024). monolix2rx: Converts 'Monolix' Models 'rxode2'. R package version 0.0.4, https://github.com/nlmixr2/monolix2rx/, https://nlmixr2.github.io/monolix2rx/.","code":"@Manual{, title = {monolix2rx: Converts 'Monolix' Models to 'rxode2'}, author = {Matthew Fidler}, year = {2024}, note = {R package version 0.0.4, https://github.com/nlmixr2/monolix2rx/}, url = {https://nlmixr2.github.io/monolix2rx/}, }"},{"path":"/index.html","id":"monolix2rx-","dir":"","previous_headings":"","what":"Converts Monolix Models to rxode2","title":"Converts Monolix Models to rxode2","text":"goal monolix2rx convert Monolix rxode2 use simulation sharing model open-source framework.","code":""},{"path":"/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Converts Monolix Models to rxode2","text":"can install development version monolix2rx GitHub :","code":"# install.packages(\"devtools\") devtools::install_github(\"nlmixr2/monolix2rx\")"},{"path":"/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Converts Monolix Models to rxode2","text":"trying convert Monolix rxode2 model simply need path mlxtran file. example, classic demo theophylline included monolix2rx can imported :","code":"library(monolix2rx) # First load in the model; in this case the theo model # This is modified from the Monolix demos by saving the model # file as a text file (hence you can access without model library). # Additionally some of the file paths were shortened so they could # be included with monolix2rx pkgTheo <- system.file(\"theo\", package=\"monolix2rx\") mlxtranFile <- file.path(pkgTheo, \"theophylline_project.mlxtran\") rx <- monolix2rx(mlxtranFile) #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done rx #> ── rxode2-based free-form 2-cmt ODE model ────────────────────────────────────── #> ── Initalization: ── #> Fixed Effects ($theta): #> ka_pop V_pop Cl_pop a b #> 0.42699448 -0.78635157 -3.21457598 0.43327956 0.05425953 #> #> Omega ($omega): #> omega_ka omega_V omega_Cl #> omega_ka 0.4503145 0.00000000 0.00000000 #> omega_V 0.0000000 0.01594701 0.00000000 #> omega_Cl 0.0000000 0.00000000 0.07323701 #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 depot #> 2 2 central #> ── μ-referencing ($muRefTable): ── #> theta eta level #> 1 ka_pop omega_ka id #> 2 V_pop omega_V id #> 3 Cl_pop omega_Cl id #> #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is extravascular with a first order absorption (rate constant ka).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\\nThis has been modified so that it will run without the model library\" #> dfObs <- 120 #> dfSub <- 12 #> thetaMat <- lotri({ #> ka_pop + V_pop + Cl_pop ~ c(0.09785, 0.00082606, 0.00041937, #> -4.2833e-05, -6.7957e-06, 1.1318e-05) #> a + b ~ c(0.015333, -0.0026458, 0.00056232) #> }) #> validation <- c(\"ipred relative difference compared to Monolix ipred: 0.04%; 95% percentile: (0%,0.52%); rtol=0.00038\", #> \"ipred absolute difference compared to Monolix ipred: 95% percentile: (0.000362, 0.00848); atol=0.00254\", #> \"pred relative difference compared to Monolix pred: 0%; 95% percentile: (0%,0%); rtol=6.6e-07\", #> \"pred absolute difference compared to Monolix pred: 95% percentile: (1.6e-07, 1.27e-05); atol=3.66e-06\", #> \"iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.06%,32.22%); rtol=0.0153\", #> \"iwres absolute difference compared to Monolix pred: 95% percentile: (0.000403, 0.0138); atol=0.00305\") #> ini({ #> ka_pop <- 0.426994483535611 #> V_pop <- -0.786351566327091 #> Cl_pop <- -3.21457597916301 #> a <- c(0, 0.433279557549051) #> b <- c(0, 0.0542595276206251) #> omega_ka ~ 0.450314511978718 #> omega_V ~ 0.0159470121255372 #> omega_Cl ~ 0.0732370098834837 #> }) #> model({ #> cmt(depot) #> cmt(central) #> ka <- exp(ka_pop + omega_ka) #> V <- exp(V_pop + omega_V) #> Cl <- exp(Cl_pop + omega_Cl) #> d/dt(depot) <- -ka * depot #> d/dt(central) <- +ka * depot - Cl/V * central #> Cc <- central/V #> CONC <- Cc #> CONC ~ add(a) + prop(b) + combined1() #> }) #> } # If you are only interseted in the parsing you can use `mlxtran` mlx <- mlxtran(mlxtranFile) #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done mlx #> DESCRIPTION: #> The administration is extravascular with a first order absorption (rate constant ka). #> The PK model has one compartment (volume V) and a linear elimination (clearance Cl). #> This has been modified so that it will run without the model library #> #> #> [FILEINFO] #> ; parsed: $DATAFILE$FILEINFO$FILEINFO #> file = 'data/theophylline_data.txt' #> delimiter = tab #> header = {ID, AMT, TIME, CONC, WEIGHT, SEX} #> #> [CONTENT] #> ; parsed: $DATAFILE$CONTENT$CONTENT #> ID = {use=identifier} #> TIME = {use=time} #> AMT = {use=amount} #> CONC = {use=observation, name=CONC, type=continuous} #> WEIGHT = {use=covariate, type=continuous} #> SEX = {use=covariate, type=categorical} #> #> #> [INDIVIDUAL] #> ; parsed: $MODEL$INDIVIDUAL$INDIVIDUAL #> input = {ka_pop, omega_ka, V_pop, omega_V, Cl_pop, omega_Cl} #> #> DEFINITION: #> ; parsed: $MODEL$INDIVIDUAL$DEFINITION #> ka = {distribution=lognormal, typical=ka_pop, sd=omega_ka} #> V = {distribution=lognormal, typical=V_pop, sd=omega_V} #> Cl = {distribution=lognormal, typical=Cl_pop, sd=omega_Cl} #> #> [LONGITUDINAL] #> ; parsed: $MODEL$LONGITUDINAL$LONGITUDINAL #> input = {a, b, ka, V, Cl} #> file = 'oral1_1cpt_kaVCl.txt' #> #> DEFINITION: #> ; parsed: $MODEL$LONGITUDINAL$DEFINITION #> CONC = {distribution=normal, prediction=Cc, errorModel=combined1(a, b)} #> #> EQUATION: #> #> ; PK model definition #> Cc = pkmodel(ka, V, Cl) #> #> OUTPUT: #> ; parsed: $MODEL$LONGITUDINAL$OUTPUT #> output = Cc #> #> #> ; parsed: $FIT$FIT #> data = {CONC} #> model = {CONC} #> #> #> ; parsed: $PARAMETER$PARAMETER #> Cl_pop = {value=0.1, method=MLE} #> V_pop = {value=0.5, method=MLE} #> a = {value=1, method=MLE} #> b = {value=0.3, method=MLE} #> ka_pop = {value=1, method=MLE} #> omega_Cl = {value=1, method=MLE} #> omega_V = {value=1, method=MLE} #> omega_ka = {value=1, method=MLE} #> #> #> [TASKS] #> ; parsed: $MONOLIX$TASKS$TASKS #> populationParameters() #> individualParameters(method = {conditionalMean, conditionalMode}) #> fim(method = Linearization) #> logLikelihood(method = Linearization) #> plotResult(method = {indfits, obspred, vpc, residualsscatter, residualsdistribution, parameterdistribution, covariatemodeldiagnosis, randomeffects, covariancemodeldiagnosis, saemresults}) #> #> [SETTINGS] #> GLOBAL: #> ; parsed: $MONOLIX$SETTINGS$GLOBAL #> exportpath = 'tp' #> #> ; unparsed sections: #> ; $MODEL$LONGITUDINAL$EQUATION # this can be converted to a list mlx <- as.list(mlx) mlx$DATAFILE$FILEINFO$FILEINFO #> $file #> [1] \"data/theophylline_data.txt\" #> #> $header #> [1] \"ID\" \"AMT\" \"TIME\" \"CONC\" \"WEIGHT\" \"SEX\" #> #> $delimiter #> [1] \"tab\""},{"path":"/index.html","id":"translating-models-from-the-monolix-model-library","dir":"","previous_headings":"","what":"Translating models from the Monolix model library","title":"Converts Monolix Models to rxode2","text":"models using Monolix’s model library, models may accessible text files versions Monolix. mlxtran files may see something like: older versions Monolix, model libraries group text files. can find looking file Monolix library like bolus_1cpt_TlagVCl.txt. case pk/bolus_1cpt_TlagVCl.txt. parent directory model library. access files (even old version Monolix) can make monolix2rx aware model library using: Unix, can symbolic link whatever model library like use. can check see works trying translate model file rxode2: computer setup correctly (like ) see translated model. Note since isn’t mlxtran file relationship population parameters, subject variability etc initial parameter estimates model. model library setup correctly see found old model library get: newer versions Monolix, model library turned binary database accessed GUI lixoftConnectors. lixoftConnectors system can successfully load model lixoftConnectors::getLibraryModelContent() monolix2rx also load model correctly (use version text files setup) means need import models rxode2 need : model built model library need: path text file Monolix Library setup monolix2rx.library options(monolix2rx.library=\"~/src/monolix/library/\") lixoftConnectors installed connected newer (licensed) version Monolix can get model library content lixoftConnectors::getLibraryModelContent() without options, need save model text file outside model library can import model.","code":"lib:bolus_1cpt_TlagVCl.txt # If the model library was located in ~/src/monolix/library # Then you would set the model library up as follows: options(monolix2rx.library=\"~/src/monolix/library/\") monolix2rx(\"lib:bolus_1cpt_TlagVCl.txt\") #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ℹ cannot find individual parameter estimates #> ── rxode2-based free-form 1-cmt ODE model ────────────────────────────────────── #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 central #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is via a bolus with a lag time (Tlag).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\" #> model({ #> cmt(central) #> d/dt(central) <- -Cl/V * central #> alag(central) <- Tlag #> Cc <- central/V #> }) #> } try(monolix2rx(\"lib:notThere.txt\")) #> Warning in .mlxtranLib(file): while options('monolix2rx.library') is set, could not find model file 'lib:notThere.txt' #> please save the model to translate #> Error : could not find the model file"},{"path":"/index.html","id":"note-on-testing","dir":"","previous_headings":"","what":"Note on testing","title":"Converts Monolix Models to rxode2","text":"tests package include testing Monolix demo files, Monolix library files (available), Monolix validation suite. Since part Monolix , included package. can setup monolix2rx run tests files well setting options:","code":"# setup monolix library (and will test that the parsing and translation are as expected) options(monolix2rx.library=\"~/src/monolix/library/\") # setup monolix demos to be tested options(monolix2rx.demo=\"~/src/monolix/demos/\")"},{"path":"/reference/autoplot.monolix2rx.html","id":null,"dir":"Reference","previous_headings":"","what":"Autoplot monolix2rx object — autoplot.monolix2rx","title":"Autoplot monolix2rx object — autoplot.monolix2rx","text":"Autoplot monolix2rx object","code":""},{"path":"/reference/autoplot.monolix2rx.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Autoplot monolix2rx object — autoplot.monolix2rx","text":"","code":"# S3 method for class 'monolix2rx' autoplot( object, ..., ncol = 3, nrow = 3, log = \"\", xlab = \"Time\", ylab = \"Predictions\", page = FALSE )"},{"path":"/reference/autoplot.monolix2rx.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Autoplot monolix2rx object — autoplot.monolix2rx","text":"object object, whose class determine behaviour autoplot ... ignored parameters monolix2rx objects nrow, ncol Number rows columns log \"\" (neither x y), \"x\", \"y\", \"xy\" (\"yx\") log-scale? xlab, ylab x y axis labels page number page(s) individual plots, default (FALSE) pages print; can use TRUE pages print, list pages want print","code":""},{"path":"/reference/autoplot.monolix2rx.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Autoplot monolix2rx object — autoplot.monolix2rx","text":"ggplot2 object","code":""},{"path":"/reference/dot-getNbdoses.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the number of doses for steady state for monolix2rx — .getNbdoses","title":"Get the number of doses for steady state for monolix2rx — .getNbdoses","text":"Get number doses steady state monolix2rx","code":""},{"path":"/reference/dot-getNbdoses.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the number of doses for steady state for monolix2rx — .getNbdoses","text":"","code":".getNbdoses(x)"},{"path":"/reference/dot-getNbdoses.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the number of doses for steady state for monolix2rx — .getNbdoses","text":"x monolix2rx object","code":""},{"path":"/reference/dot-getNbdoses.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the number of doses for steady state for monolix2rx — .getNbdoses","text":"Number doses monolix2rx object","code":""},{"path":"/reference/dot-getNbdoses.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Get the number of doses for steady state for monolix2rx — .getNbdoses","text":"Matthew L. Fidler","code":""},{"path":"/reference/dot-getStiff.html","id":null,"dir":"Reference","previous_headings":"","what":"Get if the model object is stiff — .getStiff","title":"Get if the model object is stiff — .getStiff","text":"Get model object stiff","code":""},{"path":"/reference/dot-getStiff.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get if the model object is stiff — .getStiff","text":"","code":".getStiff(x)"},{"path":"/reference/dot-getStiff.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get if the model object is stiff — .getStiff","text":"x monolix2rx object","code":""},{"path":"/reference/dot-getStiff.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get if the model object is stiff — .getStiff","text":"boolean indicating object stiff system (indicated monolix)","code":""},{"path":"/reference/dot-getStiff.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Get if the model object is stiff — .getStiff","text":"Matthew L. Fidler","code":""},{"path":"/reference/dot-monolixGetMlxtran.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the best mlxtran info or return NULL — .monolixGetMlxtran","title":"Get the best mlxtran info or return NULL — .monolixGetMlxtran","text":"Get best mlxtran info return NULL","code":""},{"path":"/reference/dot-monolixGetMlxtran.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the best mlxtran info or return NULL — .monolixGetMlxtran","text":"","code":".monolixGetMlxtran(x)"},{"path":"/reference/dot-monolixGetMlxtran.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the best mlxtran info or return NULL — .monolixGetMlxtran","text":"x item try extract mlxtran info","code":""},{"path":"/reference/dot-monolixGetMlxtran.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the best mlxtran info or return NULL — .monolixGetMlxtran","text":"mlxtran info","code":""},{"path":"/reference/dot-monolixGetMlxtran.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Get the best mlxtran info or return NULL — .monolixGetMlxtran","text":"Matthew L. Fidler","code":""},{"path":"/reference/mlxTxt.html","id":null,"dir":"Reference","previous_headings":"","what":"Get equation block from a Monolix model txt file — mlxTxt","title":"Get equation block from a Monolix model txt file — mlxTxt","text":"Get equation block Monolix model txt file","code":""},{"path":"/reference/mlxTxt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get equation block from a Monolix model txt file — mlxTxt","text":"","code":"mlxTxt(file, retFile = FALSE)"},{"path":"/reference/mlxTxt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get equation block from a Monolix model txt file — mlxTxt","text":"file string representing model text file. Can lib:fileName.txt library setup/available retFile boolean tells mlxTxt() return file name instead error file exist","code":""},{"path":"/reference/mlxTxt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get equation block from a Monolix model txt file — mlxTxt","text":"parsed equation file name","code":""},{"path":"/reference/mlxTxt.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Get equation block from a Monolix model txt file — mlxTxt","text":"Matthew L. Fidler","code":""},{"path":"/reference/mlxTxt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get equation block from a Monolix model txt file — mlxTxt","text":"","code":"# First load in the model; in this case the theo model # This is modified from the Monolix demos by saving the model # File as a text file (hence you can access without model library) # setup. # # This example is also included in the monolix2rx package, so # you refer to the location with `system.file()`: pkgTheo <- system.file(\"theo\", package=\"monolix2rx\") mod <- mlxTxt(file.path(pkgTheo, \"oral1_1cpt_kaVCl.txt\")) mod #> DESCRIPTION: #> The administration is extravascular with a first order absorption (rate constant ka). #> The PK model has one compartment (volume V) and a linear elimination (clearance Cl). #> This has been modified so that it will run without the model library #> #> #> [LONGITUDINAL] #> ; parsed: $MODEL$LONGITUDINAL$LONGITUDINAL #> input = {ka, V, Cl} #> #> EQUATION: #> ; parsed: $MODEL$LONGITUDINAL$EQUATION #> ; PK model definition #> Cc = pkmodel(ka, V, Cl) #> #> OUTPUT: #> ; parsed: $MODEL$LONGITUDINAL$OUTPUT #> output = Cc"},{"path":"/reference/mlxtran.html","id":null,"dir":"Reference","previous_headings":"","what":"Read and parse mlxtran lines — mlxtran","title":"Read and parse mlxtran lines — mlxtran","text":"Read parse mlxtran lines","code":""},{"path":"/reference/mlxtran.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Read and parse mlxtran lines — mlxtran","text":"","code":"mlxtran(file, equation = FALSE, update = FALSE)"},{"path":"/reference/mlxtran.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Read and parse mlxtran lines — mlxtran","text":"file mlxtran file process equation parse equation block rxode2 (models translated) update true, try update parameter block final parameter estimates","code":""},{"path":"/reference/mlxtran.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Read and parse mlxtran lines — mlxtran","text":"mlxtran object","code":""},{"path":"/reference/mlxtran.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Read and parse mlxtran lines — mlxtran","text":"Matthew L. Fidler","code":""},{"path":"/reference/mlxtran.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Read and parse mlxtran lines — mlxtran","text":"","code":"# First load in the model; in this case the theo model # This is modified from the Monolix demos by saving the model # File as a text file (hence you can access without model library) # setup. # # This example is also included in the monolix2rx package, so # you refer to the location with `system.file()`: pkgTheo <- system.file(\"theo\", package=\"monolix2rx\") mlx <- mlxtran(file.path(pkgTheo, \"theophylline_project.mlxtran\")) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done mlx #> DESCRIPTION: #> The administration is extravascular with a first order absorption (rate constant ka). #> The PK model has one compartment (volume V) and a linear elimination (clearance Cl). #> This has been modified so that it will run without the model library #> #> #> [FILEINFO] #> ; parsed: $DATAFILE$FILEINFO$FILEINFO #> file = 'data/theophylline_data.txt' #> delimiter = tab #> header = {ID, AMT, TIME, CONC, WEIGHT, SEX} #> #> [CONTENT] #> ; parsed: $DATAFILE$CONTENT$CONTENT #> ID = {use=identifier} #> TIME = {use=time} #> AMT = {use=amount} #> CONC = {use=observation, name=CONC, type=continuous} #> WEIGHT = {use=covariate, type=continuous} #> SEX = {use=covariate, type=categorical} #> #> #> [INDIVIDUAL] #> ; parsed: $MODEL$INDIVIDUAL$INDIVIDUAL #> input = {ka_pop, omega_ka, V_pop, omega_V, Cl_pop, omega_Cl} #> #> DEFINITION: #> ; parsed: $MODEL$INDIVIDUAL$DEFINITION #> ka = {distribution=lognormal, typical=ka_pop, sd=omega_ka} #> V = {distribution=lognormal, typical=V_pop, sd=omega_V} #> Cl = {distribution=lognormal, typical=Cl_pop, sd=omega_Cl} #> #> [LONGITUDINAL] #> ; parsed: $MODEL$LONGITUDINAL$LONGITUDINAL #> input = {a, b, ka, V, Cl} #> #> DEFINITION: #> ; parsed: $MODEL$LONGITUDINAL$DEFINITION #> CONC = {distribution=normal, prediction=Cc, errorModel=combined1(a, b)} #> #> EQUATION: #> #> ; PK model definition #> Cc = pkmodel(ka, V, Cl) #> #> OUTPUT: #> ; parsed: $MODEL$LONGITUDINAL$OUTPUT #> output = Cc #> #> #> ; parsed: $FIT$FIT #> data = {CONC} #> model = {CONC} #> #> #> ; parsed: $PARAMETER$PARAMETER #> Cl_pop = {value=0.1, method=MLE} #> V_pop = {value=0.5, method=MLE} #> a = {value=1, method=MLE} #> b = {value=0.3, method=MLE} #> ka_pop = {value=1, method=MLE} #> omega_Cl = {value=1, method=MLE} #> omega_V = {value=1, method=MLE} #> omega_ka = {value=1, method=MLE} #> #> #> [TASKS] #> ; parsed: $MONOLIX$TASKS$TASKS #> populationParameters() #> individualParameters(method = {conditionalMean, conditionalMode}) #> fim(method = Linearization) #> logLikelihood(method = Linearization) #> plotResult(method = {indfits, obspred, vpc, residualsscatter, residualsdistribution, parameterdistribution, covariatemodeldiagnosis, randomeffects, covariancemodeldiagnosis, saemresults}) #> #> [SETTINGS] #> GLOBAL: #> ; parsed: $MONOLIX$SETTINGS$GLOBAL #> exportpath = 'tp' #> #> ; unparsed sections: #> ; $MODEL$LONGITUDINAL$EQUATION"},{"path":"/reference/monolix2rx.html","id":null,"dir":"Reference","previous_headings":"","what":"Translate a monolix file to rxode2 — monolix2rx","title":"Translate a monolix file to rxode2 — monolix2rx","text":"Translate monolix file rxode2","code":""},{"path":"/reference/monolix2rx.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Translate a monolix file to rxode2 — monolix2rx","text":"","code":"monolix2rx( mlxtran, update = TRUE, thetaMatType = c(\"sa\", \"lin\"), sd = 1, cor = 1e-05, theta = 0.5, ci = 0.95, sigdig = 3, envir = parent.frame() )"},{"path":"/reference/monolix2rx.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Translate a monolix file to rxode2 — monolix2rx","text":"mlxtran file name mlxtran translate rxode2 update boolean represents final parameter estimates used translation (present) thetaMatType lists preferred source thetaMat covariance matrix. default sa simulated annealing, though use lin linearized covariance calculation. one present, use whatever present sd Default standard deviation subject variability/inter-occasion variability missing. cor Default correlation missing correlations estimate theta default population estimate ci confidence interval validation, default 0.95 sigdig number significant digits validation, default 3 envir represents environment used evaluating corresponding rxode2 function","code":""},{"path":"/reference/monolix2rx.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Translate a monolix file to rxode2 — monolix2rx","text":"rxode2 model","code":""},{"path":"/reference/monolix2rx.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Translate a monolix file to rxode2 — monolix2rx","text":"Matthew L. Fidler","code":""},{"path":"/reference/monolix2rx.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Translate a monolix file to rxode2 — monolix2rx","text":"","code":"# First load in the model; in this case the theo model # This is modified from the Monolix demos by saving the model # File as a text file (hence you can access without model library) # setup. # # This example is also included in the monolix2rx package, so # you refer to the location with `system.file()`: pkgTheo <- system.file(\"theo\", package=\"monolix2rx\") rx <- monolix2rx(file.path(pkgTheo, \"theophylline_project.mlxtran\")) #> ℹ integrated model file 'oral1_1cpt_kaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesLin.txt #> ℹ done #> Warning: NAs introduced by coercion #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> #> #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done pkgCov <- system.file(\"cov\", package=\"monolix2rx\") rx <- monolix2rx(file.path(pkgCov, \"warfarin_covariate3_project.mlxtran\")) #> ℹ integrated model file 'oral1_1cpt_TlagkaVCl.txt' into mlxtran object #> ℹ updating model values to final parameter estimates #> ℹ done #> ℹ reading run info (# obs, doses, Monolix Version, etc) from summary.txt #> ℹ done #> ℹ reading covariance from FisherInformation/covarianceEstimatesSA.txt #> ℹ done #> ℹ imported monolix and translated to rxode2 compatible data ($monolixData) #> ℹ imported monolix ETAS (_SAEM) imported to rxode2 compatible data ($etaData) #> ℹ imported monolix pred/ipred data to compare ($predIpredData) #> #> #> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’ #> ℹ solving ipred problem #> ℹ done #> ℹ solving pred problem #> ℹ done rx #> ── rxode2-based free-form 2-cmt ODE model ────────────────────────────────────── #> ── Initalization: ── #> Fixed Effects ($theta): #> Tlag_pop ka_pop V_pop Cl_pop beta_V_tSex_F #> -0.25949800 0.35610590 2.13606937 -2.00665359 -0.38227857 #> beta_Cl_tSex_F a b #> -0.09383651 0.24818991 0.05086658 #> #> Omega ($omega): #> omega_Tlag omega_ka omega_V omega_Cl #> omega_Tlag 0.3836648 0.0000000 0.00000000 0.00000000 #> omega_ka 0.0000000 0.9857194 0.00000000 0.00000000 #> omega_V 0.0000000 0.0000000 0.02782834 0.00000000 #> omega_Cl 0.0000000 0.0000000 0.00000000 0.08142194 #> #> States ($state or $stateDf): #> Compartment Number Compartment Name #> 1 1 depot #> 2 2 central #> ── μ-referencing ($muRefTable): ── #> theta eta level covariates #> 1 Tlag_pop omega_Tlag id #> 2 ka_pop omega_ka id #> 3 V_pop omega_V id (tSex == \"F\")*beta_V_tSex_F #> 4 Cl_pop omega_Cl id (tSex == \"F\")*beta_Cl_tSex_F #> #> ── Model (Normalized Syntax): ── #> function() { #> description <- \"The administration is extravascular with a first order absorption (rate constant ka) and a lag time (Tlag).\\nThe PK model has one compartment (volume V) and a linear elimination (clearance Cl).\" #> dfObs <- 479 #> dfSub <- 32 #> thetaMat <- lotri({ #> Tlag_pop ~ c(Tlag_pop = 0.0695270111760315) #> ka_pop ~ c(Tlag_pop = 0.00420093609313868, ka_pop = 0.195044017895198) #> V_pop ~ c(Tlag_pop = -1.96027567180685e-05, ka_pop = -0.00923639238851991, #> V_pop = 0.0894995626339569) #> beta_V_tSex_F ~ c(Tlag_pop = 0.000672864307227817, ka_pop = 0.00146099695978716, #> V_pop = -0.0105938787089785, beta_V_tSex_F = 0.00724034) #> Cl_pop ~ c(Tlag_pop = 3.33517518294536e-05, ka_pop = -0.000198349948605509, #> V_pop = 1.64480523051151e-05, beta_V_tSex_F = -2.52790128781238e-06, #> Cl_pop = 5.67721912406063e-05) #> beta_Cl_tSex_F ~ c(Tlag_pop = 4.97719167561125e-05, ka_pop = 0.00116960996255074, #> V_pop = -0.000127036295934593, beta_V_tSex_F = -1.29385e-06, #> Cl_pop = -0.000421700477175592, beta_Cl_tSex_F = 0.0199246) #> omega_Tlag ~ c(Tlag_pop = -0.0670860109353223, ka_pop = 0.00570893614027221, #> V_pop = 0.00299407684209903, beta_V_tSex_F = -0.00119581, #> Cl_pop = 2.03533460988456e-06, beta_Cl_tSex_F = -0.00034514, #> omega_Tlag = 0.116943) #> omega_ka ~ c(Tlag_pop = -0.0133385617208073, ka_pop = 0.0172356179141179, #> V_pop = 0.00171771988746332, beta_V_tSex_F = -0.000442385, #> Cl_pop = 7.3966470999696e-05, beta_Cl_tSex_F = -0.000725679, #> omega_Tlag = 0.0139898, omega_ka = 0.0694802) #> omega_V ~ c(Tlag_pop = -0.000154212149163577, ka_pop = 0.000300664573505569, #> V_pop = 4.67557030887738e-05, beta_V_tSex_F = -1.72411e-06, #> Cl_pop = -2.66907442804329e-06, beta_Cl_tSex_F = 2.11319e-05, #> omega_Tlag = 0.000296489, omega_ka = -0.000253742, #> omega_V = 0.000656055) #> omega_Cl ~ c(Tlag_pop = -0.00020876675474306, ka_pop = 0.000203991029463676, #> V_pop = -4.25014903301396e-05, beta_V_tSex_F = 1.01086e-05, #> Cl_pop = -4.27528356071897e-07, beta_Cl_tSex_F = -3.1184e-05, #> omega_Tlag = 0.000190543, omega_ka = -0.000195656, #> omega_V = 3.1147e-06, omega_Cl = 0.00133407) #> a ~ c(Tlag_pop = 0.000459922525965396, ka_pop = -0.000402122537073151, #> V_pop = -0.00035759769526248, beta_V_tSex_F = -5.67417e-07, #> Cl_pop = 4.93306085861609e-06, beta_Cl_tSex_F = 5.18592e-05, #> omega_Tlag = -0.000767474, omega_ka = -0.000402704, #> omega_V = -3.56563e-05, omega_Cl = 5.77815e-05, a = 0.00146135) #> b ~ c(Tlag_pop = -4.42123891106805e-05, ka_pop = 6.74134848256571e-05, #> V_pop = 0.000102247569651447, beta_V_tSex_F = -4.84525e-06, #> Cl_pop = -7.84308816660971e-07, beta_Cl_tSex_F = -4.64896e-06, #> omega_Tlag = 5.67197e-05, omega_ka = 4.06959e-05, #> omega_V = -4.39519e-06, omega_Cl = -1.31481e-05, #> a = -0.000214637, b = 5.66332e-05) #> }) #> validation <- c(\"ipred relative difference compared to Monolix ipred: 0.39%; 95% percentile: (0.02%,3.18%); rtol=0.00394\", #> \"ipred absolute difference compared to Monolix ipred: 95% percentile: (8.49e-05, 0.166); atol=0.0176\", #> \"pred relative difference compared to Monolix pred: 0%; 95% percentile: (0%,0%); rtol=1.21e-06\", #> \"pred absolute difference compared to Monolix pred: 95% percentile: (1.87e-08, 4.92e-05); atol=6.07e-06\", #> \"iwres relative difference compared to Monolix iwres: 0%; 95% percentile: (0.24%,204.01%); rtol=0.0794\", #> \"iwres absolute difference compared to Monolix pred: 95% percentile: (0.0026, 0.33); atol=0.0364\") #> ini({ #> Tlag_pop <- -0.259498000083172 #> ka_pop <- 0.356105897545116 #> V_pop <- 2.1360693683596 #> Cl_pop <- -2.00665359474148 #> beta_V_tSex_F <- -0.382278567256413 #> beta_Cl_tSex_F <- -0.0938365059053137 #> a <- c(0, 0.24818990819019) #> b <- c(0, 0.0508665778176092) #> omega_Tlag ~ 0.383664766381593 #> omega_ka ~ 0.985719433448741 #> omega_V ~ 0.0278283386496708 #> omega_Cl ~ 0.0814219400052839 #> }) #> model({ #> cmt(depot) #> cmt(central) #> if (sex == 0) { #> tSex <- \"F\" #> } #> else if (sex == 1) { #> tSex <- \"M\" #> } #> else { #> tSex <- \"M\" #> } #> Tlag <- exp(Tlag_pop + omega_Tlag) #> ka <- exp(ka_pop + omega_ka) #> V <- exp(V_pop + beta_V_tSex_F * (tSex == \"F\") + omega_V) #> Cl <- exp(Cl_pop + beta_Cl_tSex_F * (tSex == \"F\") + omega_Cl) #> d/dt(depot) <- -ka * depot #> alag(depot) <- Tlag #> d/dt(central) <- +ka * depot - Cl/V * central #> Cc <- central/V #> concentration <- Cc #> concentration ~ add(a) + prop(b) + combined1() #> }) #> }"},{"path":"/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. ggplot2 autoplot lotri lotri magrittr %>% rxode2 expit, ini, logit, model, model<-, rxode, RxODE, rxode2, rxRename, rxSolve, rxUiGet","code":""},{"path":"/news/index.html","id":"monolix2rx-004","dir":"Changelog","previous_headings":"","what":"monolix2rx 0.0.4","title":"monolix2rx 0.0.4","text":"CRAN release: 2024-11-28 Added ignoreline support #22","code":""},{"path":"/news/index.html","id":"monolix2rx-003","dir":"Changelog","previous_headings":"","what":"monolix2rx 0.0.3","title":"monolix2rx 0.0.3","text":"CRAN release: 2024-10-24 initial conditions starting rxCov_ don’t add ini","code":""},{"path":"/news/index.html","id":"monolix2rx-002","dir":"Changelog","previous_headings":"","what":"monolix2rx 0.0.2","title":"monolix2rx 0.0.2","text":"CRAN release: 2024-09-20 Remove rxode2parse LinkingTo Add urls website Remove sentence residual specification always captured. Right now ‘Monolix’ always .","code":""},{"path":"/news/index.html","id":"monolix2rx-001","dir":"Changelog","previous_headings":"","what":"monolix2rx 0.0.1","title":"monolix2rx 0.0.1","text":"CRAN release: 2024-09-20 Initial CRAN submission.","code":""}]