batch_means_estimator: Batch-Means Covariance Estimator for SGD Trajectories

View source: R/batch-means.R

batch_means_estimatorR Documentation

Batch-Means Covariance Estimator for SGD Trajectories

Description

Estimate the asymptotic covariance from a single SGD trajectory using the increasing-batch construction from Xi et al. (2020).

Usage

batch_means_estimator(
  trajectory,
  alpha = 0.501,
  M = NULL,
  N = NULL,
  drop_burnin = TRUE,
  burnin_iter = 0
)

Arguments

trajectory

numeric matrix with rows = iterations and columns = parameters.

alpha

stepsize decay exponent in \eta_i = \eta i^{-\alpha}. Must satisfy 1/2 < \alpha < 1.

M

number of retained batches (excluding burn-in batch 0). If 'NULL', use \lfloor n^{(1-\alpha)/2} \rfloor.

N

decorrelation constant in e_k = \lfloor ((k+1)N)^{1/(1-\alpha)} \rfloor. If 'NULL', use N = n^{1-\alpha}/(M+1).

drop_burnin

logical; if 'TRUE', discard batch 0.

burnin_iter

non-negative integer. Explicitly discard the first 'burnin_iter' iterations before building Xi-style batches. After trimming, batch boundaries are rebuilt from iteration 1 of the retained trajectory.

Value

A list containing the covariance estimate, pooled mean, batch sizes, batch boundaries, and chain-level metadata.


ngme2 documentation built on May 20, 2026, 9:10 a.m.