View source: R/growth_model_residual_plots.R
growth_model_residual_plots | R Documentation |
This function provides a wrapper to ggplot2 for generating residual
diagnostic plots and summary statistics for a growth model summary list
object produced by growth_curve_model_fit
.
growth_model_residual_plots(
growth_model_summary_list,
residual_type = "cluster",
weighted = TRUE
)
growth_model_summary_list |
A list object created by the
|
residual_type |
A character string specifying the type of residuals to be displayed in the plot. Options include "population" for the fixed-effects residuals for mixed-effects and least-squares models and "cluster" for fixed and random-effects residuals for mixed-effects regression models. Defaults to "cluster". |
weighted |
A logical value, when TRUE displays weighted residuals for mixed-effects models or standardized residuals for least-squares models, when FALSE displays the raw residuals for mixed-effects and least-squares models. Defaults to "TRUE". |
Returns a patchwork collage of ggplot2 model diagnostic plots with the following plots displayed:
Residual vs Fitted Values - a model diagnostic plot for assessing the distribution of the residuals vs the model fitted values, useful in detecting improper function specification, homogeneity of variance, and outlier detection.
Q-Q Plot - a model diagnostic plot (quantile-quantile) plot for comparing the residuals vs their theoretical quantiles, useful in assessing normality assumptions and outlier detection.
Residual Density Plot - a model diagnostic showing the distribution of the residuals (histogram) with a normal distribution curve overlaid based on the residuals mean and standard deviation, useful in assessing normality assumptions and skewness.
Residual Summary Statistics - a list of descriptive statistics of the the residuals including: mean, median, minimum, maximum, skewness, and kurtosis.
growth_curve_model_fit
# Load example data (exponential data)
data(exp_mixed_data)
# Fit an mixed-effects growth model to the data and produce summary list
exp_mixed_model_summary <- growth_curve_model_fit(
data_frame = exp_mixed_data,
function_type = "exponential",
verbose = FALSE)
# Check residuals and model assumptions
residual_diag_plot <- growth_model_residual_plots(
growth_model_summary_list = exp_mixed_model_summary)
print(residual_diag_plot)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.