Control parameters for gllvmTMB()
Arguments
- d_B, d_W
Latent dimensions for the between-unit and within-unit reduced-rank components. Set to a positive integer to enable
latent()/unique()covariance structures at the corresponding tier.- spde_mode
"per_trait"(default) fits one independent SPDE field per trait when aspatial()term is present;"shared"fits one shared SPDE field with trait-specific scalar loadings.- n_init
Number of random-start replicates. Reduced-rank GLLVMs are often multimodal because the latent-factor likelihood has many equivalent local maxima; running several restarts with different starting values and keeping the fit with the lowest
-logLikreduces the risk of settling on a suboptimal solution. Default 1 (single fit). Increase to 5–10 for two-level rr models.- optimizer
One of
"nlminb"(default) or"optim". Use the latter together withoptArgsfor finicky two-level rr fits.- optArgs
A list of arguments passed to the optimiser. For
optimthe most useful islist(method = "BFGS").- init_jitter
Standard deviation of N(0, σ) jitter applied to the starting parameter vector across the
n_initrestarts. Default 0.3.- verbose
If
TRUE, prints a one-line summary per restart so the user can see which seed led to the winning fit. DefaultFALSE.- ...
Reserved for future use. Currently ignored with a warning.
Details
Recommended workflow for two-level latent models. Reduced-rank
likelihoods are notoriously multimodal in two-level fits like
value ~ 0 + trait + latent(0+trait|ID, d_B) + latent(0+trait|obs_ID, d_W).
The recommended workflow is:
Run several restarts (
n_init = 5to10) and keep the one with the lowest-logLik.If that fails to converge cleanly, switch the optimiser to
optimwithBFGS:gllvmTMBcontrol(optimizer = "optim", optArgs = list(method = "BFGS")).For very complex models, fit a simpler version first (e.g. drop one rr term) and warm-start the full fit by passing
start_from = simpler_fit(planned; not yet implemented).
The earlier start_method = "res" (gllvm-style residual seeding)
was tested empirically and does not improve two-level rr fits;
it is intended for non-Gaussian responses only.
