% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/easy_chisq.R
\name{easy_chisq}
\alias{easy_chisq}
\title{Chi-Square Tests with Automated Narrative Reporting}
\usage{
easy_chisq(x, y = NULL, data = NULL, p = NULL, correct = TRUE, alpha = 0.05)
}
\arguments{
\item{x}{A factor/character vector, OR a contingency table (matrix), OR a
formula \code{~ var1 + var2} for independence, or \code{~ var1} for GOF.}

\item{y}{A factor/character vector (second categorical variable) for the
independence test. Ignored when \code{x} is a table or formula.}

\item{data}{A data frame. Required when \code{x} is a formula.}

\item{p}{Numeric vector of expected probabilities for the GOF test.
If \code{NULL} (default), equal probabilities are assumed.}

\item{correct}{Logical; apply Yates' continuity correction? Default \code{TRUE}.}

\item{alpha}{Significance threshold for narrative. Default \code{0.05}.}
}
\value{
An \code{"easystat_result"} object with:
  \describe{
    \item{\code{coefficients_table}}{Observed vs. expected frequency table}
    \item{\code{model_fit_table}}{Chi-square statistic, df, p-value, Cramér's V}
    \item{\code{explanation}}{Plain-language narrative}
  }
}
\description{
Runs either a \strong{chi-square test of independence} (two categorical
variables) or a \strong{goodness-of-fit test} (one variable vs. expected
proportions), extracts Cramér's V as the effect-size measure, and generates
a plain-language narrative via the Narrative Generator Module.
}
\examples{
# Independence test
result <- easy_chisq(~ cyl + am, data = mtcars)
print(result)

# Goodness-of-fit
result <- easy_chisq(~ cyl, data = mtcars)
print(result)

}
