Provides a unified framework for diagnosing common issues in statistical models including linear models, generalized linear models (logistic and Poisson regression), and survival models. Implements tests for multicollinearity, heteroscedasticity, autocorrelation, normality, influential observations, overdispersion, zero-inflation, and proportional hazards assumptions. Includes visualization methods for graphical diagnostics. Methods are based on established approaches including Fox and Monette (1992)
The goal of modeldiag is to provide comprehensive diagnostic checks for statistical models including linear models, generalized linear models, and survival models.
You can install the development version of modeldiag from GitHub with:
# install.packages("devtools")
devtools::install_github("Teniola17/modeldiag")
This is a basic example which shows you how to diagnose a linear model:
library(modeldiag)
# Fit a linear model
model <- lm(mpg ~ wt + hp + disp, data = mtcars)
# Run diagnostics
diagnostics <- diagnose_model(model)
# View summary
summary(diagnostics)
# Plot diagnostics
plot(diagnostics)
The package currently supports:
lm): Tests for multicollinearity, heteroscedasticity, autocorrelation, normality, and outliersglm):
coxph): Tests for proportional hazards assumption, influential observations, and functional formEach model type has specific diagnostic tests:
The plot() method provides model-specific diagnostic plots:
If you encounter a bug, please file an issue with a minimal reproducible example on GitHub.#� �m�o�d�e�l�d�i�a�g� � �