12  Exploratory and diagnostic displays

Displays of exploratory or diagnostic plots have several figures sharing a common theme arranged on a single page. These displays tend to have fixed composition and arrangement, with some customization allowed. If you want a totally custom display, it is best to create your own from base pmplots functions, arranging as you like with the patchwork package.

Displays can include ETA, NPDE or CWRES based plots.

12.1 NPDE-based diagnositcs

Use npde_panel() to create a standardized panel of common NPDE-based diagnostics

data <- pmplots_data_obs()

npde_panel(data)

12.1.1 Tag levels

You can label the panels with the plot_annotation() function from the patchwork package

npde_panel(data) + 
  plot_annotation(tag_levels = "A")

12.1.2 NPDE scatter

This display includes just a subset of the diagnostics which are scatter plots

npde_scatter(data)

12.1.3 NPDE histogram and qq plot

This display is the complement of the scatter plots

npde_hist_q(data)

12.2 NPDE versus covariate

You can enter a mix of categorical and continuous covariates: here, WT and SCR are continuous covariates and RF and CPc are categorical

covs <- c(
  "WT  // Weight (kg)", 
  "SCR // Serum creatinine (mg/dL)", 
  "RF  // Renal group", 
  "CPc // Child-Pugh"
)
npde_covariate(data, covs)

12.3 CWRES-based diagnostics

There are a equivalent set of displays which show CWRES rather than NPDE

cwres_panel(data) 

12.3.1 CWRES scatter

cwres_scatter(data)

12.3.2 CWRES histogram and qq plot

cwres_hist_q(data)

12.4 CWRES versus covariate

covs <- c(
  "WT  // Weight (kg)", 
  "SCR // Serum creatinine (mg/dL)", 
  "RF  // Renal group", 
  "CPc // Child-Pugh"
)
cwres_covariate(data, covs)

12.5 ETA versus covariate

These displays are created with eta_covariate(). Since there are typically several ETAs to look at, this function returns a list of arranged plots

id <- pmplots_data_id()
etas <- eta_col_labs(CL, V2, KA)
etas
        ETA-CL         ETA-V2         ETA-KA 
"ETA1//ETA-CL" "ETA2//ETA-V2" "ETA3//ETA-KA" 

For ETA diagnostics, we can plot versus a mix of categorical and continuous covariates

covs <- c(
  "WT // Weight (kg)", 
  "AAG // AAG (mg/dL)", 
  "AGE // Age (years)", 
  "STUDYc // Study", 
  "RF // Renal function", 
  "CPc // Child-Pugh"
)

cov <- eta_covariate(id, x = covs , y = etas, byrow = FALSE) 

By default, the plots are collected by the ETA

names(cov)
[1] "ETA1" "ETA2" "ETA3"
cov$ETA1

Use the transpose argument to collect by the covariate

cov <- eta_covariate(id, covs, etas, transpose = TRUE, ncol = 1)

names(cov)
[1] "WT"     "AAG"    "AGE"    "STUDYc" "RF"     "CPc"   
cov$WT