Simulate from a communityPGLMM object
# S3 method for communityPGLMM
simulate(
object,
nsim = 1,
seed = NULL,
re.form = NULL,
ntry = 5,
full = FALSE,
...
)
A fitted model object with class 'communityPGLMM'.
positive integer scalar - the number of responses to simulate.
an optional seed to be used in set.seed
immediately before the simulation so as to generate a reproducible sample.
(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).
Number of times to retry simulation in the case of NA
values. Only applies
to models fit with bayes = TRUE
. If there are still NA
s after ntry
times, the
simulated values will be returned (with NA
s) with a warning. If you keep getting NA
s try
rerunning with full = TRUE
, which simulates in a slower but more stable way.
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
)