Parameter vs covariate Plot
prm_vs_cov.Rd
Plot Parameters against a continuous or categorical covariate.
Usage
prm_vs_cov(
xpdb,
covariate,
mapping = NULL,
drop_fixed = FALSE,
group = "ID",
type = "bpls",
title = "Parameters vs @x | @run",
subtitle = "Based on @nind individuals",
caption = "@dir",
tag = NULL,
log = NULL,
guide = FALSE,
onlyfirst = FALSE,
facets,
.problem,
quiet,
...
)
Arguments
- xpdb
An xpose database object.
- covariate
Character; String of covariate name
- mapping
List of aesthetics mappings to be used for the xpose plot (e.g.
point_color
).- drop_fixed
Logical; logic specifying whether structural parameters having same value for the given covariate value should be removed from plotting
- group
Grouping variable to be used for lines.
ID
by 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
NULL
to remove.- subtitle
Character; Plot subtitle. Use
NULL
to remove.Character; Page caption. Use
NULL
to remove.- tag
Character; Plot identification tag. Use
NULL
to remove.- log
Character; String assigning logarithmic scale to axes, can be either ”, 'x', y' or 'xy'.
- guide
Logical; Enable guide display (e.g. unity line).
- onlyfirst
Logical; Should the data be filtered to retain first value for each group/facet.
- facets
Either a character string to use
facet_wrap_paginate
or a formula to usefacet_grid_paginate
.- .problem
The $problem number to be used. By default returns the last estimation problem.
- quiet
Logical, if
FALSE
messages are printed to the console.- ...
Any additional aesthetics to be passed on
xplot_scatter
orxplot_box
.
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_boxplot
point plot: options to
geom_point
line plot: options to
geom_line
smooth plot: options to
geom_smooth
xscale: options to
scale_x_continuous
orscale_x_log10
yscale: options to
scale_y_continuous
orscale_y_log10
Examples
prm_vs_cov(xpose::xpdb_ex_pk,
covariate = "AGE", type = "ps",
log = "y",
yscale_breaks = scales::trans_breaks("log10", function(x) 10^x),
yscale_labels = scales::trans_format("log10", scales::math_format(10^.x)),
caption = NULL
)
#> Using data from $prob no.1
#> Tidying data by ID, SEX, MED1, MED2, DOSE ... and 22 more variables
#> `geom_smooth()` using formula = 'y ~ x'
#> `geom_smooth()` using formula = 'y ~ x'
prm_vs_cov(xpose::xpdb_ex_pk,
covariate = "SEX",
type = "b",
boxplot_fill = "blue",
boxplot_color = "black",
boxplot_outlier.color = "red"
)
#> Using data from $prob no.1
#> Tidying data by ID, SEX, MED1, MED2, DOSE ... and 22 more variables