MonolixSuite in R
Auto Light Dark
Auto Light Dark

plotNCAParametersVsCovariates

[PKanalix] Individual NCA parameter vs covariate plot.

Plot the NCA individual parameters vs covariates.

Usage

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

Arguments

parameters

(vector) vector of nca parameters to display, e.g c("Cmax", "AUCINF_obs") (by default the first 4 computed nca 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("plotNCAParametersVsCovariates") 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.

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

See also

getChartsData getPlotPreferences

Examples

R
  initializeLixoftConnectors(software = "pkanalix")
  project <- file.path(getDemoPath(), "/2.case_studies/project_Theo_extravasc_SD.pkx")
  loadProject(project)
  runNCAEstimation()

# choosing to display only a subset of possible covariates and NCA parameters  
plotNCAParametersVsCovariates(parameters = c("Cmax","Lambda_z"),
                              covariates = c("WT","FORM"))

Output of plotNCAParametersVsCovariates for Cmax and kel versus the covariates WT and FORM. A 2 by 2 grid shows scatter plots versus WT with a pink regression line and boxplots for FORM ref and test, with red crosses marking outliers. Cmax decreases with WT and is higher for ref than for test, while kel shows almost no trend with WT.
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
plotNCAParametersVsCovariates(settings = list(regressionLine=F,
                                              spline=T,
                                              boxplotData="aligned",
                                              legend=T,
                                              grid=F,
                                              units=F,
                                              fontsize=8))

Output of plotNCAParametersVsCovariates with regressionLine off, spline on, boxplotData aligned, legend on, grid off and units off. A 4 by 4 grid shows AUC0-inf, percent extrapolated AUC, AUC0-tlast and CL per F versus AGE, HT and WT as scatter plots with orange splines, and versus FORM as boxplots with the data points aligned on each box.
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)
plotNCAParametersVsCovariates(parameters = c("Cmax","Lambda_z"),
                              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")))

Output of plotNCAParametersVsCovariates for Cmax and kel versus WT and FORM with custom preferences. Scatter plots use blue triangles with a black dashed linear regression line and a gray spline. FORM boxplots have a nearly white fill with semi-transparent blue triangles spread over each box and red open triangles for outliers. The legend lists NCA parameter values and both lines.
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)
plotNCAParametersVsCovariates(parameters = c("Cmax","Lambda_z","AUCINF_obs"),
                              covariates = c("WT","AGE"),
                              settings=list(ncol=1),
                              stratify = list(split=c("FORM")))                                                             

Output of plotNCAParametersVsCovariates for Cmax, kel and AUC0-inf versus WT and AGE, split by FORM with ncol equals 1. Each of the 6 cells contains two stacked scatter plots, one for FORM ref and one for FORM test, each with a pink regression line. The panels are very compressed, so the y axis tick labels overlap.
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
plotNCAParametersVsCovariates(settings=list(legend=T),
                              parameters = c("Cmax","Lambda_z"),
                              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))))

Output of plotNCAParametersVsCovariates for Cmax and kel versus WT and FORM, with groups defined on AGE and HT, colored by HT and filtered by AGE. Scatter plots versus WT show pink regression lines that decrease with WT. Points are light gray for HT 176 to 184.5 and black for HT 184.5 to 191. Boxplots compare FORM ref and test, with red crosses marking outliers.
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
plotNCAParametersVsCovariates(settings=list(legend=T),
                              parameters = c("Cmax","Lambda_z"),
                              covariates = c("WT","FORM"),
                              stratify = list(filter=list(list("SEQ",2),list("FORM","test"))))

Output of plotNCAParametersVsCovariates for Cmax and kel versus WT and FORM, filtered to keep only sequence 2 and FORM equals test. Scatter plots of about 9 individuals versus WT have slightly decreasing pink regression lines, and the FORM panels show a single boxplot for test. The legend lists Individual parameters and 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]
                                              

Last updated: