% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/api-tables.R
\name{facets_chisq_table}
\alias{facets_chisq_table}
\title{Build facet variability diagnostics with fixed/random reference tests}
\usage{
facets_chisq_table(
  fit,
  diagnostics = NULL,
  fixed_p_max = 0.05,
  random_p_max = 0.05,
  top_n = NULL
)
}
\arguments{
\item{fit}{Output from \code{\link[=fit_mfrm]{fit_mfrm()}}.}

\item{diagnostics}{Optional output from \code{\link[=diagnose_mfrm]{diagnose_mfrm()}}.}

\item{fixed_p_max}{Warning cutoff for fixed-effect chi-square p-values.}

\item{random_p_max}{Warning cutoff for random-effect chi-square p-values.}

\item{top_n}{Optional maximum number of facet rows to keep.}
}
\value{
A named list with:
\itemize{
\item \code{table}: facet-level chi-square diagnostics
\item \code{summary}: one-row summary
\item \code{thresholds}: applied p-value thresholds
}
}
\description{
Build facet variability diagnostics with fixed/random reference tests
}
\details{
This helper summarizes facet-level variability with fixed and random
chi-square indices for spread and heterogeneity checks.
}
\section{Interpreting output}{

\itemize{
\item \code{table}: facet-level fixed/random chi-square and p-value flags.
\item \code{summary}: number of significant facets and overall magnitude indicators.
\item \code{thresholds}: p-value criteria used for flagging.
}

Use this table together with inter-rater and displacement diagnostics to
distinguish global facet effects from local anomalies.
}

\section{Typical workflow}{

\enumerate{
\item Run \code{facets_chisq_table(fit, ...)}.
\item Inspect \code{summary(chi)} then facet rows in \code{chi$table}.
\item Visualize with \code{\link[=plot_facets_chisq]{plot_facets_chisq()}}.
}
}

\section{Output columns}{

The \code{table} data.frame contains:
\describe{
\item{Facet}{Facet name.}
\item{Levels}{Number of estimated levels in this facet.}
\item{MeanMeasure, SD}{Mean and standard deviation of level measures.}
\item{FixedChiSq, FixedDF, FixedProb}{Fixed-effect chi-square test
(null hypothesis: all levels equal). Significant result means the
facet elements differ more than measurement error alone.}
\item{RandomChiSq, RandomDF, RandomProb, RandomVar}{Random-effect test
(null hypothesis: variation equals that of a random sample from a
single population). Significant result suggests systematic
heterogeneity beyond sampling variation.}
\item{FixedFlag, RandomFlag}{Logical flags for significance.}
}
}

\examples{
toy <- load_mfrmr_data("example_core")
fit <- fit_mfrm(toy, "Person", c("Rater", "Criterion"), "Score", method = "JML", maxit = 30)
chi <- facets_chisq_table(fit)
summary(chi)
p_chi <- plot(chi, draw = FALSE)
p_chi$data$plot
}
\seealso{
\code{\link[=diagnose_mfrm]{diagnose_mfrm()}}, \code{\link[=interrater_agreement_table]{interrater_agreement_table()}}, \code{\link[=plot_facets_chisq]{plot_facets_chisq()}}
}
