MonolixSuite in R
Auto Light Dark
Auto Light Dark

plotStandardizedRandomEffectsDistribution

[Monolix] Distribution of the standardized random effects.

Plot the distribution of the standardized random effects.

Usage

R
plotStandardizedRandomEffectsDistribution(
  parameters = NULL,
  plot = "boxplot",
  settings = list(),
  preferences = list(),
  stratify = list()
)

Arguments

parameters

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

plot

Type of plot: probability density distribution ("pdf"), cumulative density distribution ("cdf"), boxplot ("boxplot") (default "boxplot").

settings

a list of optional plot settings:

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

  • variabilityLevel (logical) In case of IOV and if the conditional distribution is computedplot 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

  • empirical (logical) If TRUE, plot empirical density distribution(default TRUE). To define when plot is "pdf" or "cdf"

  • theoretical (logical) If TRUE, plot theoretical density distribution(default TRUE). To define when plot is "pdf" or "cdf"

  • median (logical) If TRUE, add median line (default TRUE). To define when plot is "boxplot"

  • quartile (logical) If TRUE, add quartile line (default TRUE). To define when plot is "boxplot"

  • 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("plotStandardizedRandomEffectsDistribution") 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.

Value

  • A ggplot object if one parameter,

  • 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()
  runConditionalModeEstimation()
  
  # Random effect distribution as boxplot
  plotStandardizedRandomEffectsDistribution(parameters = "ka", plot = "boxplot")

Output of plotStandardizedRandomEffectsDistribution for ka as a boxplot. Single box of standardized random effects for eta_ka, with median near 0, box from about minus 0.7 to 0.55 and whiskers from about minus 1.9 to 2.4. One red cross marks an outlier near 2.5. A solid line at 0 and dashed lines at about plus and minus 0.67 show the theoretical median and quartiles.
R

  plotStandardizedRandomEffectsDistribution(parameters = "ka", plot = "boxplot",
                                            settings = list(indivEstimate = "mode"))

Output of plotStandardizedRandomEffectsDistribution for ka as a boxplot with indivEstimate mode. Boxplot of standardized random effects for eta_ka using conditional modes, median about minus 0.2, box from about minus 0.6 to 0.4, whiskers from about minus 1.3 to 1.1, and one outlier near 2.1. Solid line at 0 and dashed theoretical quartile lines at about plus and minus 0.67.
R

  plotStandardizedRandomEffectsDistribution(parameters = "ka", plot = "boxplot",
                                            settings = list(quartile = F))

Output of plotStandardizedRandomEffectsDistribution for ka as a boxplot with quartile set to false. Same boxplot of standardized random effects for eta_ka as the default, median near 0 and one outlier near 2.5, but without the dashed theoretical quartile lines. Only the solid reference line at 0 remains.
R

  
  # Random effect distribution as pdf
  plotStandardizedRandomEffectsDistribution(parameters = "ka", plot = "pdf")

Output of plotStandardizedRandomEffectsDistribution for ka with plot pdf. Histogram of standardized random effects eta_ka, density on the y axis, overlaid with the black theoretical standard normal density curve peaking at about 0.4 at 0. The histogram spans about minus 1.9 to 2.5 and shows a small secondary group of values near 2.
R

  plotStandardizedRandomEffectsDistribution(parameters = "ka", plot = "pdf",
                                            settings = list(empirical = F))

Output of plotStandardizedRandomEffectsDistribution for ka with plot pdf and empirical set to false. Only the black theoretical standard normal density curve is shown for eta_ka, peaking at about 0.4 at 0, over the range minus 4 to 4. The empirical histogram is hidden.
R

  plotStandardizedRandomEffectsDistribution(parameters = "ka", plot = "pdf",
                                            settings = list(theoretical = F))

Output of plotStandardizedRandomEffectsDistribution for ka with plot pdf and theoretical set to false. Only the empirical histogram of eta_ka is shown, density on the y axis, spanning about minus 1.9 to 2.5 with the highest bars near 0.48 around minus 1 and 0, and a small group near 2. No theoretical curve.
R

  
  # Random effect distribution as cdf
  plotStandardizedRandomEffectsDistribution(parameters = "ka", plot = "cdf")

Output of plotStandardizedRandomEffectsDistribution for ka with plot cdf. Cumulative distribution of eta_ka, probability from 0 to 1 versus eta_ka from minus 4 to 4. The blue empirical step-like curve closely follows the black theoretical standard normal cdf, with small deviations around 1 to 2.5.
R

  plotStandardizedRandomEffectsDistribution(parameters = "ka", plot = "cdf",
                                            settings = list(indivEstimate = "simulated"))

Output of plotStandardizedRandomEffectsDistribution for ka with plot cdf and indivEstimate simulated. Blue empirical cumulative distribution of eta_ka versus the black theoretical standard normal cdf, probability 0 to 1 over minus 4 to 4. The plot looks identical to the default cdf plot.
R

  plotStandardizedRandomEffectsDistribution(parameters = "ka", plot = "cdf",
                                            settings = list(theoretical = F))

Output of plotStandardizedRandomEffectsDistribution for ka with plot cdf and theoretical set to false. Only the blue empirical cumulative distribution of eta_ka is shown, rising from 0 near minus 1.9 to 1 near 2.5, with probability on the y axis. No theoretical curve.
R

  
  # stratification
  plotStandardizedRandomEffectsDistribution(stratify = list(filter = list("WEIGHT", 1),
                                                            groups = list(name = "WEIGHT", definition = 75)))

Output of plotStandardizedRandomEffectsDistribution filtered to the first WEIGHT group, split at 75. Boxplots of standardized random effects for eta_ka, eta_V and eta_Cl for these individuals only. Medians are about minus 0.2 for ka, 0.45 for V and 0.3 for Cl. Solid line at 0 and dashed theoretical quartile lines at about plus and minus 0.67.
R

  plotStandardizedRandomEffectsDistribution(parameters = "Cl",
                                            stratify = list(split = "SEX"))

Output of plotStandardizedRandomEffectsDistribution for Cl split by SEX. Two boxplot panels, SEX F and SEX M, of standardized random effects eta_Cl. Females have a median of about 0.4, males about minus 0.1, with several red outliers near minus 2.4 to minus 2.7 for M. Dashed lines show theoretical quartiles.
R

  
  plotStandardizedRandomEffectsDistribution(parameters = c("ka", "Cl"))

Output of plotStandardizedRandomEffectsDistribution for ka and Cl. Two boxplots of standardized random effects, eta_ka with median near 0 and one outlier near 2.5, and eta_Cl with median about 0.2 and several outliers between about minus 2.3 and minus 2.7. Solid line at 0 and dashed theoretical quartile lines at about plus and minus 0.67.
R

  plotStandardizedRandomEffectsDistribution(plot = "boxplot")

Output of plotStandardizedRandomEffectsDistribution with plot boxplot for all parameters. Three boxplots of standardized random effects for eta_ka, eta_V and eta_Cl, with medians near 0, 0.25 and 0.2. Red crosses mark an outlier near 2.5 for ka and several near minus 2.5 for Cl. Dashed lines at about plus and minus 0.67 show theoretical quartiles.
R

  plotStandardizedRandomEffectsDistribution(plot = "pdf")

Output of plotStandardizedRandomEffectsDistribution with plot pdf for all parameters. Three panels show histograms of eta_ka, eta_V and eta_Cl with density on the y axis, each overlaid with the black theoretical standard normal density curve peaking at about 0.4. The histograms roughly follow the curves, with some irregular bars in the tails.
R

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

Output of plotStandardizedRandomEffectsDistribution with plot cdf for all parameters. Three panels show blue empirical cumulative distributions of eta_ka, eta_V and eta_Cl, probability 0 to 1 versus values from minus 4 to 4, each with the black theoretical standard normal cdf. The empirical curves follow the theoretical ones closely.
R

#> TableGrob (1 x 1) "arrange": 1 grobs
#>   z     cells    name            grob
#> 1 1 (1-1,1-1) arrange gtable[arrange]
  plotStandardizedRandomEffectsDistribution(plot = "pdf", settings = list(theoretical = F))

Output of plotStandardizedRandomEffectsDistribution with plot pdf and theoretical set to false. Three panels show only the empirical histograms of eta_ka, eta_V and eta_Cl with density on the y axis, without theoretical curves. eta_ka is centered near minus 0.5 to 0, eta_V and eta_Cl peak slightly above 0.
R

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



Last updated: