% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lrt_stationarity_gau.R
\name{test_stationarity_gau}
\alias{test_stationarity_gau}
\title{Likelihood ratio test for stationarity (Gaussian AD data)}
\usage{
test_stationarity_gau(
  y,
  order = 1L,
  blocks = NULL,
  constrain = "both",
  fit_unconstrained = NULL,
  verbose = FALSE,
  max_iter = 2000L,
  rel_tol = 1e-08,
  ...
)
}
\arguments{
\item{y}{Numeric matrix with n_subjects rows and n_time columns.}

\item{order}{Antedependence order (0, 1, or 2).}

\item{blocks}{Optional vector of block memberships (length n_subjects).}

\item{constrain}{Constraint to test:
for order 0: "sigma" (or "all");
for order 1: "phi", "sigma", or "both"/"all";
for order 2: "phi1", "phi2", "phi", "sigma", or "all"/"both".}

\item{fit_unconstrained}{Optional pre-computed unconstrained fit from
\code{\link{fit_gau}}.}

\item{verbose}{Logical; if TRUE, prints fitting progress.}

\item{max_iter}{Maximum number of optimization iterations for constrained fit.}

\item{rel_tol}{Relative tolerance for constrained optimization.}

\item{...}{Additional arguments passed to \code{\link{fit_gau}} when
\code{fit_unconstrained} is not provided.}
}
\value{
A list with class \code{"test_stationarity_gau"} containing:
\describe{
\item{method}{Inference method used (\code{"lrt"}).}
\item{fit_unconstrained}{Unconstrained Gaussian AD fit}
\item{fit_constrained}{Constrained Gaussian AD fit}
\item{constraint}{Human-readable null constraint description}
\item{lrt_stat}{Likelihood-ratio statistic}
\item{df}{Degrees of freedom}
\item{p_value}{Chi-square p-value}
\item{bic_unconstrained}{BIC of unconstrained model}
\item{bic_constrained}{BIC of constrained model}
\item{bic_selected}{Model selected by BIC}
\item{table}{Two-row model summary table}
}
}
\description{
Tests whether time-varying Gaussian AD covariance parameters can be
constrained to be constant over time.
}
\details{
The mean structure is kept unrestricted in both models (time-specific means
plus optional block shifts), and the test constrains covariance parameters:
innovation standard deviations and/or antedependence coefficients.

The likelihood-ratio statistic is:
\deqn{\lambda = 2(\ell_{alt} - \ell_{null})}
where \eqn{\ell_{null}} and \eqn{\ell_{alt}} are maximized log-likelihoods
under the constrained and unconstrained models, respectively.

Degrees of freedom are computed from the number of constraints implied by
\code{constrain}.
}
\examples{
set.seed(1)
y <- simulate_gau(n_subjects = 80, n_time = 6, order = 1, phi = 0.4, sigma = 1)

# Test jointly constant phi and sigma (order 1)
out <- test_stationarity_gau(y, order = 1, constrain = "both")
out$p_value

}
\references{
Zimmerman, D.L. and Nunez-Anton, V. (2009). Antedependence Models for
Longitudinal Data. Chapman & Hall/CRC. Chapter 6.
}
\seealso{
\code{\link{run_stationarity_tests_gau}}, \code{\link{test_order_gau}},
\code{\link{fit_gau}}
}
