Combines model output parameter estimates with information in parameter key. Performs some formatting of this combined data.frame.
Arguments
- .estimates
One of the following:
Path to a
bbrmodelA
bbrmodel. (output ofbbr::read_model())A
bbrmodel summary object (output ofbbr::model_summary())A data frame of the parameter estimates (e.g., output of
bbr::param_estimates())
- .key
Path to parameter key or data.frame of parameter key. Described in more detail in
param_key- .ci
Confidence interval. A value from 1 to 99 denoting the percent confidence interval. Default is
95.- .zscore
Deprecated. Please use the
.ciargument.
Details
Below is the expected format of .estimates if a data frame is provided:
parameter_names estimate stderr random_effect_sd random_effect_sdse fixed diag shrinkage
<chr> <dbl> <dbl> <dbl> <dbl> <lgl> <lgl> <dbl>
THETA1 0.443 0.0643 NA NA FALSE NA NA
THETA2 4.12 0.0275 NA NA FALSE NA NA
THETA3 1.17 0.0280 NA NA FALSE NA NA
THETA4 4.21 0.0190 NA NA FALSE NA NA
THETA5 1.28 0.0348 NA NA FALSE NA NA
THETA6 0.485 0.0395 NA NA FALSE NA NA
THETA7 -0.0378 0.0635 NA NA FALSE NA NA
THETA8 0.419 0.0863 NA NA FALSE NA NANotes:
Some parameter names may have punctuation (such as
OMEGA(1,1)). A newnamecolumn is automatically added that specifies the name without punctuation (i.e.OMEGA11).Parameter details from the parameter key are joined to the bootstrap parameter estimates. A
dplyr::inner_joinis 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).
A final check is performed to determine whether parameters with special transformation rules were defined correctly. In addition, a series of
TRUE/FALSEcolumns are added that will be used downstream.
Examples
model_dir <- system.file("model/nonmem", package = "pmparams")
paramKey <- file.path(model_dir, "pk-parameter-key-new.yaml")
# Using a file path
param_est_path <- file.path(model_dir, "param_est_102.csv")
param_ests <- readr::read_csv(param_est_path)
#> Rows: 12 Columns: 8
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (1): parameter_names
#> dbl (5): estimate, stderr, random_effect_sd, random_effect_sdse, shrinkage
#> lgl (2): fixed, diag
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
define_param_table(param_ests, paramKey, .ci = 95)
#> # A tibble: 12 × 33
#> parameter_names estimate stderr random_effect_sd random_effect_sdse fixed
#> <chr> <dbl> <dbl> <dbl> <dbl> <lgl>
#> 1 THETA1 0.434 0.0629 NA NA FALSE
#> 2 THETA2 4.12 0.0276 NA NA FALSE
#> 3 THETA3 1.12 0.0328 NA NA FALSE
#> 4 THETA4 4.21 0.0192 NA NA FALSE
#> 5 THETA5 1.29 0.0354 NA NA FALSE
#> 6 OMEGA(1,1) 0.221 0.0530 0.470 0.0564 FALSE
#> 7 OMEGA(2,2) 0.0827 0.00983 0.288 0.0171 FALSE
#> 8 OMEGA(3,3) 0.169 0.0197 0.411 0.0240 FALSE
#> 9 OMEGA(2,1) 0.0690 0.0200 0.511 0.0975 FALSE
#> 10 OMEGA(3,1) 0.134 0.0236 0.694 0.0686 FALSE
#> 11 OMEGA(3,2) 0.0735 0.0105 0.622 0.0524 FALSE
#> 12 SIGMA(1,1) 0.0399 0.00123 0.200 0.00307 FALSE
#> # ℹ 27 more variables: diag <lgl>, shrinkage <dbl>, name <chr>, abb <chr>,
#> # desc <chr>, panel <chr>, trans <chr>, nrow <int>, 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>, value <dbl>, se <dbl>, corr_SD <dbl>, lower <dbl>,
#> # upper <dbl>, ci_level <dbl>
# Using a `bbr` model
if (FALSE) { # \dontrun{
mod <- bbr::read_model(file.path(model_dir, "102"))
define_param_table(mod, paramKey, .ci = 95)
} # }
