% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/vis_group_normality.R
\name{vis_group_normality}
\alias{vis_group_normality}
\title{Visualisation of the normality assumption for Welch ANOVA/t-test}
\usage{
vis_group_normality(
  samples,
  groups,
  conf.level = 0.95,
  samplename = "",
  groupname = "",
  cex = 1
)
}
\arguments{
\item{samples}{Numeric vector; the dependent variable.}

\item{groups}{Factor or vector; the grouping variable (2 to 8 groups for visual display).}

\item{conf.level}{Numeric; confidence level (default: 0.95). Used to determine 
alpha = 1 - conf.level for normality test interpretation.}

\item{samplename}{Character; label for the y-axis (default: "").}

\item{groupname}{Character; label for the x-axis (default: "").}

\item{cex}{Numeric; scaling factor for plot text and symbols (default: 1).}
}
\value{
A list containing:
\describe{
  \item{shapiro_tests}{List of Shapiro-Wilk test results for each group}
  \item{ad_tests}{List of Anderson-Darling test results for each group}
  \item{n_groups}{Number of groups}
  \item{group_names}{Names of the groups}
}
}
\description{
\code{vis_group_normality} checks for normality of each group separately using 
the Shapiro-Wilk and Anderson-Darling tests. The null hypothesis is that 
each group is normally distributed. The function generates histograms 
with normal distribution overlays and Q-Q plots to visually assess normality.
The layout is always 2 rows × k columns (histograms on top, Q-Q plots on bottom).
}
\details{
Layout is always 2 rows × k columns:
\itemize{
  \item Top row: Histograms with normal overlay for each group
  \item Bottom row: Q-Q plots for each group
}
For more than 8 groups, a tabular summary is provided instead of plots.
}
\examples{
# Two groups (like t-test)
vis_group_normality(ToothGrowth$len, ToothGrowth$supp)

# Three groups
ToothGrowth$dose <- as.factor(ToothGrowth$dose)
vis_group_normality(ToothGrowth$len, ToothGrowth$dose)

}
