Learn R Programming

spaMM (version 1.1)

simulate.HLfit: Simulate realizations of a fitted correlated mixed model.

Description

From an HLfit object, simulate.HLfit function generates new samples given the estimated fixed effects and dispersion parameters, and given the design matrix for random effects (hence, given the correlation parameters and spatial locations, if relevant). simulate.HLCor and simulate.corrHLfit are wrapper functions that extract from their respective input objects the HLfit object and apply simulate.HLfit to it.

Usage

## S3 method for class 'HLfit':
simulate(object, nsim = 1, seed = NULL, ...)
## S3 method for class 'HLCor':
simulate(object,...)
## S3 method for class 'corrHLfit':
simulate(object,...)

Arguments

object
The return object of an HLfit, HLCor or corrHLfit call.
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.
...
further arguments passed to or from other methods.

Value

  • 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