% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/confidence_sequences.R
\name{cs_hoeffding}
\alias{cs_hoeffding}
\title{Hoeffding-style confidence sequence (Theorem 1, Choe & Ramdas 2023)}
\usage{
cs_hoeffding(
  scores1,
  scores2,
  alpha = 0.05,
  c = 1,
  v_opt = 10,
  boundary = "mixture"
)
}
\arguments{
\item{scores1}{Numeric vector. Scores S(p_t, y_t) for forecaster 1.}

\item{scores2}{Numeric vector. Scores S(q_t, y_t) for forecaster 2.}

\item{alpha}{Numeric in (0,1). Significance level. The CS has coverage
1 - alpha uniformly over all t. Default: 0.05.}

\item{c}{Numeric > 0. Sub-Gaussian scale. The process must satisfy
|hat_delta_i| <= c for all i. For scores in \verb{[a,b]}, the
difference is in \verb{[a-b, b-a]}, so c = b - a.
Default: 1 (appropriate for Brier score differences in \verb{[-1,1]}).}

\item{v_opt}{Numeric > 0. Intrinsic time at which the CS is tightest.
Default: 10 (recommended by CR23).}

\item{boundary}{Character. "mixture" (default, recommended) or "stitching".}
}
\value{
data.frame with columns t, estimate, lower, upper.
}
\description{
Constructs a time-uniform confidence sequence for the mean score difference
\eqn{\Delta_t = \frac{1}{t} \sum_{i=1}^t E[\hat{\delta_i} \mid \mathcal{F}_{i-1}]}.
}
\section{Assumption}{

Requires \code{hat_delta_i} to be c-sub-Gaussian given \eqn{\mathcal{F}_{i-1}},
i.e. \verb{|hat_delta_i| <= c} for all \code{i}.
}

\section{Boundary}{

\deqn{C_t^H = \hat\Delta_t \pm u^{CM}_{\alpha/2}(c^2 t; \rho) / t}
where \eqn{u^{CM}} is the normal mixture boundary and \eqn{c^2 t} is the
intrinsic time for a c-sub-Gaussian process with deterministic variance
proxy. The intrinsic time for Theorem 1 is \code{v_t = c^2 * t}, not \code{v_t = t}:
the CM boundary implicitly assumes 1-sub-Gaussian inputs, so the \code{c^2}
scaling must be applied explicitly. This matches the H21 convention,
where the boundary absorbs the sub-Gaussian parameter via the variance
process definition.

Relation to Python comparecast: Python uses \code{v_t = sigma * t} where
\code{sigma = (hi - lo)/2 = c}. This is equivalent to our \code{c^2 * t} only when
\code{c = 1}. For \code{c != 1} the parametrisations differ; we follow the paper.
}

\section{Output}{

Returns a \code{data.frame} with one row per \code{t} and columns \code{t}, \code{estimate}
(the running mean \code{hat_Delta_t}), \code{lower}, and \code{upper}, with coverage
guarantee \eqn{P(\forall t \geq 1 : \Delta_t \in [\text{lower}_t,
\text{upper}_t]) \geq 1 - \alpha}.
}

\examples{
scores1 <- c(-0.04, -0.09, -0.01, -0.16)
scores2 <- c(-0.09, -0.16, -0.04, -0.25)
cs_hoeffding(scores1, scores2, alpha = 0.05)

}
