% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/wrapper_table.R
\name{rtmb_table}
\alias{rtmb_table}
\title{RTMB-based Contingency Table Analysis (Chi-squared Test)}
\usage{
rtmb_table(
  x,
  y = NULL,
  data = NULL,
  correct = TRUE,
  prior = prior_flat(),
  fixed = NULL,
  WAIC = FALSE,
  ...
)
}
\arguments{
\item{x}{Variable name, formula, table, or matrix.}

\item{y}{Variable name (optional if x is a formula).}

\item{data}{A data frame.}

\item{correct}{Logical; if TRUE, apply Yates' continuity correction for 2x2 classic analyses.}

\item{prior}{Prior specification (Bayesian mode). Default is `prior_flat()`.}

\item{fixed}{Optional named list of fixed values for specific parameters.}

\item{WAIC}{Logical; if TRUE, add pointwise `log_lik` to the generate block for WAIC.}

\item{...}{Additional arguments.}
}
\value{
An `RTMB_Model` object.
}
\description{
`rtmb_table` performs a chi-squared test of independence between two categorical variables.
It provides both classic (frequentist) Pearson chi-squared tests and Bayesian multinomial-style models.
}
\examples{
\donttest{
# Classic chi-squared test
rtmb_table(skill, cond, data = debate)$classic()
rtmb_table(table(debate$skill, debate$cond))$classic()
}
}
