% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/batch-means.R
\name{compute_ngme_ci}
\alias{compute_ngme_ci}
\alias{compute_ngme_CI}
\title{Refit an Existing ngme Object with SGD and Compute Batch-Means CI}
\usage{
compute_ngme_ci(
  fit,
  iterations = 4000,
  alpha = 0.501,
  optimizer = sgd(stepsize = 0.03),
  burnin = 100,
  n_batch = 20,
  n_parallel_chain = 4,
  t0 = 1,
  start_sd = 0.2,
  seed = Sys.time(),
  verbose = FALSE,
  level = 0.95,
  name = "all",
  M = NULL,
  N = NULL,
  apply_transform = TRUE,
  drop_burnin = TRUE,
  burnin_iter = 0,
  control_opt = NULL,
  ...
)

compute_ngme_CI(
  fit,
  iterations = 4000,
  alpha = 0.501,
  optimizer = sgd(stepsize = 0.03),
  burnin = 100,
  n_batch = 20,
  n_parallel_chain = 4,
  t0 = 1,
  start_sd = 0.2,
  seed = Sys.time(),
  verbose = FALSE,
  level = 0.95,
  name = "all",
  M = NULL,
  N = NULL,
  apply_transform = TRUE,
  drop_burnin = TRUE,
  burnin_iter = 0,
  control_opt = NULL,
  ...
)
}
\arguments{
\item{fit}{existing fitted `ngme` object (can be obtained with any optimizer).}

\item{iterations}{optimization iterations for the SGD CI stage.}

\item{alpha}{Xi-style exponent used for both polynomial schedule and
batch-means inference.}

\item{optimizer}{optimizer for the CI stage; must be `sgd(...)` for Xi theory.}

\item{burnin}{burn-in iterations before SGD optimization.}

\item{n_batch}{number of optimization checkpoints.}

\item{n_parallel_chain}{number of parallel chains for SGD.}

\item{t0}{non-negative schedule offset in
\eqn{\eta_t = \eta_0 (t + t0)^{-\alpha}}.}

\item{start_sd}{standard deviation for randomized chain initialization.}

\item{seed}{random seed for CI-stage optimization.}

\item{verbose}{logical; print optimization progress.}

\item{level}{confidence level for CI.}

\item{name}{parameter block for CI (`"all"`, latent name, or `"general"`).}

\item{M}{number of retained Xi batches (excluding batch 0).}

\item{N}{decorrelation constant in Xi batch boundaries.}

\item{apply_transform}{logical; if `TRUE`, apply Post-delta transform after
raw-space inference.}

\item{drop_burnin}{logical; if `TRUE`, discard Xi batch 0.}

\item{burnin_iter}{non-negative integer used both as optimizer schedule
warmup (`stepsize_schedule_burnin_iter`) and as explicit CI trajectory
trimming before Xi-style batching.}

\item{control_opt}{optional pre-built `control_opt` object for the CI stage.
If supplied, it is used directly (with `store_traj` forced to `TRUE`).}

\item{...}{additional arguments forwarded to [control_opt_batch_ci()] when
`control_opt` is `NULL`.}
}
\value{
An object of class `ngme_batch_ci` with extra fields:
  `refit` (the SGD-refit model), `refit_control_opt`, and `refit_source`.
}
\description{
Run one additional SGD stage (warm-started from an existing `ngme` fit),
then compute Xi-style batch-means confidence intervals from the newly stored
trajectories.
}
