View source: R/plot_residuals.R
plot_residuals | R Documentation |
Plot several residuals plots for diagnostics.
plot_residuals(x, y, fit)
x |
A length one character vector with the main covariate name
(i.e., right-hand side), as defined in |
y |
A length one character vector with the variable name to be explained
(i.e., left-hand side), as defined in |
fit |
A model object from a statistical model
such as from a call |
A patchwork
ggplot2
object.
library(ggplot2)
library(patchwork)
library(eggla)
data("bmigrowth")
res <- egg_model(
formula = log(bmi) ~ age,
data = bmigrowth[bmigrowth[["sex"]] == 0, ],
id_var = "ID",
random_complexity = 1
)
plot_residuals(
x = "age",
y = "log(bmi)",
fit = res
) +
plot_annotation(
title = "Cubic Splines (Random Linear Splines) - BMI - Female",
tag_levels = "A"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.