MonolixSuite in R
Auto Light Dark
Auto Light Dark

plotRandomEffectsCorrelation

[Monolix] Correlations between random effect.

Plot correlations between random effects.

Usage

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

Arguments

parametersRows

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

parametersColumns

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

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

  • variabilityLevel (character) In case of IOV and if the conditional distribution is computed plot is displayed for one given level of variability (default NULL) If NULL, the variability level is ID + Occasions Run getVariabilityLevels() to see the available levels of variability

  • decorrelated (logical) If TRUE, plot the decorrelated random effects instead of the random effects (default FALSE). Decorrelated random effects are available only if the model contains correlations terms between the random effects.

  • 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("plotRandomEffectsCorrelation") 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 element in parametersRows and parametersColumns,

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

Default plotRandomEffectsCorrelation output, a 3 by 3 matrix of random effects eta_ka, eta_V and eta_Cl. Diagonal cells show parameter names, and off-diagonal cells show scatter plots of pairs with magenta regression lines. eta_V and eta_Cl show a clear positive correlation, while eta_ka is nearly uncorrelated with the others.
R

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

Scatter plot from plotRandomEffectsCorrelation of eta_ka versus eta_V using simulated individual estimates. eta_V ranges about -0.33 to 0.27 and eta_ka about -1.2 to 1.7. The many points show a weak negative trend, with a slightly decreasing magenta regression line.
R

  plotRandomEffectsCorrelation(parametersRows = "ka", parametersColumns = "V",
                               settings = list(spline = TRUE))    

Scatter plot of eta_ka versus eta_V, the same as the previous plot, with an orange spline curve added through settings spline TRUE, together with the magenta regression line. The spline dips slightly below zero in the middle and rises at both ends of the eta_V range.
R

  plotRandomEffectsCorrelation(settings = list(indivEstimate = "mean"))

plotRandomEffectsCorrelation output with indivEstimate mean, a 3 by 3 matrix of eta_ka, eta_V and eta_Cl with one point per individual, about 12 points per panel. Off-diagonal scatter plots have magenta regression lines. eta_V and eta_Cl are strongly positively correlated, while eta_ka shows a slight negative trend.
R

#> TableGrob (1 x 1) "arrange": 1 grobs
#>   z     cells    name            grob
#> 1 1 (1-1,1-1) arrange gtable[arrange]
  plotRandomEffectsCorrelation(parametersRows = c("ka", "V"))

Matrix of random effects correlation plots from plotRandomEffectsCorrelation with parametersRows ka and V. Grey diagonal panels label eta ka and eta V, and the two off-diagonal scatterplots show eta V versus eta ka and the reverse, with blue points and a magenta regression line that has a weak negative slope.
R

#> TableGrob (1 x 1) "arrange": 1 grobs
#>   z     cells    name            grob
#> 1 1 (1-1,1-1) arrange gtable[arrange]
  
  # stratification
  plotRandomEffectsCorrelation(parametersRows = "ka", parametersColumns = "V",
                               stratify = list(filter = list("SEX", "M")))

Scatterplot of eta ka versus eta V for the individuals filtered to SEX M only. Blue points with a magenta regression line that decreases clearly from about 0.8 at eta V of -0.33 to about -0.15 at eta V of 0.16, indicating a negative correlation in this subgroup.
R

  plotRandomEffectsCorrelation(parametersRows = "ka", parametersColumns = "V",
                               stratify = list(color = "WEIGHT",
                                               groups = list(name = "WEIGHT", definition = 75),
                                               colors = c("#46B4AF", "#B4468A")))

Scatterplot of eta ka versus eta V for all individuals, points colored by WEIGHT group split at 75, teal for the lower weight group and magenta for the higher weight group. The magenta points cluster at negative eta V, many with high eta ka. The magenta regression line over all points has a weak negative slope.
R

  plotRandomEffectsCorrelation(parametersRows = "ka", parametersColumns = "V",
                               stratify = list(split = "SEX"))

Two scatterplots of eta ka versus eta V split by SEX, panels SEX F and SEX M. The regression line rises steeply in the SEX F panel, from about -1.0 to 0.3, but decreases in the SEX M panel, from about 0.8 to -0.15, showing opposite correlations in the two subgroups.
R

                               
  plotRandomEffectsCorrelation(parametersRows = "ka", parametersColumns = "V",
                               stratify = list(split = c("SEX", "WEIGHT"),
                                               groups = list(name = "WEIGHT", definition = 70)))

Scatterplots of eta ka versus eta V split by SEX and by WEIGHT with a cut at 70. Only two panels appear, SEX F with WEIGHT 54.6 to 70 and SEX M with WEIGHT 70 to 86.4, because all females are below and all males above 70 kg. Regression lines are increasing for females and decreasing for males.
R

Last updated: