Residuals vs covariate plot
res_vs_cov.RdPlot Residuals against a continuous or categorical covariate.
Usage
res_vs_cov(
xpdb,
mapping = NULL,
covariate,
res = "CWRES",
group = "ID",
type = "bpls",
title = "Residuals vs @x | @run",
subtitle = "Based on @nind individuals",
caption = "@dir",
tag = NULL,
log = NULL,
guide = TRUE,
facets,
.problem,
quiet,
...
)Arguments
- xpdb
An xpose database object.
- mapping
List of aesthetics mappings to be used for the xpose plot (e.g.
point_color).- covariate
Character; String of covariate name
- res
Character; String of residual name; CWRES by default.
- group
Grouping variable to be used for lines.
IDby default- type
Character; String setting the type of plot to be used. Must be 'b' for categorical covariates, one or a combination of 'p','l','s' for continuous covariates.
- title
Character; Plot title. Use
NULLto remove.- subtitle
Character; Plot subtitle. Use
NULLto remove.- caption
Character; Page caption. Use
NULLto remove.- tag
Character; Plot identification tag. Use
NULLto remove.- log
Character; String assigning logarithmic scale to axes, can be either ”, 'x', y' or 'xy'.
- guide
Logical; Should the guide (e.g. reference distribution) be displayed.
- facets
Either a character string to use
facet_wrap_paginateor a formula to usefacet_grid_paginate.- .problem
The $problem number to be used. By default returns the last estimation problem.
- quiet
Logical, if
FALSEmessages are printed to the console.- ...
Any additional aesthetics to be passed on
xplot_scatterorxplot_box.
Value
An object of class xpose_plot, ggplot, and gg. This object represents a customized plot created using ggplot2.
The xpose_plot class provides additional metadata and integration with xpose workflows, allowing for advanced
customization and compatibility with other xpose functions. Users can interact with the plot object as they
would with any ggplot2 object, including modifying aesthetics, adding layers, or saving the plot.
Layers mapping
Plots can be customized by mapping arguments to specific layers. The naming convention is
layer_option where layer is one of the names defined in the list below and option is
any option supported by this layer e.g. boxplot_fill = 'blue', etc.
box plot: options to
geom_boxplotpoint plot: options to
geom_pointline plot: options to
geom_linesmooth plot: options to
geom_smoothxscale: options to
scale_x_continuousorscale_x_log10yscale: options to
scale_y_continuousorscale_y_log10
Examples
res_vs_cov(xpose::xpdb_ex_pk,
covariate = "SEX",
type = "b",
res = "WRES"
)
#> Using data from $prob no.1
#> Filtering data by EVID == 0
res_vs_cov(xpose::xpdb_ex_pk,
covariate = "AGE",
type = "ps",
res = c("CWRES", "WRES", "IRES", "IWRES")
)
#> Using data from $prob no.1
#> Filtering data by EVID == 0
#> Tidying data by ID, SEX, MED1, MED2, DOSE ... and 23 more variables
#> `geom_smooth()` using formula = 'y ~ x'
#> `geom_smooth()` using formula = 'y ~ x'