timing: Timing Information for INLAvaan Models

timingR Documentation

Timing Information for INLAvaan Models

Description

Extract wall-clock timings for individual computation stages of a fitted INLAvaan model.

Usage

timing(object, ...)

## S4 method for signature 'INLAvaan'
timing(object, what = "total", ...)

Arguments

object

An object of class INLAvaan.

...

Currently unused.

what

Character vector of timing segment names to return, or "all" to return every segment. Defaults to "total". Available segments (depending on model options): "init" (which includes the lavaan model setup), "optim", "vb", "loglik", "marginals", "norta", "sampling", "covariances", "definedpars", "deltapars", "test", "loo", "waic", "total". The segments are disjoint and "total" is their sum. "loo" and "waic" are recorded only when the fit computed them, i.e. test (see inlavaan()) included "loo", "waic" or "full" and the model is supported (see loo()); requesting either otherwise gives an error explaining why, distinct from requesting a misspelled segment name.

Value

A named numeric vector (class c("timing.INLAvaan", "numeric")) of elapsed times in seconds. Printing formats short durations as seconds, longer ones as minutes or hours.

See Also

diagnostics(), summary()

Examples


HS.model <- "
  visual  =~ x1 + x2 + x3
  textual =~ x4 + x5 + x6
  speed   =~ x7 + x8 + x9
"
utils::data("HolzingerSwineford1939", package = "lavaan")
fit <- acfa(HS.model, HolzingerSwineford1939, std.lv = TRUE, nsamp = 100,
            test = "none", verbose = FALSE)

# Total elapsed time
timing(fit)

# All stages
timing(fit, what = "all")

# Specific stages
timing(fit, what = c("optim", "marginals"))



INLAvaan documentation built on Oct. 2, 2026, 1:07 a.m.