% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/svp_test.R
\name{lmc_ar}
\alias{lmc_ar}
\title{LMC Test for AR Order in SV(p) Models}
\usage{
lmc_ar(
  y,
  p_null,
  p_alt,
  J = 10,
  N = 99,
  burnin = 500,
  del = 1e-10,
  wDecay = FALSE,
  Bartlett = FALSE,
  Amat = NULL,
  errorType = "Gaussian",
  sigvMethod = "factored",
  logNu = TRUE,
  winsorize_eps = 0
)
}
\arguments{
\item{y}{Numeric vector. Observed returns.}

\item{p_null}{Integer. Order under the null hypothesis.}

\item{p_alt}{Integer. Order under the alternative (\code{p_alt > p_null}).}

\item{J}{Integer. Winsorizing parameter. Default 10.}

\item{N}{Integer. Number of Monte Carlo replications. Default 99.}

\item{burnin}{Integer. Burn-in for simulation. Default 500.}

\item{del}{Numeric. Small constant for log transformation. Default \code{1e-10}.}

\item{wDecay}{Logical. Use decaying weights. Default \code{FALSE}.}

\item{Bartlett}{Logical. If \code{TRUE}, use Bartlett kernel HAC weighting
matrix for a GMM-LRT-type test statistic. If \code{FALSE} (default), use
the sum of squared extra AR coefficients.}

\item{Amat}{Weighting matrix specification. \code{NULL} (default) for identity
weighting, or \code{"Weighted"} for data-driven HAC. Takes precedence over
\code{Bartlett}. User-supplied matrices are not supported for AR order tests.}

\item{errorType}{Character. Error distribution of the return innovations:
\code{"Gaussian"} (default), \code{"Student-t"}, or \code{"GED"}. Heavy-tail
options reuse the same moment-based GMM-LRT machinery as \code{lmc_t}/
\code{lmc_ged}; \eqn{\nu} is held at the null MLE during the simulation
(it is not a varied nuisance for the AR-order test).}

\item{sigvMethod}{Character. Method for \eqn{\sigma_v} estimation:
\code{"factored"} (default), \code{"hybrid"}, or \code{"direct"}.}

\item{logNu}{Logical. Use log-space for \eqn{\nu} estimation (Student-t/GED
only). Default \code{TRUE}.}

\item{winsorize_eps}{Number of extreme autocovariance lags to winsorize
(heavy-tail only). Default 0.}
}
\value{
An object of class \code{"svp_test"}, a list containing:
\describe{
  \item{s0}{Test statistic from observed data (capped at 1e-10 if negative).}
  \item{sN}{Simulated null distribution (vector of length N).}
  \item{pval}{Monte Carlo p-value.}
  \item{test_type}{Character string identifying the test.}
  \item{null_param}{Name of the parameter(s) tested.}
  \item{null_value}{Value(s) under the null hypothesis.}
  \item{errorType}{Error distribution used.}
  \item{call}{The matched call.}
}
}
\description{
Performs a Local Monte Carlo (LMC) test of the null hypothesis
\eqn{H_0: \phi_{p_0+1} = \cdots = \phi_p = 0} (i.e., that an SV(\eqn{p_0})
model is sufficient against an SV(\eqn{p}) alternative).
}
\details{
When \code{Bartlett = FALSE} (default), the test statistic is
\eqn{T \sum_{j=p_0+1}^{p} \hat\phi_j^2}, i.e., the sum of squared extra
AR coefficients scaled by sample size.

When \code{Bartlett = TRUE}, the test statistic is based on the GMM-LRT
approach with a Bartlett kernel HAC weighting matrix:
\eqn{S = T \times (M_{H_0} - M_{H_1})}, where \eqn{M} denotes the
GMM criterion evaluated at the null and alternative estimates. Both the
observed and simulated test statistics are capped at \code{1e-10} when
negative; a negative observed statistic raises a warning (it indicates strong
evidence in favour of the null, since the alternative does not improve the
GMM criterion).
}
\examples{
\donttest{
y <- sim_svp(1000, phi = 0.95, sigy = 1, sigv = 0.2)$y
test <- lmc_ar(y, p_null = 1, p_alt = 2, J = 10, N = 49)
print(test)
}

}
