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

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 where necessary, the transformation applied to that parameter.

  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

  1. Select columns for final tables.

format_param_table(
  .df,
  .select_cols = c("type", "abb", "greek", "desc", "value", "ci", "shrinkage"),
  .prse = FALSE,
  .digit = getOption("pmparams.dig"),
  .maxex = getOption("pmparams.maxex")
)

Arguments

.df

parameter estimates output from define_param_table with modifications ready for formatting

.select_cols

columns to select for output. Default selects "type", "abb", "greek", "desc", "value", "ci", "shrinkage". To return all columns, specify "all" for .select_cols

.prse

output pRSE. Default is FALSE

.digit

set significant digits for output (optional). Default is three digits

.maxex

set maxex for computation (optional). Default is NULL

Examples


#Using output from `define_param_table` (defineOut),
paramEst <- utils::read.csv(system.file("model/nonmem/param_est.csv", package = "pmparams"))
paramKey <-  system.file("model/nonmem/pk-parameter-key-new.yaml", package = "pmparams")
defineOut <- define_param_table(.estimates = paramEst, .key = paramKey, .ci = 95, .zscore = NULL)
#> [1] "Parameter table yaml path provided: /data/pmparams/inst/model/nonmem/pk-parameter-key-new.yaml"

format_param_table(.df = defineOut)
#>                                     type          abb                greek
#> 1            Structural model parameters     KA (1/h) $\\exp(\\theta_{1})$
#> 2            Structural model parameters     V2/F (L) $\\exp(\\theta_{2})$
#> 3            Structural model parameters   CL/F (L/h) $\\exp(\\theta_{3})$
#> 4            Structural model parameters     V3/F (L) $\\exp(\\theta_{4})$
#> 5            Structural model parameters    Q/F (L/h) $\\exp(\\theta_{5})$
#> 6    Interindividual variance parameters       IIV-KA    $\\Omega_{(1,1)}$
#> 7    Interindividual variance parameters     IIV-V2/F    $\\Omega_{(2,2)}$
#> 8    Interindividual variance parameters     IIV-CL/F    $\\Omega_{(3,3)}$
#> 9  Interindividual covariance parameters      V2/F-KA    $\\Omega_{(2,1)}$
#> 10 Interindividual covariance parameters      CL/F-KA    $\\Omega_{(3,1)}$
#> 11 Interindividual covariance parameters    CL/F-V2/F    $\\Omega_{(3,2)}$
#> 12                     Residual variance Proportional    $\\Sigma_{(1,1)}$
#>                                     desc               value          ci_95
#> 1   First order absorption rate constant                1.54     1.36, 1.75
#> 2                Apparent central volume                61.5     58.2, 64.9
#> 3                     Apparent clearance                3.05     2.86, 3.25
#> 4             Apparent peripheral volume                67.4     64.9, 69.9
#> 5  Apparent intercompartmental clearance                3.62     3.38, 3.88
#> 6                 Variance of absorption  0.221 [CV\\%=49.7]   0.117, 0.324
#> 7             Variance of central volume 0.0827 [CV\\%=29.4]  0.0634, 0.102
#> 8                  Variance of clearance  0.169 [CV\\%=42.9]   0.130, 0.208
#> 9                Covariance of V2/F - KA 0.0690 [Corr=0.511]  0.0299, 0.108
#> 10               Covariance of CL/F - KA  0.134 [Corr=0.694]  0.0878, 0.180
#> 11             Covariance of CL/F - V2/F 0.0735 [Corr=0.622] 0.0528, 0.0942
#> 12                              Variance 0.0399 [CV\\%=20.0] 0.0375, 0.0423
#>    shrinkage
#> 1          -
#> 2          -
#> 3          -
#> 4          -
#> 5          -
#> 6       17.9
#> 7       6.02
#> 8      0.587
#> 9          -
#> 10         -
#> 11         -
#> 12      5.28

#To include all columns:

format_param_table(.df = defineOut, .select_cols="all")
#>    X.1  X  num2  estimate     stderr random_effect_sd random_effect_sdse fixed
#> 1    1  1     1 0.4335920 0.06287440               NA                 NA FALSE
#> 2    2  2     2 4.1187600 0.02762730               NA                 NA FALSE
#> 3    3  3     3 1.1150300 0.03284750               NA                 NA FALSE
#> 4    4  4     4 4.2099100 0.01924850               NA                 NA FALSE
#> 5    5  5     5 1.2863100 0.03542620               NA                 NA FALSE
#> 6    6  6 (1,1) 0.2206060 0.05297990         0.469687         0.05639920 FALSE
#> 7    8  8 (2,2) 0.0826922 0.00982547         0.287563         0.01708410 FALSE
#> 8   11 11 (3,3) 0.1691160 0.01972890         0.411237         0.02398730 FALSE
#> 9    7  7 (2,1) 0.0690088 0.01996170         0.510933         0.09746980 FALSE
#> 10   9  9 (3,1) 0.1340090 0.02358740         0.693796         0.06860550 FALSE
#> 11  10 10 (3,2) 0.0735027 0.01054810         0.621554         0.05238880 FALSE
#> 12  12 12 (1,1) 0.0399167 0.00122595         0.199792         0.00306807 FALSE
#>     diag shrinkage    name          abb                                  desc
#> 1     NA         -  THETA1     KA (1/h)  First order absorption rate constant
#> 2     NA         -  THETA2     V2/F (L)               Apparent central volume
#> 3     NA         -  THETA3   CL/F (L/h)                    Apparent clearance
#> 4     NA         -  THETA4     V3/F (L)            Apparent peripheral volume
#> 5     NA         -  THETA5    Q/F (L/h) Apparent intercompartmental clearance
#> 6   TRUE      17.9 OMEGA11       IIV-KA                Variance of absorption
#> 7   TRUE      6.02 OMEGA22     IIV-V2/F            Variance of central volume
#> 8   TRUE     0.587 OMEGA33     IIV-CL/F                 Variance of clearance
#> 9  FALSE         - OMEGA21      V2/F-KA               Covariance of V2/F - KA
#> 10 FALSE         - OMEGA31      CL/F-KA               Covariance of CL/F - KA
#> 11 FALSE         - OMEGA32    CL/F-V2/F             Covariance of CL/F - V2/F
#> 12  TRUE      5.28 SIGMA11 Proportional                              Variance
#>     panel       trans transTHETA THETAERR    TH    OM     S   LOG LOGIT
#> 1  struct    logTrans         NA    FALSE  TRUE FALSE FALSE  TRUE FALSE
#> 2  struct    logTrans         NA    FALSE  TRUE FALSE FALSE  TRUE FALSE
#> 3  struct    logTrans         NA    FALSE  TRUE FALSE FALSE  TRUE FALSE
#> 4  struct    logTrans         NA    FALSE  TRUE FALSE FALSE  TRUE FALSE
#> 5  struct    logTrans         NA    FALSE  TRUE FALSE FALSE  TRUE FALSE
#> 6     IIV lognormalOm         NA    FALSE FALSE  TRUE FALSE FALSE FALSE
#> 7     IIV lognormalOm         NA    FALSE FALSE  TRUE FALSE FALSE FALSE
#> 8     IIV lognormalOm         NA    FALSE FALSE  TRUE FALSE FALSE FALSE
#> 9     IIV        none         NA    FALSE FALSE  TRUE FALSE FALSE FALSE
#> 10    IIV        none         NA    FALSE FALSE  TRUE FALSE FALSE FALSE
#> 11    IIV        none         NA    FALSE FALSE  TRUE FALSE FALSE FALSE
#> 12     RV     propErr         NA    FALSE FALSE FALSE  TRUE FALSE FALSE
#>    lognormO   Osd logitOsd propErr addErr addErrLogDV               value
#> 1     FALSE FALSE    FALSE   FALSE  FALSE       FALSE                1.54
#> 2     FALSE FALSE    FALSE   FALSE  FALSE       FALSE                61.5
#> 3     FALSE FALSE    FALSE   FALSE  FALSE       FALSE                3.05
#> 4     FALSE FALSE    FALSE   FALSE  FALSE       FALSE                67.4
#> 5     FALSE FALSE    FALSE   FALSE  FALSE       FALSE                3.62
#> 6      TRUE FALSE    FALSE   FALSE  FALSE       FALSE  0.221 [CV\\%=49.7]
#> 7      TRUE FALSE    FALSE   FALSE  FALSE       FALSE 0.0827 [CV\\%=29.4]
#> 8      TRUE FALSE    FALSE   FALSE  FALSE       FALSE  0.169 [CV\\%=42.9]
#> 9     FALSE FALSE    FALSE   FALSE  FALSE       FALSE 0.0690 [Corr=0.511]
#> 10    FALSE FALSE    FALSE   FALSE  FALSE       FALSE  0.134 [Corr=0.694]
#> 11    FALSE FALSE    FALSE   FALSE  FALSE       FALSE 0.0735 [Corr=0.622]
#> 12    FALSE FALSE    FALSE    TRUE  FALSE       FALSE 0.0399 [CV\\%=20.0]
#>            se corr_SD       lower       upper ci_level   cv pRSE sd  text
#> 1  0.06287440       -  1.36391355  1.74512437       95    - 6.29  - theta
#> 2  0.02762730       - 58.24221829 64.90401641       95    - 2.76  - theta
#> 3  0.03284750       -  2.85950605  3.25245827       95    - 3.29  - theta
#> 4  0.01924850       - 64.85687636 69.93995303       95    - 1.93  - theta
#> 5  0.03542620       -  3.37661811  3.87965159       95    - 3.54  - theta
#> 6  0.05297990       -  0.11676540  0.32444660       95 49.7 24.0  - Omega
#> 7  0.00982547       -  0.06343428  0.10195012       95 29.4 11.9  - Omega
#> 8  0.01972890       -  0.13044736  0.20778464       95 42.9 11.7  - Omega
#> 9  0.01996170   0.511  0.02988387  0.10813373       95    -    -  - Omega
#> 10 0.02358740   0.694  0.08777770  0.18024030       95    -    -  - Omega
#> 11 0.01054810   0.622  0.05282842  0.09417698       95    -    -  - Omega
#> 12 0.00122595       -  0.03751384  0.04231956       95 20.0 3.07  - Sigma
#>                   greek                                  type type_f
#> 1  $\\exp(\\theta_{1})$           Structural model parameters      1
#> 2  $\\exp(\\theta_{2})$           Structural model parameters      1
#> 3  $\\exp(\\theta_{3})$           Structural model parameters      1
#> 4  $\\exp(\\theta_{4})$           Structural model parameters      1
#> 5  $\\exp(\\theta_{5})$           Structural model parameters      1
#> 6     $\\Omega_{(1,1)}$   Interindividual variance parameters      3
#> 7     $\\Omega_{(2,2)}$   Interindividual variance parameters      3
#> 8     $\\Omega_{(3,3)}$   Interindividual variance parameters      3
#> 9     $\\Omega_{(2,1)}$ Interindividual covariance parameters      5
#> 10    $\\Omega_{(3,1)}$ Interindividual covariance parameters      5
#> 11    $\\Omega_{(3,2)}$ Interindividual covariance parameters      5
#> 12    $\\Sigma_{(1,1)}$                     Residual variance      6
#>             ci_95
#> 1      1.36, 1.75
#> 2      58.2, 64.9
#> 3      2.86, 3.25
#> 4      64.9, 69.9
#> 5      3.38, 3.88
#> 6    0.117, 0.324
#> 7   0.0634, 0.102
#> 8    0.130, 0.208
#> 9   0.0299, 0.108
#> 10  0.0878, 0.180
#> 11 0.0528, 0.0942
#> 12 0.0375, 0.0423