MonolixSuite in R
Auto Light Dark
Auto Light Dark

plotCAParametersCorrelation

[PKanalix] Correlation between CA individual parameters.

Plot the correlation bewteen CA individual parameters.

Usage

R
plotCAParametersCorrelation(
  parametersRows = NULL,
  parametersColumns = NULL,
  settings = list(),
  preferences = list(),
  stratify = list()
)

Arguments

parametersRows

(vector) vector with the name of CA parameters to display on rows (by default the first 4 computed parameters are displayed).

parametersColumns

(vector) vector with the name of CA parameters to display on columns (by default parametersColumns = parametersRows).

settings

List with the following settings:

  • regressionLine (logical) If TRUE, regression line is displayed (default TRUE).

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

  • 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 when using split (default 4).

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

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

preferences

(optional) preferences for plot display, run getPlotPreferences("plotCAParametersCorrelation") to check available displays.

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.

  • color (vector) - Vector of covariates used for coloring (by default no coloring is applied). Coloring applies to dots of plots w.r.t continuous covariates, but not on histograms or boxplots. For instance c("FORM","AGE").

  • colors - Vector of colors to use when color argument is used. Takes precedence over colors defined in preferences. For instance c("#ebecf0","#cdced1","#97989c").

Value

  • A ggplot object if one element in parametersRows and parametersColumns,

  • 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()
  
# by default only the 4 first CA parameters are shown
plotCAParametersCorrelation()

plotCAParametersCorrelation default output, a 4 by 4 scatter plot matrix of the CA parameters Tlag, ka, V and Cl, with parameter names on the grey diagonal cells. Each off-diagonal cell plots one parameter against another, with blue dots for individual values and a magenta linear regression line. The clearest trend is a positive correlation between ka and V.
R

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

# choosing to display only a subset of possible covariates and CA parameters (same param on rows and columns)
plotCAParametersCorrelation(parametersRows = c("Cl","V"))

plotCAParametersCorrelation with parametersRows Cl and V, giving a 2 by 2 matrix with Cl and V on the grey diagonal. The off-diagonal cells show V in L versus Cl in L per h and Cl versus V, with blue dots and a nearly flat magenta regression line, indicating little correlation between Cl and V.
R

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

# selecting different parameters on rows and columns
plotCAParametersCorrelation(parametersRows = c("Cl","V"),
                            parametersColumns = c("Tlag","ka"))

plotCAParametersCorrelation with Cl and V on rows and Tlag and ka on columns, a 2 by 2 grid of scatter plots with magenta regression lines. Cl versus Tlag, Cl versus ka and V versus Tlag show nearly flat lines, while V in L increases with ka in per h, from about 20 to 57 L across the ka range.
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
plotCAParametersCorrelation(settings = list(regressionLine=F,
                                            spline=T,
                                            legend=T,
                                            grid=F,
                                            units=F,
                                            fontsize=8))

plotCAParametersCorrelation with regression lines off and splines on, a 4 by 4 matrix for Tlag, ka, V and Cl without units or grid and with smaller fonts. Blue dots are individual parameters and orange curves are spline fits, listed in the bottom legend as Individual parameters and Spline. The spline shows ka rising with V.
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)
plotCAParametersCorrelation(parametersRows = c("Cl","V"),
                            settings=list(legend=T, spline=T),
                            preferences = list(obs=list(color="#202120",
                                                        radius=2,
                                                        shape=18,
                                                        legend="CA parameter values"),
                                               regressionLine=list(color="#202120",
                                                                   lineWidth=1,
                                                                   lineType="dashed",
                                                                   legend="Linear regression line"),
                                               spline=list(color="#97989c",
                                                           lineWidth=1,
                                                           lineType="solid",
                                                           legend="Spline regression line")))

plotCAParametersCorrelation for Cl and V with custom preferences, a 2 by 2 matrix where black diamonds are CA parameter values, a black dashed line is the Linear regression line and a grey solid curve is the Spline regression line, as shown in the bottom legend. The linear line is nearly flat while the spline bends, driven by a few extreme points.
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 subplot for FORM=ref and FORM=test, vertically (ncol=1)
plotCAParametersCorrelation(parametersRows = c("ka","Cl","V"),
                            settings=list(ncol=1),
                            stratify = list(split=c("FORM")))

plotCAParametersCorrelation for ka, Cl and V split by FORM with ncol 1, a 3 by 3 matrix where each off-diagonal cell holds two stacked scatter plots labeled FORM ref and FORM test. Blue dots and magenta regression lines let the reader compare correlations between formulations, for example V versus ka is steeper for FORM 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, color by HT and filter by AGE
plotCAParametersCorrelation(settings=list(legend=T),
                            parametersRows = c("Cl","V"),
                            stratify = list(groups=list(list(name="AGE", definition=c(30, 35)),
                                                        list(name="HT", definition=c(184.5))),
                                            color="HT",
                                            colors=c("#cdced1","#161617"),
                                            filter=list("AGE",c(1,3))))

plotCAParametersCorrelation for Cl and V with AGE filtered to groups 1 and 3 and points colored by HT group, a 2 by 2 matrix. Light grey dots are HT 176-184.5 and black dots are HT 184.5-191, as shown in the legend titled Individual parameters, with a nearly flat magenta regression line in both scatter cells.
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]

# filter to keep only second sequence (TR) and FORM=test
plotCAParametersCorrelation(settings=list(legend=T),
                            parametersRows = c("Cl","V"),
                            stratify = list(filter=list(list("SEQ",2),list("FORM","test"))))

plotCAParametersCorrelation for Cl and V filtered to the second sequence TR and FORM test, a 2 by 2 matrix with only about 9 individuals. Blue dots are individual parameters and the magenta regression line decreases, with V falling from about 33 to 17 L as Cl increases from about 2.6 to 11.6 L per 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]


Last updated: