% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/check_normality.R
\name{check_normality}
\alias{check_normality}
\alias{check_normality.merMod}
\title{Check model for (non-)normality of residuals.}
\usage{
check_normality(x, ...)

\method{check_normality}{merMod}(x, effects = "fixed", ...)
}
\arguments{
\item{x}{A model object.}

\item{...}{Currently not used.}

\item{effects}{Should normality for residuals (\code{"fixed"}) or random
effects (\code{"random"}) be tested? Only applies to mixed-effects models.
May be abbreviated.}
}
\value{
The p-value of the test statistics. A p-value < 0.05 indicates a
significant deviation from normal distribution.
}
\description{
Check model for (non-)normality of residuals.
}
\details{
\code{check_normality()} calls \code{stats::shapiro.test} and checks the
standardized residuals (or studentized residuals for mixed models) for
normal distribution. Note that this formal test almost always yields
significant results for the distribution of residuals and visual inspection
(e.g. Q-Q plots) are preferable. For generalized linear models, no formal
statistical test is carried out. Rather, there's only a \code{plot()} method for
GLMs. This plot shows a half-normal Q-Q plot of the absolute value of the
standardized deviance residuals is shown (in line with changes in
\code{plot.lm()} for R 4.3+).
}
\note{
For mixed-effects models, studentized residuals, and \emph{not}
standardized residuals, are used for the test. There is also a
\href{https://easystats.github.io/see/articles/performance.html}{\code{plot()}-method}
implemented in the \href{https://easystats.github.io/see/}{\strong{see}-package}.
}
\examples{
\dontshow{if (insight::check_if_installed("see", minimum_version = "0.9.1", quietly = TRUE)) withAutoprint(\{ # examplesIf}
m <<- lm(mpg ~ wt + cyl + gear + disp, data = mtcars)
check_normality(m)

# plot results
x <- check_normality(m)
plot(x)

\donttest{
# QQ-plot
plot(check_normality(m), type = "qq")

# PP-plot
plot(check_normality(m), type = "pp")
}
\dontshow{\}) # examplesIf}
}
\seealso{
\code{\link[see:plot.see_check_normality]{see::plot.see_check_normality()}} for options to customize the plot.
}
