R/define_boot_table.R
define_boot_table.Rd
Combines boot strap estimates and non boot strap estimates with information in parameter key. Performs some formatting of this combined data.frame. There are two main steps of this function:
1.Run bbr::param_estimates_compare
to extract summary quantiles, the 5th, 50th, and 95th, of the
bootstrap estimates for each model parameter.
Some parameter_names
have punctuation such as OMEGA(1,1)
. A new column is
added without punctuation, such as OMEGA11
.
Following this, parameter details from the parameter key are joined to the boot strap parameter estimates.
A dplyr::inner_join
is used so that only parameters in the model output are kept
in the table. This was done so that, if your base and final model used the same structural
THETAs and random parameters, the same parameter key could be used for both.
This join adds the following columns: abb
(abbreviation), desc
(parameter description),
panel
, trans
(transformation).
2.Reformat non-bootstrap estimates and left join onto combined bootstrap estimates and parameter key data.frame.
Expected input is a data.frame with parameter estimates, with the columns:
parameter_names
, estimate
.
With this information provided, a check is performed to determine whether parameters with special transformation rules were defined correctly. In addition, a series of TRUE/FALSE columns that will be used by subsequent functions.
define_boot_table(.boot_estimates, .nonboot_estimates, .key)
parameter boot estimates- either path to file or data.frame
non-bootstrap final model - either path to file or bbr model_summary
path to parameter key or data.frame of parameter key. Described in more detail in param_key
boot_paramEst <- utils::read.csv(system.file("model/nonmem/boot/data/boot-106.csv",
package = "pmparams"))
nonboot_paramEst <- utils::read.csv(system.file("model/nonmem/nonboot_param_est.csv",
package = "pmparams"))
paramKey <- system.file("model/nonmem/pk-parameter-key-new.yaml", package = "pmparams")
define_boot_table(.boot_estimates = boot_paramEst,
.nonboot_estimates = nonboot_paramEst,
.key = paramKey)
#> [1] "Parameter table yaml path provided: /data/pmparams/inst/model/nonmem/pk-parameter-key-new.yaml"
#> # A tibble: 15 × 25
#> parameter_names estimate lower upper name abb desc panel trans nrow
#> <chr> <dbl> <dbl> <dbl> <chr> <chr> <chr> <chr> <chr> <int>
#> 1 THETA1 0.449 1.39 1.78 THETA1 KA (… Firs… stru… logT… 1
#> 2 THETA2 4.12 58.3 65.1 THETA2 V2/F… Appa… stru… logT… 2
#> 3 THETA3 1.17 3.07 3.42 THETA3 CL/F… Appa… stru… logT… 3
#> 4 THETA4 4.21 65.0 69.8 THETA4 V3/F… Appa… stru… logT… 4
#> 5 THETA5 1.28 3.37 3.86 THETA5 Q/F … Appa… stru… logT… 5
#> 6 THETA6 0.484 0.408 0.558 THETA6 CL/F… eGFR… cov none 6
#> 7 THETA7 -0.0386 -0.167 0.0878 THETA7 CL/F… Age … cov none 7
#> 8 THETA8 0.420 0.294 0.587 THETA8 CL/F… Seru… cov none 8
#> 9 OMEGA.1.1. 0.218 0.130 0.331 OMEGA… IIV-… Vari… IIV logn… 9
#> 10 OMEGA.2.2. 0.0821 0.0643 0.101 OMEGA… IIV-… Vari… IIV logn… 10
#> 11 OMEGA.3.3. 0.112 0.0896 0.140 OMEGA… IIV-… Vari… IIV logn… 11
#> 12 OMEGA.2.1. 0.0656 0.0328 0.107 OMEGA… V2/F… Cova… IIV none 12
#> 13 OMEGA.3.1. 0.121 0.0805 0.173 OMEGA… CL/F… Cova… IIV none 13
#> 14 OMEGA.3.2. 0.0696 0.0525 0.0882 OMEGA… CL/F… Cova… IIV none 14
#> 15 SIGMA.1.1. 0.0400 0.0376 0.0424 SIGMA… Prop… Vari… RV prop… 15
#> # ℹ 15 more variables: fixed <lgl>, value <dbl>, transTHETA <lgl>,
#> # THETAERR <lgl>, TH <lgl>, OM <lgl>, S <lgl>, LOG <lgl>, LOGIT <lgl>,
#> # lognormO <lgl>, Osd <lgl>, logitOsd <lgl>, propErr <lgl>, addErr <lgl>,
#> # addErrLogDV <lgl>