% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lrt_order_cat.R
\name{run_order_tests_cat}
\alias{run_order_tests_cat}
\title{Run all pairwise order tests}
\usage{
run_order_tests_cat(
  y,
  max_order = 2,
  blocks = NULL,
  homogeneous = TRUE,
  n_categories = NULL,
  test = c("lrt", "score", "mlrt", "wald")
)
}
\arguments{
\item{y}{Integer matrix of categorical data (n_subjects x n_time).}

\item{max_order}{Maximum order to test. Default is 2.}

\item{blocks}{Optional block membership vector.}

\item{homogeneous}{Whether to use homogeneous parameters across blocks.}

\item{n_categories}{Number of categories (inferred if NULL).}

\item{test}{Type of test statistic for each pairwise comparison. One of
\code{"lrt"} (default), \code{"score"}, \code{"mlrt"}, or \code{"wald"}.
Passed to \code{\link{test_order_cat}}.}
}
\value{
A list containing:
\item{tests}{List of test_order_cat results for each comparison}
\item{table}{Summary data frame with all comparisons}
\item{fits}{List of all fitted models}
\item{selected_order}{Recommended order based on sequential testing at alpha=0.05}
}
\description{
Performs sequential likelihood ratio tests for AD orders 0 vs 1, 1 vs 2, etc.
}
\details{
This function performs forward selection: starting from order 0, it tests
whether increasing the order provides significant improvement. The selected
order is the highest order where the test was significant (at alpha = 0.05).
}
\examples{
\donttest{
y <- simulate_cat(200, 6, order = 1, n_categories = 2)
result <- run_order_tests_cat(y, max_order = 2)
print(result$table)
cat("Selected order:", result$selected_order, "\n")
}

}
