% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/long_run_var.R
\name{htdv_lrv}
\alias{htdv_lrv}
\title{Long-Run Variance Estimation (HAC)}
\usage{
htdv_lrv(
  x,
  kernel = c("bartlett", "parzen", "qs"),
  bandwidth = "andrews",
  prewhiten = FALSE
)
}
\arguments{
\item{x}{Numeric vector of observations.}

\item{kernel}{Kernel choice: \code{"bartlett"}, \code{"parzen"}, or
\code{"qs"} (Quadratic-Spectral).}

\item{bandwidth}{Either \code{"andrews"} (data-driven) or a positive
numeric scalar.}

\item{prewhiten}{Logical; if \code{TRUE}, AR(1) prewhiten-recolor
(Andrews-Monahan 1992).}
}
\value{
A list with components \code{lrv} (long-run variance estimate),
  \code{bandwidth}, \code{kernel}, and \code{ar_coef} (only if prewhitened).
}
\description{
Heteroskedasticity-and-autocorrelation-consistent long-run variance with
data-driven Andrews (1991) optimal bandwidth, Bartlett, Parzen, and
Quadratic-Spectral kernels.
}
\examples{
set_seed_user <- 42
x <- arima.sim(model = list(ar = 0.6), n = 200, rand.gen = rnorm)
out <- htdv_lrv(as.numeric(x), kernel = "qs", bandwidth = "andrews")
out$lrv

}
\references{
Andrews, D.W.K. (1991). Heteroskedasticity and Autocorrelation Consistent
Covariance Matrix Estimation. Econometrica 59(3): 817-858.
Newey, W.K. & West, K.D. (1987). A Simple, Positive Semi-Definite
Heteroskedasticity and Autocorrelation Consistent Covariance Matrix.
Econometrica 55(3): 703-708.
}
