% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/conformal.R
\name{htdv_conformal}
\alias{htdv_conformal}
\title{Adaptive Conformal Inference for Dependent Data}
\usage{
htdv_conformal(
  x,
  predictor,
  residual_fun = function(e) abs(e),
  alpha_target = 0.1,
  lambda = 0.05,
  burn_in = 20L
)
}
\arguments{
\item{x}{Numeric vector of sequential observations.}

\item{predictor}{Function \code{function(history)} returning a scalar
one-step point prediction.}

\item{residual_fun}{Function of residuals to calibrate the score; default
absolute residual.}

\item{alpha_target}{Target miscoverage rate.}

\item{lambda}{Step size for the gradient update.}

\item{burn_in}{Integer; the first \code{burn_in} observations are used only
to warm up the predictor.}
}
\value{
A list with \code{intervals} (matrix of lower/upper),
  \code{coverage} (empirical), \code{alpha_path}, and
  \code{point_predictions}.
}
\description{
Online adaptive conformal prediction intervals with gradient update on the
miscoverage rate (Gibbs-Candes 2021). Provides long-run marginal coverage
without exchangeability.
}
\examples{
x <- arima.sim(model = list(ar = 0.6), n = 200, rand.gen = rnorm)
pred <- function(hist) if (length(hist) >= 1) hist[length(hist)] else 0
out <- htdv_conformal(as.numeric(x), pred, alpha_target = 0.1,
                      lambda = 0.05, burn_in = 20)
out$coverage

}
\references{
Gibbs, I., & Candes, E. (2021). Adaptive Conformal Inference under
Distribution Shift. NeurIPS 34: 1660-1672.
}
