MonolixSuite in R
Auto Light Dark
Auto Light Dark

plotParametersVsCovariates

[Monolix] Individual monolix parameter vs covariate plot.

Plot individual parameters vs covariates.

Usage

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

Arguments

parameters

vector of parameters to display. (by default the first 4 computed parameters are displayed).

covariates

vector of covariates to display. (by default the first 4 computed covariates are displayed).

settings

List with the following settings

  • indivEstimate Calculation of individual estimates: conditional mean ("mean"), conditional mode with EBE's ("mode"), conditional distribution ("simulated") (default "simulated").

  • parameterType (character) display random effect vs covariates ("randomEffect"), or transformed individual parameters vs covariates ("indivParameter") (default "indivParameter").

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

  • regressionLine (logical) If TRUE, Add regression line in scatterplots (default TRUE).

  • spline (logical) If TRUE, Add xpline in scatterplots (default FALSE).

  • legend (logical) add (TRUE) / remove (FALSE) plot legend (default FALSE).

  • grid (logical) add (TRUE) / remove (FALSE) plot grid (default TRUE).

  • ncol (integer) number of columns when facet = TRUE (default 4).

  • fontsize (integer) Plot text font size.

preferences

(optional) preferences for plot display, run getPlotPreferences("plotParametersVsCovariates") 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). 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 covariate and one parameter in argument,

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

See also

getChartsData getPlotPreferences

Examples

R
  initializeLixoftConnectors(software="monolix")
  project <- file.path(getDemoPath(), "1.creating_and_using_models",
                       "1.1.libraries_of_models", "theophylline_project.mlxtran")
  loadProject(project)

  runPopulationParameterEstimation()
  runConditionalDistributionSampling()
  
  # Individual parameters
  plotParametersVsCovariates(covariates = "SEX", parameters = "Cl")

Box plot from plotParametersVsCovariates of individual log Cl by SEX. The female, F, median is about minus 3.1 and the male, M, median about minus 3.25. Three male outliers near minus 3.85 to minus 3.9 are marked as red crosses.
R

  plotParametersVsCovariates(covariates = "WEIGHT", parameters = "V", settings = list(spline = T))

Scatter plot from plotParametersVsCovariates of individual log V versus WEIGHT, about 55 to 87, with the spline setting on. A magenta regression line decreases from about minus 0.68 to minus 0.88, and an orange spline follows the local means, zigzagging around it.
R

  plotParametersVsCovariates(covariates = "WEIGHT", parameters = "V",
                             settings = list(indivEstimate = "simulated"))

Scatter plot from plotParametersVsCovariates of log V versus WEIGHT using simulated individual parameters. Several points per weight value scatter between about minus 1.1 and minus 0.5, and a magenta regression line decreases with weight, from about minus 0.68 to minus 0.88.
R

                  
  # Random effects
  plotParametersVsCovariates(covariates = "SEX", parameters = "V",
                             settings = list(parameterType = "randomEffect"))

Box plot from plotParametersVsCovariates of the random effect eta V by SEX. The female median is about 0.09 and the male median about 0, so females tend to have larger V random effects. Whiskers span about minus 0.33 to 0.27.
R

  plotParametersVsCovariates(covariates = "WEIGHT", parameters = "V",
                             settings = list(indivEstimate = "simulated", parameterType = "randomEffect"))

Scatter plot from plotParametersVsCovariates of simulated random effects eta V versus WEIGHT. Values range from about minus 0.34 to 0.27, and a magenta regression line decreases from about 0.1 at the lowest weight to about minus 0.1 at the highest.
R

  
  # Stratification
  plotParametersVsCovariates(covariates = "SEX", parameters = "ka",
                             stratify = list(filter = list("WEIGHT", 1),
                                             groups = list(name = "WEIGHT", definition = 75)))

Box plot from plotParametersVsCovariates of log ka by SEX, filtered to the first WEIGHT group, below 75. The female median is about minus 0.06 and the male median about 0.5, with one female outlier near 1.57 shown as a red cross.
R

  plotParametersVsCovariates(covariates = "WEIGHT", parameters = "ka",
                             stratify = list(split = "SEX"))

Two panel scatter plot from plotParametersVsCovariates of log ka versus WEIGHT, split by SEX into panels SEX F and SEX M. Females weigh about 55 to 66 and males about 70 to 86. Magenta regression lines rise slightly for females and more steeply for males, from about 0.35 to 1.2.
R

  plotParametersVsCovariates(covariates = "SEX", parameters = "Cl",
                             stratify = list(color = "WEIGHT",
                                             groups = list(name = "WEIGHT", definition = 75)))

Box plot from plotParametersVsCovariates of log Cl by SEX with color set by WEIGHT group, cut at 75. It looks the same as the uncolored version, with medians of about minus 3.1 for F and minus 3.25 for M and red outlier crosses for males.
R

  plotParametersVsCovariates(covariates = "WEIGHT", parameters = "V",
                             stratify = list(color = "SEX"))

Scatter plot from plotParametersVsCovariates of log V versus WEIGHT, colored by SEX. Blue points at weights below about 66 and dark grey points above 70 show the two sexes, females being lighter, but no legend is shown. A magenta regression line decreases from about minus 0.68 to minus 0.88.
R

  plotParametersVsCovariates(covariates = "WEIGHT", parameters = "V",
                             stratify = list(color = c("SEX", "WEIGHT"),
                                             groups = list(name = "WEIGHT", definition = 70)))

Scatter plot from plotParametersVsCovariates of log V versus WEIGHT, colored by combinations of SEX and WEIGHT group cut at 70. Gold points cover weights below about 66 and purple points weights above 70, so only two color groups appear. A magenta regression line decreases with weight.
R


  # multiple plots
  plotParametersVsCovariates()

Grid of six plots from plotParametersVsCovariates with default arguments. Rows show log ka, log V and log Cl. The left column plots each parameter versus WEIGHT with a magenta regression line, rising for ka and falling for V and Cl. The right column shows box plots by SEX, with higher ka in males and higher V and Cl in females.
R

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

Three scatter plots from plotParametersVsCovariates with covariates set to WEIGHT, showing log ka, log V and log Cl versus WEIGHT, about 55 to 87. Magenta regression lines rise for log ka, from about minus 0.1 to 1.05, and fall for log V and log Cl.
R

#> TableGrob (1 x 1) "arrange": 1 grobs
#>   z     cells    name            grob
#> 1 1 (1-1,1-1) arrange gtable[arrange]
  plotParametersVsCovariates(settings = list(indivEstimate = "simulated"))

Grid of six plots from plotParametersVsCovariates with simulated individual estimates. Log ka, log V and log Cl are plotted versus WEIGHT with magenta regression lines and as box plots by SEX, with ka higher in males and V and Cl higher in females, matching the default example.
R

#> TableGrob (1 x 1) "arrange": 1 grobs
#>   z     cells    name            grob
#> 1 1 (1-1,1-1) arrange gtable[arrange]
  plotParametersVsCovariates(settings = list(parameterType = "randomEffect"))

Output of plotParametersVsCovariates with parameterType randomEffect. Six panels show random effects eta_ka, eta_V and eta_Cl in rows versus WEIGHT, scatter plots with a regression line, and SEX, boxplots for F and M. eta_ka increases with weight and is higher for M, while eta_V and eta_Cl decrease slightly with weight and are slightly lower for M. Red crosses mark outliers.
R

#> TableGrob (1 x 1) "arrange": 1 grobs
#>   z     cells    name            grob
#> 1 1 (1-1,1-1) arrange gtable[arrange]
  plotParametersVsCovariates(settings = list(parameterType = "randomEffect", indivEstimate = "simulated"))

Output of plotParametersVsCovariates with parameterType randomEffect and indivEstimate simulated. Same six panels as the previous plot, eta_ka, eta_V and eta_Cl versus WEIGHT as scatter plots with regression lines and versus SEX as boxplots. The plot looks identical to the previous one, since simulated is the default individual estimate.
R

#> TableGrob (1 x 1) "arrange": 1 grobs
#>   z     cells    name            grob
#> 1 1 (1-1,1-1) arrange gtable[arrange]
  plotParametersVsCovariates(stratify = list(color = "WEIGHT",
                                             groups = list(name="WEIGHT", definition = 75)))

Output of plotParametersVsCovariates colored by WEIGHT groups split at 75. Six panels show log ka, log V and log Cl versus WEIGHT, scatter plots with regression lines, and versus SEX, boxplots for F and M. In the scatter plots, individuals with WEIGHT below 75 are green and those above 75 are pink. log ka rises with weight, log V and log Cl decrease slightly.
R

#> TableGrob (1 x 1) "arrange": 1 grobs
#>   z     cells    name            grob
#> 1 1 (1-1,1-1) arrange gtable[arrange]
  plotParametersVsCovariates(stratify = list(color = "SEX"))

Output of plotParametersVsCovariates colored by SEX. Six panels show log ka, log V and log Cl versus WEIGHT, scatter plots with regression lines, and versus SEX, boxplots for F and M. Scatter points are colored blue or dark gray by sex, with blue points mostly at lower weights. Boxplots show higher log ka and slightly lower log V and log Cl for M.
R

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


Last updated: