% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/confidence_sequences.R
\name{cs_bernstein}
\alias{cs_bernstein}
\title{Empirical Bernstein confidence sequence (Theorem 2, Choe & Ramdas 2023)}
\usage{
cs_bernstein(
  scores1,
  scores2,
  alpha = 0.05,
  c = 2,
  v_opt = 10,
  boundary = "mixture",
  gammas = NULL,
  lcb_only = FALSE,
  ucb_only = FALSE
)
}
\arguments{
\item{scores1}{Numeric vector. Scores for forecaster 1.}

\item{scores2}{Numeric vector. Scores for forecaster 2.}

\item{alpha}{Numeric in (0,1). Significance level. Default: 0.05.}

\item{c}{Numeric > 0. Sub-exponential scale. The process must satisfy
|hat_delta_i| <= c/2. For score differences in \verb{[a-b, b-a]},
c = b - a (e.g. c = 2 for Brier score differences in \verb{[-1,1]}).
Default: 2.}

\item{v_opt}{Numeric > 0. Optimal intrinsic time. Default: 10.}

\item{boundary}{Character. "mixture" (default, GE mixture) or "stitching"
(polynomial stitched) or "hardcoded" (CR23 example formula,
only valid for alpha=0.05, c=1).}

\item{gammas}{Numeric vector or NULL. Predictable centering sequence.
If NULL, constructed as lagged running mean (default).}

\item{lcb_only}{Logical. If TRUE, return lower CS only: \verb{[lower, +Inf)}.
Requires finite lower bound on hat_delta_i; provide c.}

\item{ucb_only}{Logical. If TRUE, return upper CS only: \verb{(-Inf, upper]}.}
}
\value{
data.frame with columns t, estimate, lower, upper.
lower = -Inf if ucb_only = TRUE; upper = Inf if lcb_only = TRUE.
}
\description{
Constructs a variance-adaptive time-uniform CS using empirical intrinsic
time \eqn{\hat{V}_t = \sum_{i=1}^t (\hat{\delta}_i - \gamma_i)^2}.
Tighter than the Hoeffding CS when score differences have low variance.
}
\details{
The CS is:
\deqn{C_t^{EB} = \hat{\Delta}_t \pm u_{\alpha/2}^{GE}(\hat{V}_t;\, \rho, c) \;/\; t}
}
\examples{
scores1 <- c(-0.04, -0.09, -0.01, -0.16)
scores2 <- c(-0.09, -0.16, -0.04, -0.25)
cs_bernstein(scores1, scores2, alpha = 0.05)

}
