Generate a complete bootstrap parameter table ready for rendering via pmtables

make_boot_pmtable(
  .df,
  .pmtype = c("full", "fixed", "structural", "covariate", "random"),
  .span_model_label = "Final model",
  .span_boot_label = "Non-parametric bootstrap",
  .drop_model_ci = TRUE,
  .width = 1
)

Arguments

.df

Combined dataset of model and bootstrap parameter estimates. See examples.

.pmtype

Parameter table type. Options include:

  • "full" (all rows in .df retained in pmtable). This is the default.

  • "fixed" (all rows with type = "Struct" or "effect"),

  • "structural" (all rows with type = "Struct"),

  • "covariate" (all rows with type = "effect"),

  • "random" (all rows with greek = "Omega" or type = "Resid").

.span_model_label

A label for the span above columns relating to the model that was bootstrapped.

.span_boot_label

A label for the span above columns relating to the confidence interval of bootstrap estimates.

.drop_model_ci

Logical (T/F). If TRUE (the default), drop original CI columns (ci_[x]).

.width

Notes width. Defaults to 1.

Details

Generates specific parameter tables by filtering and using pmtables. This function expects a data.frame with both the regular parameter estimates and the bootstrap parameter estimates. See "Examples" for more detail.

This function:

  1. Filters to columns needed for specific parameter tables

  2. Panels by "type"

  3. Makes "abb", "greek", "desc" blank (no title)

    • Note that description is removed when .pmtype = "random". See ?pmtables::st_mutate() if you want to add it back in.

  4. Attaches notes

  5. Rename "value" to "Estimate" and "shrinkage" to "Shrinkage (%)", if applicable

Note: If these pmtables settings do not work for your parameter table, you can overwrite them afterwards using desired pmtables commands.

Examples


if (FALSE) { # \dontrun{

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

# Parameter estimates
mod <- bbr::read_model(file.path(model_dir, "106"))
param_df <- define_param_table(
 .estimates = mod,
 .key = paramKey,
) %>% format_param_table(.prse = TRUE)

# Bootstrap estimates
boot_run <- bbr::read_model(file.path(model_dir, "106-boot"))
boot_df <- define_boot_table(
 .boot_estimates = bbr::bootstrap_estimates(boot_run),
 .key = paramKey
) %>% format_boot_table()

# Combine parameter estimates with bootstrap estimates
combine_df <- dplyr::left_join(param_df, boot_df)

# Fixed effects table
make_boot_pmtable(.df = combine_df, .pmtype = "fixed") %>%
 pmtables::stable() %>%
 # preview in Rstudio viewer (requires `magick` and `pdftools`)
 pmtables::st_as_image(border = "0.8cm 0.7cm 1.8cm 0.8cm")


# Random effects table
make_boot_pmtable(.df = combine_df, .pmtype = "random") %>%
 pmtables::stable() %>%
 pmtables::st_as_image(border = "0.8cm 0.7cm")
} # }