% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lrt_mean_gau.R
\name{test_contrast_gau}
\alias{test_contrast_gau}
\title{Test linear hypotheses on the mean under antedependence}
\usage{
test_contrast_gau(y, C, c = NULL, p = 1L)
}
\arguments{
\item{y}{Numeric matrix with n_subjects rows and n_time columns.}

\item{C}{Contrast matrix with c rows and n_time columns, where c is the
number of contrasts being tested. Rows must be linearly independent.}

\item{c}{Right-hand side vector of length equal to nrow(C). Default is
a vector of zeros.}

\item{p}{Antedependence order of the covariance structure. This is the same
order parameter named \code{order} in \code{\link{fit_gau}}.}
}
\value{
A list with class \code{gau_contrast_test} containing:
\describe{
\item{method}{Inference method used (\code{"wald"}).}
\item{C}{Contrast matrix}
\item{c}{Right-hand side vector}
\item{mu_hat}{Estimated mean vector}
\item{contrast_est}{Estimated value of C * mu}
\item{statistic}{Wald test statistic}
\item{df}{Degrees of freedom (number of contrasts)}
\item{p_value}{P-value from chi-square distribution}
}
}
\description{
Tests the null hypothesis C * mu = c for a specified contrast matrix C
and vector c, under an AD(p) covariance structure. This implements
Theorem 7.2 of Zimmerman & Núñez-Antón (2009).
}
\details{
The Wald test statistic (Theorem 7.2) is:
\deqn{(C\bar{Y} - c)^T (C \hat{\Sigma} C^T)^{-1} (C\bar{Y} - c)}

where \eqn{\hat{\Sigma}} is the REML estimator of the covariance matrix
under the AD(p) model.

Common examples include:
\itemize{
\item Testing if mean is constant: C is the first-difference matrix
\item Testing for linear trend: C tests deviations from linearity
}
}
\examples{
\donttest{
y <- simulate_gau(n_subjects = 50, n_time = 5, order = 1)

# Test if mean is constant (all differences = 0)
# C is 4x5 matrix of first differences
C <- matrix(0, nrow = 4, ncol = 5)
for (i in 1:4) {
  C[i, i] <- 1
  C[i, i+1] <- -1
}
test <- test_contrast_gau(y, C = C, p = 1)
print(test)
}

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