% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/loglik_gau.R
\name{logL_gau}
\alias{logL_gau}
\title{Log-likelihood for Gaussian AD models (with missing data support)}
\usage{
logL_gau(
  y,
  order,
  mu = NULL,
  phi = NULL,
  sigma = NULL,
  blocks = NULL,
  tau = 0,
  na_action = c("fail", "complete", "marginalize")
)
}
\arguments{
\item{y}{Numeric matrix with n_subjects rows and n_time columns. May contain NA.}

\item{order}{Antedependence order, one of 0, 1, or 2.}

\item{mu}{Mean vector (length n_time).}

\item{phi}{Dependence coefficient(s). For order 1: vector of length n_time-1.
For order 2: matrix with 2 columns or vector of length 2*(n_time-2).}

\item{sigma}{Innovation standard deviations (length n_time).}

\item{blocks}{Integer vector of block membership (length n_subjects), or NULL.}

\item{tau}{Block effects, first element constrained to zero}

\item{na_action}{How to handle missing values:
\itemize{
\item \code{fail}: Error if any NA is present (default)
\item \code{complete}: Use only complete cases
\item \code{marginalize}: Compute observed-data likelihood
}}
}
\value{
Scalar log-likelihood value.
}
\description{
Computes the log-likelihood for Gaussian antedependence models of order 0, 1, or 2.
Supports missing data under MAR assumption via na_action parameter.
}
\details{
For complete data (no NA), all three na_action options give the same result.

For missing data:
\itemize{
\item marginalize: Uses MVN marginalization to compute P(Y_obs). This is
the correct observed-data likelihood for MAR missing data.
\item complete: Removes subjects with any missing values. May lose information.
\item fail: Stops with error. Useful to ensure no missing data present.
}
}
\examples{
set.seed(1)
y <- simulate_gau(n_subjects = 30, n_time = 5, order = 1, phi = 0.3)
fit <- fit_gau(y, order = 1)
logL_gau(y, order = 1, mu = fit$mu, phi = fit$phi, sigma = fit$sigma)

}
