plot_lmmModel: Plotting of tumor growth data from a fitted model

View source: R/plot_lmmModel.R

plot_lmmModelR Documentation

Plotting of tumor growth data from a fitted model

Description

Vizualization of tumor growth data and linear mixed model fitted regression line for the fixed effects. This functions returns a ggplot2 plot, allowing for further personalization.

Usage

plot_lmmModel(
  model,
  trt_control = "Control",
  drug_a = "Drug_A",
  drug_b = "Drug_B",
  drug_c = NA,
  combination = "Combination"
)

Arguments

model

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

trt_control

String indicating the name assigned to the 'Control' group.

drug_a

String indicating the name assigned to the 'Drug A' group.

drug_b

String indicating the name assigned to the 'Drug B' group.

drug_c

String indicating the name assigned to the 'Drug C' group (if present).

combination

String indicating the name assigned to the Combination ('Drug A' + 'Drug B', or 'Drug A' + 'Drug B' + 'Drug C') group.

Value

A ggplot2 plot (see ggplot2::ggplot() for more details) showing the tumor growth data represented as log(relative tumor volume) versus time since treatment initiation. The regression lines corresponding to the fixed effects for each treatment group are also plotted.

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
  )
# Default plot
plot_lmmModel(lmm,
trt_control = "Control",
drug_a = "DrugA",
drug_b = "DrugB",
combination = "Combination"
)
# Adding ggplot2 elements
plot_lmmModel(lmm,
trt_control = "Control",
drug_a = "DrugA",
drug_b = "DrugB",
combination = "Combination"
) + ggplot2::labs(title = "Example Plot") + ggplot2::theme(legend.position = "top")


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