simulate.communityPGLMM: Simulate from a communityPGLMM object

View source: R/pglmm-utils.R

simulate.communityPGLMMR Documentation

Simulate from a communityPGLMM object

Description

Simulate from a communityPGLMM object

Usage

## S3 method for class 'communityPGLMM'
simulate(
  object,
  nsim = 1,
  seed = NULL,
  re.form = NULL,
  ntry = 5,
  full = FALSE,
  ...
)

Arguments

object

A fitted model object with class 'communityPGLMM'.

nsim

positive integer scalar - the number of responses to simulate.

seed

an optional seed to be used in set.seed immediately before the simulation so as to generate a reproducible sample.

re.form

(formula, NULL, or NA) specify which random effects to condition on when predicting. If NULL, include all random effects and the conditional modes of those random effects will be included in the deterministic part of the simulation (i.e Xb + Zu); if NA or ~0, include no random effects and new values will be chosen for each group based on the estimated random-effects variances (i.e. Xb + Zu * u_random).

ntry

Number of times to retry simulation in the case of NA values. Only applies to models fit with bayes = TRUE. If there are still NAs after ntry times, the simulated values will be returned (with NAs) with a warning. If you keep getting NAs try rerunning with full = TRUE, which simulates in a slower but more stable way.

full

If TRUE, and the model was fit using bayes = TRUE, then the simulation will be done with an approximation of the full joint posterior (rather than the marginal posterior, which is the default). This method is much slower but is often more stable, and is technically more accurate.

...

optional additional arguments (none are used in .simulateFormula)


daijiang/phyr documentation built on Feb. 25, 2024, 3:01 a.m.