spaMM (version 1.9.16)

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

"simulate"(object, nsim = 1, seed = NULL, newdata=NULL, conditional=FALSE, verbose=TRUE, sizes=object$weights,...) "simulate"(object, nsim = 1, seed = NULL, newdata=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.
newdata
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.
conditional
Boolean, for development purposes. Currently only conditional simulation is handled.
verbose
Boolean; whether to print some information or not.
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.

Examples

Run this code
data(Loaloa)
HLC <- HLCor(cbind(npos,ntot-npos)~Matern(1|longitude+latitude),
           data=Loaloa,family=binomial(),
           ranPars=list(lambda=1,nu=0.5,rho=1/0.7)) 
simulate(HLC,nsim=2)

Run the code above in your browser using DataLab