Skip to main content
Skip table of contents

plotCAParametersVsCovariates

Plot the CA individual parameters vs covariates.

Usage

R
plotCAParametersVsCovariates(
  parameters = NULL,
  covariates = NULL,
  settings = list(),
  preferences = list(),
  stratify = list()
)

Arguments

parameters

(vector) vector of ca parameters to display, e.g c("V", "Cl") (by default the first 4 computed ca parameters are displayed).

covariates

(vector) vector of covariates to display, e.g c("AGE", "FORM") (by default the first 4 covariates are displayed).

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).

  • boxplotData (character) for categorical covariate, if boxplotData is not NULL, NCA parameter values are added as dots on top of the boxplot. They can be either "spread" over the width of the box or "aligned" (default NULL)

  • 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("plotCAParametersVsCovariates") 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:

    namecharactercovariate name (e.g "AGE")
    definitionvector(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 parameters and covariates have only one element

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

Examples

R
  initializeLixoftConnectors(software="pkanalix")
  project <- file.path(getDemoPath(), "/2.case_studies/project_Theo_extravasc_SD.pkx")
  loadProject(project)
  runCAEstimation()
  
# choosing to display only a subset of possible covariates and CA parameters
plotCAParametersVsCovariates(parameters = c("Cl","V"),
                             covariates = c("WT","FORM"))
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
plotCAParametersVsCovariates(settings = list(regressionLine=F,
                                             spline=T,
                                             boxplotData="spread",
                                             legend=T,
                                             grid=F,
                                             units=F,
                                             fontsize=8))
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)
plotCAParametersVsCovariates(parameters = c("Cl","V"),
                             covariates = c("WT","FORM"),
                             settings=list(legend=T, spline=T, boxplotData="spread"),
                             preferences = list(boxplot=list(fill="#FBFBFB",
                                                             opacity=0.5,
                                                             legend=""),
                                                boxplotOutlier=list(color="#D71313",
                                                                    size=1.5,
                                                                    shape=2),
                                                boxplotValues=list(color="#1642f2",
                                                                   radius=1.5,
                                                                   shape=17,
                                                                   opacity=0.3,
                                                                   legend="NCA parameter values"),
                                                obs=list(color="#1642f2",
                                                         radius=2,
                                                         shape=17,
                                                         legend="NCA 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")))
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)
plotCAParametersVsCovariates(parameters = c("Cl","V"),
                             covariates = c("WT","AGE"),
                             settings=list(ncol=1),
                             stratify = list(split=c("FORM")))
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
plotCAParametersVsCovariates(settings=list(legend=T),
                             parameters = c("Cl","V"),
                             covariates = c("WT","FORM"),
                             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))))
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
plotCAParametersVsCovariates(settings=list(legend=T),
                             parameters = c("Cl","V"),
                             covariates = c("WT","FORM"),
                             stratify = list(filter=list(list("SEQ",2),list("FORM","test"))))
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]
  
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.