Format parameter estimate values and output selected columns to be shown in the parameter table.

format_param_table(
  .df,
  .cleanup_cols = TRUE,
  .prse = FALSE,
  .digit = getOption("pmparams.dig"),
  .maxex = getOption("pmparams.maxex"),
  .select_cols = NULL
)

Arguments

.df

Parameter estimates output from define_param_table() with modifications ready for formatting.

.cleanup_cols

Logical (T/F). Defaults to TRUE, which selects the following columns:

  • "type", "abb", "greek", "desc", "value", "ci", "shrinkage".

  • Set to FALSE to return all columns.

.prse

Logical (T/F). If TRUE, output pRSE. Default is FALSE.

.digit

Number of significant digits. Default is three digits

.maxex

Maximum number of significant digits before moving to scientific notation. Default is NULL

.select_cols

Deprecated. Please use .cleanup_cols instead.

Details

There are four main steps of this function:

  1. When necessary, back transform parameters and their CIs, round parameters using pmtables::sig, and combine columns.

  2. Format the THETA/OMEGA/SIGMA values to display as Greek letters in LaTeX, with subscript numbers, and indicate the transformation applied to that parameter, if applicable.

  3. Determine which panel of the final table the parameter should be displayed in. This is informed by the panel argument you defined in your parameter key. Note that there are a finite number of options included by default (see below), but you can include additional panels as needed.

    Panel types include:

    • Residual variance

    • Interindividual covariance parameters

    • Interindividual variance parameters

    • Interoccasion variance parameters

    • Covariate effect parameters

    • Structural model parameters

  4. Select columns for final tables.

Examples


model_dir <- system.file("model/nonmem", package = "pmparams")
paramKey <-  file.path(model_dir, "pk-parameter-key-new.yaml")

# Using a file path:
param_ests <- readr::read_csv(file.path(model_dir, "param_est_102.csv"))
#> 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.
param_df <- define_param_table(
 .estimates = param_ests,
 .key = paramKey,
 .ci = 95,
)

format_param_table(param_df)
#> # A tibble: 12 × 7
#>    type                                  abb   greek desc  value shrinkage ci_95
#>    <chr>                                 <chr> <glu> <chr> <glu> <chr>     <chr>
#>  1 Structural model parameters           KA (… $\ex… Firs… 1.54  -         1.36…
#>  2 Structural model parameters           V2/F… $\ex… Appa… 61.5  -         58.2…
#>  3 Structural model parameters           CL/F… $\ex… Appa… 3.05  -         2.86…
#>  4 Structural model parameters           V3/F… $\ex… Appa… 67.4  -         64.9…
#>  5 Structural model parameters           Q/F … $\ex… Appa… 3.62  -         3.38…
#>  6 Interindividual variance parameters   IIV-… $\Om… Vari… 0.22… 18.2      0.11…
#>  7 Interindividual variance parameters   IIV-… $\Om… Vari… 0.08… 6.32      0.06…
#>  8 Interindividual variance parameters   IIV-… $\Om… Vari… 0.16… 0.898     0.13…
#>  9 Interindividual covariance parameters V2/F… $\Om… Cova… 0.06… -         0.02…
#> 10 Interindividual covariance parameters CL/F… $\Om… Cova… 0.13… -         0.08…
#> 11 Interindividual covariance parameters CL/F… $\Om… Cova… 0.07… -         0.05…
#> 12 Residual variance                     Prop… $\Si… Vari… 0.03… 5.28      0.03…

# To include all columns:
format_param_table(param_df, .cleanup_cols = FALSE)
#> # A tibble: 12 × 39
#>    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
#> # ℹ 33 more variables: diag <lgl>, shrinkage <chr>, 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 <glue>, se <dbl>, corr_SD <chr>, lower <dbl>,
#> #   upper <dbl>, cv <chr>, sd <chr>, text <chr>, greek <glue>, type <chr>,
#> #   type_f <dbl>, ci_95 <chr>

# Using a `bbr` model
if (FALSE) { # \dontrun{
mod <- bbr::read_model(file.path(model_dir, "102"))
param_df <- define_param_table(
 .estimates = mod,
 .key = paramKey,
 .ci = 95,
) %>% format_param_table()
} # }