Generate Response Surface Contour Plots for eFAST Results
Source:R/contour-plot.R
getContourPlot.RdGenerates a matrix of contour plots visualizing the pairwise response surfaces of model outputs based on eFAST sensitivity analysis results.
Arguments
- efastResults
A list object containing the complete results of an eFAST sensitivity analysis. Expected structure:
- InputOutputDf
Data frame containing simulation inputs, output paths, PK parameters, and calculated values.
- Parameters
Data frame or list containing parameter metadata, specifically
pathanddisplayName.- Results
Data frame containing calculated sensitivity indices (
Measure,Value,ParameterDisplayName).- Outputs
Data frame or list containing output metadata (
path,displayName).
- jitterSize
A numeric value representing the noise magnitude added during interpolation. Passed to
getPairwiseGrid. Defaults to 0 (thoughgetPairwiseGridmay apply a default if needed).- gridSize
An integer specifying the resolution of the contour grids. Defaults to 40.
- logScale
Logical. If
TRUE(default), the response variable (Z-axis) is log-transformed (log10) before plotting. This is recommended for PK data with large dynamic ranges. If data contains zeros or negative values, the function automatically falls back to a linear scale with a warning.
Value
A nested list of ggplot objects, structured as:
plotList[[outputName]][[pkParameter]].
Each element is a complete ggplot object ready for printing or saving.
Details
This function creates a visualization tool to identify parameter interactions and non-linearities. The process involves:
Iterating through every unique Output and PK parameter (e.g., "C_max", "AUC") in the results.
For each Output/PK combination, extracting the relevant simulation data.
Calling
getPairwiseGridto generate interpolated surfaces for all parameter pairs.Optionally applying a log-transformation to the response values (Z-axis) to handle wide dynamic ranges common in PK/PD.
Ranking parameters based on their Total Sensitivity index ($S_T$) so that the most influential parameters appear in the top-left of the plot matrix.
Constructing a
ggplot2object usinggeom_contour_filledandfacet_gridto display the full matrix of pairwise interactions.
The resulting plot is a scatterplot matrix where:
Off-diagonal cells display filled contours of the response surface for two parameters.
Diagonal cells display the names of the parameters.