Checks the residual diagnostics in the general linear model Student's t-test (t.test,var=EQUAL) Fisher oneway ANOVA (aov) or simple linear regression. Performs the Shapiro-Wilk and Anderson-Darling tests for normality, and for grouped data also Levene's and Bartlett's tests for homogeneity of variances. For simple linear regression, heteroscedasticity is assessed with the Breusch-Pagan test [@Koenker:1981], which regresses squared raw residuals on fitted values. The normality tests, the grouped variance tests, and the histogram and Q-Q panels are computed from the internally studentised residuals r_i = e_i / (SE_res sqrt(1 - h_i)), which remove the leverage-dependent variance of the raw residuals (Var(e_i) = sigma^2 (1 - h_i)). The residuals-vs-fitted panel (regression mode) uses the z-residuals z_i = e_i / SE_res, which retain the leverage-dependent spread.
vis_lm_assumptions(
samples,
fact,
cex = 1,
correlation = FALSE,
conf.level = 0.95,
qq_nsim = getOption("visStatistics.qq_nsim", 5000L),
plot_args = list()
)A list with elements:
Summary of the ANOVA model.
Result from shapiro.test().
Result from nortest::ad.test() or a character message if n < 7.
Result from levene.test() (grouped diagnostics only).
Result from bartlett.test() (grouped diagnostics only).
Result from bp.test() (regression diagnostics only).
Numeric vector; the dependent variable.
Factor; the independent variable.
Numeric; scaling factor for plot text and symbols (default: 1).
Logical. If FALSE and fact is numeric,
regression diagnostics are shown. If TRUE, no regression
diagnostics are shown. Default is FALSE.
Numeric confidence level for the simulated Q-Q envelopes.
Integer number of simulated refits for the Q-Q envelopes.
Optional named list of base graphics parameters.
ToothGrowth$dose <- as.factor(ToothGrowth$dose)
vis_lm_assumptions(ToothGrowth$len, ToothGrowth$dose, qq_nsim = 100L)
Run the code above in your browser using DataLab