Skip to contents

Plots a Quantile-Quantile plot, grouped by "group".

This function visualizes the distribution of predicted vs observed values using a Q-Q plot.

Usage

plotQuantileQuantilePlot(
  plotData,
  metaData = NULL,
  mapping = ggplot2::aes(),
  xUnit = NULL,
  yUnit = NULL,
  residualScale = "log",
  watermark = NULL,
  watermarkFormat = NULL,
  ...
)

Arguments

plotData

An object of class DataCombined or a data.table. If a data.table, it must include the following:

  • xValues: Numeric time points.

  • yValues: Observed or simulated values (numeric).

  • group: Grouping variable (factor or character).

  • name: Name for the dataset (factor or character).

  • xUnit: Unit of the x-axis values (character).

  • yUnit: Unit of the y-axis values (character).

  • dataType: Specifies data type—either observed or simulated.

  • Optional:

    • yErrorType: Type of y error, relative to ospsuite::DataErrorType.

    • yErrorValues: Numeric error values.

    • yMin, yMax: Custom ranges for y-axis instead of error types.

    • IndividualId: Used for aggregation of simulated population data.

metaData

A list containing metadata for the plot. If NULL, a default list is constructed from the data. Expected structure includes information about dimensions and units for both x and y axes.

mapping

A ggplot2 aesthetic mapping object. Default is ggplot2::aes(). This is added or replaces the default mapping constructed by the data.

xUnit

A character string specifying the target unit for the x-axis. If NULL (default), the most frequent unit in the data is used. For available units, see ospsuite::ospUnits.

yUnit

A character string specifying the target unit for the simulated and observed y-values used for residual calculation. If NULL (default), the most frequent unit in the data is used. For available units, see ospsuite::ospUnits.

residualScale

Either "linear", "log", or "ratio" method for computing residuals. Default is log.

watermark

Optional watermark text for this plot.

watermarkFormat

Optional list of watermark formatting values.

...

Arguments passed on to ospsuite.plots::plotQQ

xScaleArgs

list of arguments passed to ggplot2::scale_x_continuous() or ggplot2::scale_x_log10()

yScaleArgs

list of arguments passed to ggplot2::scale_y_continuous() or ggplot2::scale_y_log10()

geomQQAttributes

A list of arguments passed to ggplot2::stat_qq().

geomQQLineAttributes

A list of arguments passed to ggplot2::stat_qq_line().

groupAesthetics

A character vector of aesthetic names used for grouping data points in the Q-Q plot. Common options include "colour", "fill", "shape", "linetype", and "size".

Value

A ggplot2 plot object representing the Q-Q plot, or NULL if the data contains no plottable entries.

See also

Examples

# Generate a Q-Q plot with default settings
plotQuantileQuantilePlot(dataCombinedAciclovir)


# Generate a Q-Q plot with linear scale
plotQuantileQuantilePlot(dataCombinedAciclovir, residualScale = "linear")