% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lrt_homogeneity_gau.R
\name{test_homogeneity_gau}
\alias{test_homogeneity_gau}
\title{Likelihood ratio test for homogeneity across groups (Gaussian AD data)}
\usage{
test_homogeneity_gau(y, blocks, p = 1L, use_modified = TRUE)
}
\arguments{
\item{y}{Numeric matrix with n_subjects rows and n_time columns.}

\item{blocks}{Integer vector of length n_subjects indicating group membership.}

\item{p}{Antedependence order. This is the same order parameter named
\code{order} in \code{\link{fit_gau}}.}

\item{use_modified}{Logical. If TRUE (default), use modified test statistic
for better small-sample approximation.}
}
\value{
A list with class \code{gau_homogeneity_test} containing:
\describe{
\item{method}{Inference method used (\code{"lrt"}).}
\item{statistic}{Test statistic value}
\item{statistic_modified}{Modified test statistic (if use_modified = TRUE)}
\item{df}{Degrees of freedom}
\item{p_value}{P-value from chi-square distribution}
\item{p_value_modified}{P-value from modified test}
\item{G}{Number of groups}
\item{group_sizes}{Sample sizes for each group}
\item{order}{Antedependence order}
}
}
\description{
Tests the null hypothesis that G groups have the same AD(p) covariance
structure against the alternative that they have different AD(p) structures.
This implements Theorem 6.6 of Zimmerman & Núñez-Antón (2009).
}
\details{
The test compares:
\itemize{
\item H0: All G groups have the same AD(p) covariance matrix Sigma(theta)
\item H1: Groups have different AD(p) covariance matrices Sigma(theta_g)
}

The likelihood ratio test statistic (Theorem 6.6) involves comparing
pooled and within-group RSS values. The degrees of freedom are
(G-1)(2n - p)(p + 1)/2.

This test is useful for determining whether a common covariance structure
can be assumed across treatment groups before performing mean comparisons.
}
\examples{
\donttest{
# Simulate data from two groups with same covariance
n1 <- 30
n2 <- 35
y1 <- simulate_gau(n1, n_time = 6, order = 1, phi = 0.5, sigma = 1)
y2 <- simulate_gau(n2, n_time = 6, order = 1, phi = 0.5, sigma = 1)
y <- rbind(y1, y2)
blocks <- c(rep(1, n1), rep(2, n2))

# Test homogeneity
test <- test_homogeneity_gau(y, blocks, p = 1)
print(test)
}

}
\references{
Zimmerman, D.L. and Núñez-Antón, V. (2009). Antedependence Models for
Longitudinal Data. Chapman & Hall/CRC. Section 6.4.

Kenward, M.G. (1987). A method for comparing profiles of repeated measurements.
Applied Statistics, 36, 296-308.
}
\seealso{
\code{\link{test_order_gau}}, \code{\link{test_two_sample_gau}}
}
