diff --git a/articles/error_files/figure-html/example-1.png b/articles/error_files/figure-html/example-1.png index 4b8375f2..2d74b5f8 100644 Binary files a/articles/error_files/figure-html/example-1.png and b/articles/error_files/figure-html/example-1.png differ diff --git a/articles/error_files/figure-html/example-2-1.png b/articles/error_files/figure-html/example-2-1.png index ad8845fc..fffff373 100644 Binary files a/articles/error_files/figure-html/example-2-1.png and b/articles/error_files/figure-html/example-2-1.png differ diff --git a/articles/estimation-nlmixr.html b/articles/estimation-nlmixr.html index a62dc940..7e20faeb 100644 --- a/articles/estimation-nlmixr.html +++ b/articles/estimation-nlmixr.html @@ -159,7 +159,7 @@
A full code example is included below.
Note: both nlmixr and the nlmixr-translator in PKPDsim are still
under active development. Syntax and results may therefore
@@ -231,21 +231,21 @@ Example
##
## ── Time (sec fit$time): ──
##
-## setup covariance saem table compress other
-## elapsed 0.001876 0.016005 9.44 0.088 0.023 1.429119
+## setup covariance saem table compress other
+## elapsed 0.002033 0.017005 9.944 0.089 0.023 1.418962
##
## ── Population Parameters (fit$parFixed or fit$parFixedDf): ──
##
## Est. SE %RSE Back-transformed(95%CI) BSV(CV%) Shrink(SD)%
-## logCL 1.58 0.0412 2.6 4.87 (4.49, 5.28) 22.5 19.8%
-## logV 3.86 0.043 1.12 47.4 (43.5, 51.5) 15.3 42.8%
-## err_prop 0.204 0.204
-## err_add 1.43 1.43
+## logCL 1.64 0.0493 3.01 5.15 (4.67, 5.67) 27.4 19.8%
+## logV 3.86 0.0483 1.25 47.5 (43.2, 52.2) 13.4 28.9%
+## err_prop 0.258 0.258
+## err_add 1.41 1.41
##
## Covariance Type (fit$covMethod): linFim
## Correlations in between subject variability (BSV) matrix:
## cor:eta_V,eta_CL
-## 0.463
+## 0.886
##
##
## Full BSV covariance (fit$omega) or correlation (fit$omegaR; diagonals=SDs)
@@ -254,11 +254,11 @@
Example
##
## ── Fit Data (object fit is a modified tibble): ──
## # A tibble: 200 × 16
-## ID TIME DV PRED RES IPRED IRES IWRES eta_CL eta_V y A1
-## <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
-## 1 1 8 13.4 13.9 -0.524 12.9 0.474 0.159 0.0904 -0.0426 12.9 586.
-## 2 1 23.5 2.17 2.83 -0.652 2.09 0.0830 0.0558 0.0904 -0.0426 2.09 94.8
-## 3 1 25 36.7 31.0 5.66 31.1 5.52 0.848 0.0904 -0.0426 31.1 1413.
+## ID TIME DV PRED RES IPRED IRES IWRES eta_CL eta_V y A1
+## <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
+## 1 1 8 17.6 13.3 4.31 19.5 -1.89 -0.362 -0.449 -0.177 19.5 776.
+## 2 1 23.5 7.00 2.48 4.52 5.42 1.57 0.792 -0.449 -0.177 5.42 216.
+## 3 1 25 46.2 30.4 15.8 39.5 6.74 0.655 -0.449 -0.177 39.5 1572.
## # ℹ 197 more rows
## # ℹ 4 more variables: CL <dbl>, V <dbl>, tad <dbl>, dosenum <dbl>
diff --git a/articles/example-pkpd-model_files/figure-html/example-pkpd-1.png b/articles/example-pkpd-model_files/figure-html/example-pkpd-1.png
index d0585aa5..c01cb745 100644
Binary files a/articles/example-pkpd-model_files/figure-html/example-pkpd-1.png and b/articles/example-pkpd-model_files/figure-html/example-pkpd-1.png differ
diff --git a/articles/variability_files/figure-html/plot-1.png b/articles/variability_files/figure-html/plot-1.png
index dea40833..5772e3b8 100644
Binary files a/articles/variability_files/figure-html/plot-1.png and b/articles/variability_files/figure-html/plot-1.png differ
diff --git a/articles/variability_files/figure-html/plot-2.png b/articles/variability_files/figure-html/plot-2.png
index 6387fa4c..e29508f4 100644
Binary files a/articles/variability_files/figure-html/plot-2.png and b/articles/variability_files/figure-html/plot-2.png differ
diff --git a/pkgdown.yml b/pkgdown.yml
index 2654debd..38073c84 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -16,7 +16,7 @@ articles:
simulation: simulation.html
speed: speed.html
variability: variability.html
-last_built: 2024-01-05T20:30Z
+last_built: 2024-01-08T20:56Z
urls:
reference: https://insightrx.github.io/PKPDsim/reference
article: https://insightrx.github.io/PKPDsim/articles
diff --git a/search.json b/search.json
index b4ee1166..e6b75fc4 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":"https://insightrx.github.io/PKPDsim/articles/PKPDsim.html","id":"installation","dir":"Articles","previous_headings":"","what":"Installation","title":"Getting started","text":"PKPDsim can installed CRAN: can install development version GitHub:","code":"install.packages(\"PKPDsim\") devtools::install_github(\"InsightRX/PKPDsim\")"},{"path":"https://insightrx.github.io/PKPDsim/articles/PKPDsim.html","id":"first-simulation","dir":"Articles","previous_headings":"","what":"First simulation","title":"Getting started","text":"main simulation function PKPDsim sim(). able simulate dosing regimen specific drug, least following three arguments required: ode: compiled ODE model (created using new_ode_model() function) parameters: list parameter values model regimen: dosing regimen (created using new_regimen() function) model library PKPDsim contains small library built-PK PD models, course interesting ability handle user-specified ODE systems. However, first example, let’s implement simple example library: probably noticed new_ode_model()-step took seconds finish, simulation order milliseconds. new_ode_model(), model compiled C++ source code binary code, takes seconds. However, done . compilation, model available used sim() long R session open. Let’s look output. PKPDsim output data “long” format, .e. one row per observed timepoint, split compartment: check output produced sim(), let’s plot (installation ggplot2 required).","code":"p <- list(CL = 1, V = 10, KA = 0.5) pk1 <- new_ode_model(\"pk_1cmt_oral\") r1 <- new_regimen( amt = 100, n = 5, interval = 12 ) dat <- sim( ode = pk1, parameters = p, regimen = r1 ) head(dat) ## id t comp y obs_type ## 1 1 0 1 100.00000 1 ## 4 1 1 1 60.65307 1 ## 40 1 2 1 36.78794 1 ## 76 1 3 1 22.31302 1 ## 112 1 4 1 13.53353 1 ## 148 1 5 1 8.20850 1 ggplot(dat, aes(x = t, y = y)) + geom_line() + facet_wrap(~ comp)"},{"path":"https://insightrx.github.io/PKPDsim/articles/PKPDsim.html","id":"custom-ode-model","dir":"Articles","previous_headings":"","what":"Custom ODE model","title":"Getting started","text":"can write exact model using custom ODE code. following example also output concentration (only_obs=TRUE), amounts compartment. ’re also going use infusion instead bolus injection:","code":"pk2 <- new_ode_model( code = \"dAdt[1] = -(CL/V) * A[1]\", obs = list(cmt = 1, scale = \"V\"), dose = list(cmt = 1) ) r2 <- new_regimen( amt = 100, n = 5, interval = 12, type = \"infusion\", t_inf = 2 ) dat2 <- sim( ode = pk2, parameters = p, regimen = r2, only_obs = TRUE ) ggplot(dat2, aes(x = t, y = y)) + geom_line()"},{"path":"https://insightrx.github.io/PKPDsim/articles/PKPDsim.html","id":"included-models","dir":"Articles","previous_headings":"","what":"Included models","title":"Getting started","text":"PKPDsim includes definitions several PK/PD models used InsightRX platform. models can installed R packages using model_from_api() function. Please note models may differ used production InsightRX. provided demonstration purposes , used dosing patients.","code":"model_from_api( system.file(\"models\", \"pk_vanco_anderson.json5\", package = \"PKPDsim\"), to_package = TRUE, install_all = TRUE )"},{"path":"https://insightrx.github.io/PKPDsim/articles/PKPDsim.html","id":"example-usage","dir":"Articles","previous_headings":"Included models","what":"Example usage","title":"Getting started","text":"simulate PK, provide model parameters PKPDsim::sim() along dosing regimen covariates.","code":"## Create dosing regimen and covariates reg <- new_regimen( amt = 100, n = 3, interval = 12, type = \"infusion\", t_inf = 1 ) covs <- list( WT = new_covariate(4), PMA = new_covariate(42), CR = new_covariate(0.5), CL_HEMO = new_covariate(0) ) ## Perform simulation sim( ode = pkvancoanderson::model(), parameters = pkvancoanderson::parameters(), regimen = reg, covariates = covs )"},{"path":"https://insightrx.github.io/PKPDsim/articles/covariates.html","id":"covariates","dir":"Articles","previous_headings":"","what":"Covariates","title":"Covariates","text":"Covariates implemented using new_covariate() function, wrapped named list. example: names covariate list-object correspond exactly names covariates model.","code":"covariates <- list( \"WT\" = new_covariate(value = 70), \"SCR\" = new_covariate(value = 120) )"},{"path":"https://insightrx.github.io/PKPDsim/articles/covariates.html","id":"time-varying-covariates","dir":"Articles","previous_headings":"Covariates","what":"Time-varying covariates","title":"Covariates","text":"Time-varing covariates, creatinine values can implemented easily well. just require additional times argument: default, PKPDsim assumes want interpolate (linearly) measurements time-varying covariates. prefer implement covariate using last-observation-carried-forward (words step function), specify method = \"LOCF\" argument new_covariate().","code":"covariates <- list( \"WT\" = new_covariate(value = 70), \"CR\" = new_covariate( value = c(0.8, 1, 1.2), times = c(0, 48, 72) ) )"},{"path":"https://insightrx.github.io/PKPDsim/articles/covariates.html","id":"covariates-for-multiple-patients","dir":"Articles","previous_headings":"Covariates","what":"Covariates for multiple patients","title":"Covariates","text":"table covariates can supplied sim() covariate values per individual. can handle static time-varying covariates. covariate table look like : id t (time) columns can omitted static covariates used. , make sure headers used covariates match exactly covariate names specified model definition. full example model (simulated) covariates patient population: Note: PKPDsim handle missing covariate values. missing covariate data, probably best approach impute values manually simulation, e.g. based mean observed / known value, correlation covariates.","code":"cov_table <- data.frame( id = c(1, 1, 2, 3), WT = c(40, 45, 50, 60), SCR = c(50, 150, 90, 110), t = c(0, 5, 0, 0) ) parameters <- list( CL = 1, V = 10, KA = 0.5 ) n_ind <- 50 cov_table <- data.frame( 'id' = 1:n_ind, 'WT' = rnorm(n_ind, mean = 70, sd = 5) ) model <- new_ode_model( code = ' CLi = CL * pow((WT/70), 0.75) Vi = V * (WT/70) dAdt[1] = -KA*A[1] dAdt[2] = KA*A[1] -(CLi/Vi)*A[2] ', declare_variables = c('CLi', 'Vi'), covariates = c('WT'), dose = list(cmt = 1), obs = list(cmt = 2, scale = 'V * (WT/70)') ) regimen <- new_regimen( amt = 30, n = 4, type = 'bolus', interval = 12 ) dat <- sim( ode = model, parameters = parameters, t_obs = c(0.5, 2, 4, 8, 12, 16, 24), n_ind = n_ind, regimen = regimen, covariates_table = cov_table, output_include = list(covariates = TRUE) ) ## Simulating 50 individuals."},{"path":"https://insightrx.github.io/PKPDsim/articles/error.html","id":"residual-error","dir":"Articles","previous_headings":"","what":"Residual error","title":"Residual error","text":"PKPDsim can simulate residual errors observed data, can done res_var argument sim() function. argument requires list() one following components: prop: proportional error: \\[y = \\hat{y} \\cdot (1 + \\mathcal{N}(0, prop))\\] add: additive error: \\[y = \\hat{y} + \\mathcal{N}(0, add))\\] exp: exponential error: \\[y = \\hat{y} \\cdot e^{\\mathcal{N}(0, exp)}\\] list elements can combined, e.g. combined proportional additive error model one write e.g.: res_var = list(prop = 0.1, add = 1), give 10% proportional error plus additive error 1 concentration unit. examples res_var argument Combined proportional additive: Exponential: Besides including residual error simulation time, also option include afterwards. , function add_ruv() useful.","code":"mod <- new_ode_model(\"pk_1cmt_iv\") reg <- new_regimen( amt = 1000, n = 5, interval = 12, type = \"bolus\" ) sim1 <- sim( mod, parameters = list(CL = 5, V = 150), res_var = list(prop = 0.1, add = 1), regimen = reg, only_obs=TRUE ) ggplot(sim1, aes(x = t, y = y)) + geom_point() sim2 <- sim( mod, parameters = list(CL = 5, V = 150), res_var = list(exp = 0.1), regimen = reg, only_obs=TRUE ) sim3 <- sim1 sim3$y <- add_ruv( x = sim3$y, ruv = list( prop = 0.1, add = 1 ) ) ggplot(sim3, aes(x = t, y = y)) + geom_point()"},{"path":"https://insightrx.github.io/PKPDsim/articles/estimation-nlmixr.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Estimation: nlmixr2","text":"PKPDsim R package include functionality perform population estimation within package, offer convenient translator able use nlmixr2 R package parameter estimation. nlmixr2 allows fitting population PK-PD models using common algorithms applied pharmacometrics, FOCE SAEM. installation usage nlmixr2, please refer documentation nlmixr2 package respective website.","code":""},{"path":"https://insightrx.github.io/PKPDsim/articles/estimation-nlmixr.html","id":"translation","dir":"Articles","previous_headings":"","what":"Translation","title":"Estimation: nlmixr2","text":"hood, nlmixr2 uses rxode2 R package perform PKPD model simulations, similar PKPDsim. model syntax rxode2 nlmixr2 compared PKPDsim also similar, making translation fairly straightforward. model translator function therefore included PKPDsim allows translation PKPDsim model nlmixr2 syntax: returned object f generated pkpdsim_to_nlmixr() object defines required model parameter definitions nlmixr syntax: full code example included . Note: nlmixr nlmixr-translator PKPDsim still active development. Syntax results may therefore change.","code":"mod <- new_ode_model(\"pk_1cmt_iv\") f <- pkpdsim_to_nlmixr( model = mod, parameters = list(CL = 5, V = 50), omega = c(0.1, 0.05, 0.1), res_var = list(prop = 0.1, add = 0.1), log_transform = TRUE ) f ## function () ## { ## ini({ ## logCL <- log(5) ## logV <- log(50) ## err_prop <- c(0, 0.1, 1) ## err_add <- c(0, 1, 10) ## eta_CL + eta_V ~ c(0.1, 0.05, 0.1) ## }) ## model({ ## CL <- exp(logCL + eta_CL) ## V <- exp(logV + eta_V) ## d/dt(A1) = -(CL/V) * A1 ## y = A1/V ## y ~ prop(err_prop) + add(err_add) ## }) ## } ##