View source: R/plot_lmmModel.R
plot_lmmModel | R Documentation |
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.
plot_lmmModel(
model,
trt_control = "Control",
drug_a = "Drug_A",
drug_b = "Drug_B",
drug_c = NA,
combination = "Combination"
)
model |
An object of class "lme" representing the linear mixed-effects model fitted by |
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. |
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.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.