Combines model output parameter estimates with information in parameter key. Performs some formatting of this combined data.frame.
Expected input is a data.frame with parameter estimates, with the columns:
parameter_names
, estimate
, stderr
, random_effect_sd
, random_effect_sdse
,
fixed
, diag
, shrinkage
.
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 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).
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_param_table(.estimates, .key, .ci = 95, .zscore = NULL)
path to model directory, bbr NONMEM model, or data.frame of parameter estimates
path to parameter key or data.frame of parameter key. Described in more detail in param_key
confidence interval. Default is 95
z-score for the specified confidence interval. Only needed for confidence intervals that are NOT 90 or 95 percent
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")
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"
#> X.1 X parameter_names estimate stderr random_effect_sd
#> 1 1 1 THETA1 0.4335920 0.06287440 NA
#> 2 2 2 THETA2 4.1187600 0.02762730 NA
#> 3 3 3 THETA3 1.1150300 0.03284750 NA
#> 4 4 4 THETA4 4.2099100 0.01924850 NA
#> 5 5 5 THETA5 1.2863100 0.03542620 NA
#> 6 6 6 OMEGA(1,1) 0.2206060 0.05297990 0.469687
#> 7 8 8 OMEGA(2,2) 0.0826922 0.00982547 0.287563
#> 8 11 11 OMEGA(3,3) 0.1691160 0.01972890 0.411237
#> 9 7 7 OMEGA(2,1) 0.0690088 0.01996170 0.510933
#> 10 9 9 OMEGA(3,1) 0.1340090 0.02358740 0.693796
#> 11 10 10 OMEGA(3,2) 0.0735027 0.01054810 0.621554
#> 12 12 12 SIGMA(1,1) 0.0399167 0.00122595 0.199792
#> random_effect_sdse fixed diag shrinkage name abb
#> 1 NA FALSE NA NA THETA1 KA (1/h)
#> 2 NA FALSE NA NA THETA2 V2/F (L)
#> 3 NA FALSE NA NA THETA3 CL/F (L/h)
#> 4 NA FALSE NA NA THETA4 V3/F (L)
#> 5 NA FALSE NA NA THETA5 Q/F (L/h)
#> 6 0.05639920 FALSE TRUE 17.898800 OMEGA11 IIV-KA
#> 7 0.01708410 FALSE TRUE 6.023220 OMEGA22 IIV-V2/F
#> 8 0.02398730 FALSE TRUE 0.587219 OMEGA33 IIV-CL/F
#> 9 0.09746980 FALSE FALSE NA OMEGA21 V2/F-KA
#> 10 0.06860550 FALSE FALSE NA OMEGA31 CL/F-KA
#> 11 0.05238880 FALSE FALSE NA OMEGA32 CL/F-V2/F
#> 12 0.00306807 FALSE TRUE 5.275370 SIGMA11 Proportional
#> desc panel trans nrow transTHETA
#> 1 First order absorption rate constant struct logTrans 1 NA
#> 2 Apparent central volume struct logTrans 2 NA
#> 3 Apparent clearance struct logTrans 3 NA
#> 4 Apparent peripheral volume struct logTrans 4 NA
#> 5 Apparent intercompartmental clearance struct logTrans 5 NA
#> 6 Variance of absorption IIV lognormalOm 9 NA
#> 7 Variance of central volume IIV lognormalOm 10 NA
#> 8 Variance of clearance IIV lognormalOm 11 NA
#> 9 Covariance of V2/F - KA IIV none 12 NA
#> 10 Covariance of CL/F - KA IIV none 13 NA
#> 11 Covariance of CL/F - V2/F IIV none 14 NA
#> 12 Variance RV propErr 15 NA
#> THETAERR TH OM S LOG LOGIT lognormO Osd logitOsd propErr
#> 1 FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
#> 2 FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
#> 3 FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
#> 4 FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
#> 5 FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
#> 6 FALSE FALSE TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE
#> 7 FALSE FALSE TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE
#> 8 FALSE FALSE TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE
#> 9 FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> 10 FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> 11 FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> 12 FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE
#> addErr addErrLogDV value se corr_SD lower upper
#> 1 FALSE FALSE 0.4335920 0.06287440 - 0.31035818 0.55682582
#> 2 FALSE FALSE 4.1187600 0.02762730 - 4.06461049 4.17290951
#> 3 FALSE FALSE 1.1150300 0.03284750 - 1.05064890 1.17941110
#> 4 FALSE FALSE 4.2099100 0.01924850 - 4.17218294 4.24763706
#> 5 FALSE FALSE 1.2863100 0.03542620 - 1.21687465 1.35574535
#> 6 FALSE FALSE 0.2206060 0.05297990 - 0.11676540 0.32444660
#> 7 FALSE FALSE 0.0826922 0.00982547 - 0.06343428 0.10195012
#> 8 FALSE FALSE 0.1691160 0.01972890 - 0.13044736 0.20778464
#> 9 FALSE FALSE 0.0690088 0.01996170 0.511 0.02988387 0.10813373
#> 10 FALSE FALSE 0.1340090 0.02358740 0.694 0.08777770 0.18024030
#> 11 FALSE FALSE 0.0735027 0.01054810 0.622 0.05282842 0.09417698
#> 12 FALSE FALSE 0.0399167 0.00122595 - 0.03751384 0.04231956
#> ci_level
#> 1 95
#> 2 95
#> 3 95
#> 4 95
#> 5 95
#> 6 95
#> 7 95
#> 8 95
#> 9 95
#> 10 95
#> 11 95
#> 12 95
#To choose a confidence interval that is not 95 or 90, look up z-score and add as function parameter
define_param_table(.estimates = paramEst, .key = paramKey, .ci = 82, .zscore = 0.915)
#> [1] "Parameter table yaml path provided: /data/pmparams/inst/model/nonmem/pk-parameter-key-new.yaml"
#> X.1 X parameter_names estimate stderr random_effect_sd
#> 1 1 1 THETA1 0.4335920 0.06287440 NA
#> 2 2 2 THETA2 4.1187600 0.02762730 NA
#> 3 3 3 THETA3 1.1150300 0.03284750 NA
#> 4 4 4 THETA4 4.2099100 0.01924850 NA
#> 5 5 5 THETA5 1.2863100 0.03542620 NA
#> 6 6 6 OMEGA(1,1) 0.2206060 0.05297990 0.469687
#> 7 8 8 OMEGA(2,2) 0.0826922 0.00982547 0.287563
#> 8 11 11 OMEGA(3,3) 0.1691160 0.01972890 0.411237
#> 9 7 7 OMEGA(2,1) 0.0690088 0.01996170 0.510933
#> 10 9 9 OMEGA(3,1) 0.1340090 0.02358740 0.693796
#> 11 10 10 OMEGA(3,2) 0.0735027 0.01054810 0.621554
#> 12 12 12 SIGMA(1,1) 0.0399167 0.00122595 0.199792
#> random_effect_sdse fixed diag shrinkage name abb
#> 1 NA FALSE NA NA THETA1 KA (1/h)
#> 2 NA FALSE NA NA THETA2 V2/F (L)
#> 3 NA FALSE NA NA THETA3 CL/F (L/h)
#> 4 NA FALSE NA NA THETA4 V3/F (L)
#> 5 NA FALSE NA NA THETA5 Q/F (L/h)
#> 6 0.05639920 FALSE TRUE 17.898800 OMEGA11 IIV-KA
#> 7 0.01708410 FALSE TRUE 6.023220 OMEGA22 IIV-V2/F
#> 8 0.02398730 FALSE TRUE 0.587219 OMEGA33 IIV-CL/F
#> 9 0.09746980 FALSE FALSE NA OMEGA21 V2/F-KA
#> 10 0.06860550 FALSE FALSE NA OMEGA31 CL/F-KA
#> 11 0.05238880 FALSE FALSE NA OMEGA32 CL/F-V2/F
#> 12 0.00306807 FALSE TRUE 5.275370 SIGMA11 Proportional
#> desc panel trans nrow transTHETA
#> 1 First order absorption rate constant struct logTrans 1 NA
#> 2 Apparent central volume struct logTrans 2 NA
#> 3 Apparent clearance struct logTrans 3 NA
#> 4 Apparent peripheral volume struct logTrans 4 NA
#> 5 Apparent intercompartmental clearance struct logTrans 5 NA
#> 6 Variance of absorption IIV lognormalOm 9 NA
#> 7 Variance of central volume IIV lognormalOm 10 NA
#> 8 Variance of clearance IIV lognormalOm 11 NA
#> 9 Covariance of V2/F - KA IIV none 12 NA
#> 10 Covariance of CL/F - KA IIV none 13 NA
#> 11 Covariance of CL/F - V2/F IIV none 14 NA
#> 12 Variance RV propErr 15 NA
#> THETAERR TH OM S LOG LOGIT lognormO Osd logitOsd propErr
#> 1 FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
#> 2 FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
#> 3 FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
#> 4 FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
#> 5 FALSE TRUE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
#> 6 FALSE FALSE TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE
#> 7 FALSE FALSE TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE
#> 8 FALSE FALSE TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE
#> 9 FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> 10 FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> 11 FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#> 12 FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE
#> addErr addErrLogDV value se corr_SD lower upper
#> 1 FALSE FALSE 0.4335920 0.06287440 - 0.37606192 0.49112208
#> 2 FALSE FALSE 4.1187600 0.02762730 - 4.09348102 4.14403898
#> 3 FALSE FALSE 1.1150300 0.03284750 - 1.08497454 1.14508546
#> 4 FALSE FALSE 4.2099100 0.01924850 - 4.19229762 4.22752238
#> 5 FALSE FALSE 1.2863100 0.03542620 - 1.25389503 1.31872497
#> 6 FALSE FALSE 0.2206060 0.05297990 - 0.17212939 0.26908261
#> 7 FALSE FALSE 0.0826922 0.00982547 - 0.07370189 0.09168251
#> 8 FALSE FALSE 0.1691160 0.01972890 - 0.15106406 0.18716794
#> 9 FALSE FALSE 0.0690088 0.01996170 0.511 0.05074384 0.08727376
#> 10 FALSE FALSE 0.1340090 0.02358740 0.694 0.11242653 0.15559147
#> 11 FALSE FALSE 0.0735027 0.01054810 0.622 0.06385119 0.08315421
#> 12 FALSE FALSE 0.0399167 0.00122595 - 0.03879496 0.04103844
#> ci_level
#> 1 82
#> 2 82
#> 3 82
#> 4 82
#> 5 82
#> 6 82
#> 7 82
#> 8 82
#> 9 82
#> 10 82
#> 11 82
#> 12 82