plot_ranefDiagnostics: Plots for random effects diagnostics

View source: R/plot_ranefDiagnostics.R

plot_ranefDiagnosticsR Documentation

Plots for random effects diagnostics

Description

Visualization of random effects diagnostics for a fitted linear mixed model of tumor growth data.

Usage

plot_ranefDiagnostics(model)

Arguments

model

An object of class "lme" representing the linear mixed-effects model fitted by lmmModel().

Value

A list with different plots for evaluating the normality and homoscedasticity of the random effects, including:

  • A normal Q-Q plot of the random effects of the model.

  • A normal Q-Q plot of the residuals by sample.

  • Boxplots of the "raw" residuals (observed - fitted) by sample.

  • Scatter plots of the normalized residuals (standardized residuals pre-multiplied by the inverse square-root factor of the estimated error correlation matrix, see nlme::residuals.lme) vs fitted values by sample. Observations with absolute standardized (normalized) residuals greater than the 1-0.05/2 quantile of the standard normal distribution are identified in the plots labelled with the time point corresponding to the observation.

Examples

data(grwth_data)
# Fit the model
lmm <- lmmModel(
  data = grwth_data,
  sample_id = "subject",
  time = "Time",
  treatment = "Treatment",
  tumor_vol = "TumorVolume",
  trt_control = "Control",
  drug_a = "DrugA",
  drug_b = "DrugB",
  combination = "Combination",
  show_plot = FALSE
  )
# Generate plots 
plot_ranefDiagnostics(lmm)
# Access to specific plots
plot_ranefDiagnostics(lmm)[[1]]
plot_ranefDiagnostics(lmm)[[2]]

SynergyLMM documentation built on April 4, 2025, 4:13 a.m.