Skip to contents

Conditional on the fitted parameters and posterior modes of the random effects, draws nsim new response vectors. Each draw uses the same linear predictor (fit$report$eta) and adds Gaussian residual noise with sd = exp(log_sigma_eps).

Usage

# S3 method for class 'gllvmTMB_multi'
simulate(
  object,
  nsim = 1,
  seed = NULL,
  newdata = NULL,
  condition_on_RE = FALSE,
  ...
)

Arguments

object

A gllvmTMB_multi fit.

nsim

Number of replicate response vectors to draw. Default 1.

seed

Optional RNG seed.

newdata

Optional new data frame; if supplied, predictions are computed at newdata and noise is drawn around them. The newdata must contain enough columns to rebuild the fixed-effects design and any random-effect grouping that was active.

condition_on_RE

Logical (default FALSE). When FALSE (the default), random effects are redrawn from the fitted covariance at every tier (rr_B, diag_B, rr_W, diag_W, phylo, spde) — the unconditional simulation appropriate for parametric bootstrap. When TRUE, the existing fitted RE modes are reused (the older glmmTMB-style conditional simulation that only adds Gaussian noise on top of fit$report$eta). Forced to TRUE when newdata is supplied (RE modes for unseen levels cannot be redrawn).

...

Currently unused.

Value

A matrix of dimension n_obs x nsim (or nrow(newdata) x nsim when newdata is supplied).