MonolixSuite in R
Auto Light Dark
Auto Light Dark

plotCAParametersDistribution

[PKanalix] Distribution of the individual CA parameters

Plot the distribution of the individual CA parameters.

Usage

R
plotCAParametersDistribution(
  parameters = NULL,
  settings = list(),
  preferences = list(),
  stratify = list()
)

Arguments

parameters

(vector) vector of CA parameters to display. (by default the first 12 computed ca parameters are displayed).

settings

List with the following settings:

  • plot (character) Type of plot: probability density distribution as histogram ("pdf", default), or cumulative density distribution ("cdf").

  • legend (logical) If TRUE, plot legend is displayed (default FALSE).

  • grid (logical) If TRUE, plot grid is displayed (default TRUE).

  • ncol (integer) number of columns to arrange subplots (default 4).

  • fontsize (integer) Font size of text elements (default 11).

  • units (logical) If TRUE, units are added in axis labels (default TRUE).

  • scales (character) Should scales be fixed ("fixed"), free ("free", default), or free in one dimension ("free_x", "free_y").

preferences

(optional) preferences for plot display, run getPlotPreferences("plotCAParametersDistribution") to check available options.

stratify

List with the stratification arguments:

  • groups - Definition of stratification groups. By default, stratification groups are already defined as one group for each category for categorical covariates, and two groups of equal number of individuals for continuous covariates. To redefine groups, for each covariate to redefine, specify a list with:

    name

    character

    covariate name (e.g "AGE")

    definition

    vector(continuous) || list>(categorical)

    For continuous covariates, vector of break values (e.g c(35, 65)). For categorical covariates, groups of categories as a list of vectors(e.g list(c("study101"), c("study201","study202")))

  • split (vector) - Vector of covariates used to split (i.e facet) the plot (by default no split is applied). For instance c("FORM","AGE").

  • filter (list< list> >) - List of pairs containing a covariate name and the vector of indexes or categories (for categorical covariates) of the groups to keep (by default no filtering is applied). For instance, list("AGE",c(1,3)) to keep the individuals belonging to the first and third age group, according to the definition in groups. For instance, list("FORM","ref") using the category name for categorical covariates.

Value

  • A ggplot object if only one parameter is specified in parameters

  • A TableGrob object if multiple plots (output of grid.arrange)

See also

getPlotPreferences

Examples

R
  initializeLixoftConnectors(software = "pkanalix")
  project <- file.path(getDemoPath(), "/2.case_studies/project_Theo_extravasc_SD.pkx")
  loadProject(project)
  runCAEstimation()
  
# plot a single parameter, as pdf or cdf
plotCAParametersDistribution(parameters = "V", settings = list(plot = "pdf"))

plotCAParametersDistribution for V with plot set to pdf, a histogram of density versus V in L. Six blue bins span about 2 to 68 L, with the tallest bin between about 24 and 35 L at a density of about 0.035 and low bins at both ends.
R

plotCAParametersDistribution(parameters = "Cl", settings = list(plot = "cdf"))

plotCAParametersDistribution for Cl with plot set to cdf, an empirical cumulative distribution curve of probability from 0 to 1 versus Cl in L per h. The curve rises steeply between about 2.4 and 5 L per h, reaching about 0.86, then flattens up to about 11.6 L per h.
R


# with a single parameter, a ggplot object if returned and additional ggplot elements can be added
library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 4.3.3
plotCAParametersDistribution(parameters = "V")+geom_vline(xintercept=52)

Histogram of V in L from plotCAParametersDistribution with a ggplot2 geom_vline added, showing density bins from about 2 to 68 L and a black vertical line at V equals 52 L. It illustrates that extra ggplot2 layers can be added to the returned plot object.
R


# display 4 parameters in a 2x2 matrix (ncol=2)
plotCAParametersDistribution(parameters = c('V','Cl','ka','Tlag'),
                             settings = list(ncol=2))

plotCAParametersDistribution for V, Cl, ka and Tlag in a 2 by 2 grid with ncol 2. Each panel is a blue density histogram. V in L is roughly bell shaped, Cl in L per h and ka in per h are right skewed with most values below about 5.5 and 0.15, and Tlag in h is bimodal with peaks near 0.5 to 1 h and 1.5 to 2 h.
R

#> TableGrob (1 x 1) "arrange": 1 grobs
#>   z     cells    name            grob
#> 1 1 (1-1,1-1) arrange gtable[arrange]

# changing the settings to choose which elements to display
plotCAParametersDistribution(parameters = c('V','Cl','ka','Tlag'),
                             settings = list(ncol=2,
                                             units=F,
                                             legend=T,
                                             grid=F,
                                             fontsize=9))

Same 2 by 2 grid of density histograms for V, Cl, ka and Tlag from plotCAParametersDistribution, with units removed from axis labels, no grid, smaller fonts and a legend at the bottom showing a blue square labeled Empirical distribution.
R

#> TableGrob (2 x 1) "arrange": 2 grobs
#>   z     cells    name              grob
#> 1 1 (1-1,1-1) arrange   gtable[arrange]
#> 2 2 (2-2,1-1) arrange gtable[guide-box]

# changing the preferences (appearance of the elements) when using plot="cdf"
plotCAParametersDistribution(parameters = c('V','Cl','ka','Tlag'),
                             settings = list(ncol=2, legend=T, plot="cdf"),
                             preferences = list(empirical=list(color="#161617",
                                                               lineWidth=1,
                                                               lineType="solid",
                                                               legend="cumulative density distribution")))

plotCAParametersDistribution with plot set to cdf and custom preferences, a 2 by 2 grid of thick black empirical cumulative curves of probability versus V in L, Cl in L per h, ka in per h and Tlag in h. The bottom legend reads cumulative density distribution. The Tlag curve shows two steep steps near 1 and 1.9 h.
R

#> TableGrob (2 x 1) "arrange": 2 grobs
#>   z     cells    name              grob
#> 1 1 (1-1,1-1) arrange   gtable[arrange]
#> 2 2 (2-2,1-1) arrange gtable[guide-box]

# changing the preferences (appearance of the elements) when using plot="pdf"
plotCAParametersDistribution(parameters = c('V','Cl','ka','Tlag'),
                             settings = list(ncol=2, legend=T, plot="pdf"),
                             preferences = list(histogramBar=list(fill="#cdced1",
                                                                  opacity=0.7,
                                                                  stroke="#161617",
                                                                  strokeWidth=1,
                                                                  legend="probability density distribution")))

plotCAParametersDistribution with plot set to pdf and custom histogram preferences, a 2 by 2 grid of density histograms for V, Cl, ka and Tlag drawn with light grey fill and thick black outlines. The bottom legend reads probability density distribution.
R

#> TableGrob (2 x 1) "arrange": 2 grobs
#>   z     cells    name              grob
#> 1 1 (1-1,1-1) arrange   gtable[arrange]
#> 2 2 (2-2,1-1) arrange gtable[guide-box]

# split each plot into two subplots for FORM=ref and FORM=test
plotCAParametersDistribution(parameters = c('V','Cl','ka','Tlag'),
                             settings = list(ncol=2),
                             stratify = list(split=c("FORM")))

plotCAParametersDistribution split by FORM, with each of the four parameters V, Cl, ka and Tlag shown as a pair of density histograms labeled FORM ref and FORM test. The pairs let the reader compare formulations, for example V spans about 23 to 45 L for ref but about 2 to 68 L for test.
R

#> TableGrob (1 x 1) "arrange": 1 grobs
#>   z     cells    name            grob
#> 1 1 (1-1,1-1) arrange gtable[arrange]

# define groups for AGE and HT, filter by AGE and split by HT
plotCAParametersDistribution(parameters = c('V','Cl','ka','Tlag'),
                             settings=list(ncol=2),
                             stratify = list(groups=list(list(name="AGE", definition=c(30, 35)),
                                                         list(name="HT", definition=c(184.5))),
                                             filter=list("AGE",c(1,3)),
                                             split="HT"))

plotCAParametersDistribution with AGE filtered to groups 1 and 3 and split by HT groups, showing pairs of density histograms labeled HT 176-184.5 and HT 184.5-191 for V, Cl, ka and Tlag. The HT 184.5-191 histograms are coarser, with only 2 to 3 bins each.
R

#> TableGrob (1 x 1) "arrange": 1 grobs
#>   z     cells    name            grob
#> 1 1 (1-1,1-1) arrange gtable[arrange]

# filter to keep only second sequence (TR) and Period=1
plotCAParametersDistribution(parameters = c('V','Cl','ka','Tlag'),
                             settings=list(ncol=2),
                             stratify = list(filter=list(list("SEQ",2),list("Period","1"))))

plotCAParametersDistribution filtered to the second sequence TR and Period 1, a 2 by 2 grid of blue density histograms for V in L, Cl in L per h, ka in per h and Tlag in h. With few individuals left, each histogram has only 2 or 3 bins, and most ka values lie below about 0.14 per h.
R

#> TableGrob (1 x 1) "arrange": 1 grobs
#>   z     cells    name            grob
#> 1 1 (1-1,1-1) arrange gtable[arrange]


Last updated: