compute_ngme_ci: Refit an Existing ngme Object with SGD and Compute...

View source: R/batch-means.R

compute_ngme_ciR Documentation

Refit an Existing ngme Object with SGD and Compute Batch-Means CI

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.

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

fit

existing fitted 'ngme' object (can be obtained with any optimizer).

iterations

optimization iterations for the SGD CI stage.

alpha

Xi-style exponent used for both polynomial schedule and batch-means inference.

optimizer

optimizer for the CI stage; must be 'sgd(...)' for Xi theory.

burnin

burn-in iterations before SGD optimization.

n_batch

number of optimization checkpoints.

n_parallel_chain

number of parallel chains for SGD.

t0

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

start_sd

standard deviation for randomized chain initialization.

seed

random seed for CI-stage optimization.

verbose

logical; print optimization progress.

level

confidence level for CI.

name

parameter block for CI ('"all"', latent name, or '"general"').

M

number of retained Xi batches (excluding batch 0).

N

decorrelation constant in Xi batch boundaries.

apply_transform

logical; if 'TRUE', apply Post-delta transform after raw-space inference.

drop_burnin

logical; if 'TRUE', discard Xi batch 0.

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.

control_opt

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

...

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'.


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