ctOptimUncertainty: Update optimized ctsem uncertainty estimates

View source: R/stanoptimis.R

ctOptimUncertaintyR Documentation

Update optimized ctsem uncertainty estimates

Description

Recomputes the approximate raw-parameter uncertainty for an optimized ctFit object and refreshes the approximate raw-parameter samples.

Usage

ctOptimUncertainty(
  fit,
  uncertainty = c("hessian", "surrogate", "bootstrap", "fullbootstrap", "sandwich",
    "opg"),
  draws = c("auto", "normal", "empirical", "imis"),
  finishsamples = NULL,
  cores = NULL,
  control = list(),
  verbose = 0,
  ...
)

Arguments

fit

Optimized ctStanFit object.

uncertainty

Uncertainty approximation. 'hessian' uses the finite-difference Hessian, 'surrogate' fits a local quadratic surrogate around the optimum, 'bootstrap' uses one-step score bootstrap draws with Hessian bread, 'fullbootstrap' resamples subjects and fully re-optimizes each sample from the original maximum likelihood or MAP estimate using mize L-BFGS, 'sandwich' uses Hessian bread with score covariance meat, and 'opg' uses an OPG-style score information approximation.

draws

Approximate raw-parameter draw method. 'auto' uses empirical draws for uncertainty='bootstrap' and uncertainty='fullbootstrap' and normal draws otherwise. 'normal' draws from a multivariate normal using the selected covariance, 'empirical' uses empirical draws when available, and 'imis' runs the existing importance sampler using the selected covariance as proposal.

finishsamples

Number of approximate raw-parameter samples.

cores

Number of cores. Hessian, surrogate, and IMIS calculations use these cores by splitting each log-probability/gradient evaluation across subjects. Score-based methods use these cores for score contribution calculations. Transformed-quantity calculations also use these cores.

control

List of method-specific options. Useful entries include ridge, hessianStep, surrogateNpoints, surrogateScale, bootstrapFitCores, and bootstrapTol. When surrogateNpoints is omitted, the surrogate uses at least max(4 * npars, 50) local points and automatically filters/resamples points outside an internal local log-probability drop range. Score-based methods use subject-level score contributions when there are at least two subjects; single-subject models warn and use case-level contributions. Score-based methods warn when there are fewer than ten independent subjects or no more score rows than raw parameters. Full bootstrap requires at least two subjects and warns below ten independent subjects. Bootstrap-style methods require at least two returned samples / refits.

verbose

Integer controlling progress detail.

...

Unused.

Value

Updated ctStanFit object.


ctsem documentation built on June 30, 2026, 5:07 p.m.