simulate.HLfit: Simulate realizations of a fitted mixed model.
Description
From an HLfit object, simulate.HLfit function generates new samples given the estimated fixed effects
and dispersion parameters.
This does not yet work for new locations in a mixed model involving both spatial and non-spatial random effects.
Usage
## S3 method for class 'HLfit':
simulate(object, nsim = 1, seed = NULL, newX=NULL, sizes=object$weights,...)
## S3 method for class 'HLfitlist':
simulate(object, nsim = 1, seed = NULL,
newX=object[[1]]$data, sizes=object[[1]]$weights,...)
Arguments
object
The return object of HLfit or similar function.
nsim
number of response vectors to simulate. Defaults to '1'.
seed
A seed for set.seed. If such a value is provided, the initial state of the random number generator at a global level
is restored on exit from simulate.
newX
A data frame closely matching the original data, except that response values are not needed. May provide new values of fixed predictor variables, new spatial locations, or new individuals within a block.
sizes
A vector of sample sizes to simulate in the case of a binomial fit. Defaults to the sizes in the original data.
...
further arguments passed to or from other methods.
Value
For the HLfitlist method (i.e., the result of a multinomial fit), a list of simulated responses.
Otherwise, a vector (if nsim=1) or a matrix with nsim columns, each containing a simulated response.