simulate.cord: Simulates new data from a given cord object

View source: R/cord_s3.R

simulate.cordR Documentation

Simulates new data from a given cord object

Description

Simulates new data from a given cord object

Usage

## S3 method for class 'cord'
simulate(object, nsim = 1, seed = NULL, newdata = object$obj$data, ...)

Arguments

object

is a cord object, e.g. from output of cord

nsim

Number of simulations, defaults to 1. If nsim > 1, the simulated data will be appended.

seed

Random number seed, defaults to a random seed number.

newdata

A data frame in which to look for X covariates with which to simulate.

...

not used Defaults to the X covariates in the fitted model.

Examples

abund = spider$abund

spider_mod_ssdm = stackedsdm(abund,~1, data = spider$x, ncores=2)
spid_lv_ssdm = cord(spider_mod_ssdm)
simulate(spid_lv_ssdm, nsim=2)


# using mvabund
library(mvabund) #for manyglm
abund=mvabund(abund)
spider_mod = manyglm(abund~1)
spid_lv = cord(spider_mod)
simulate(spid_lv)

spider_mod_X = manyglm(abund ~ soil.dry + bare.sand, data=spider$x)
spid_lv_X = cord(spider_mod_X)
Xnew = spider$x[1:10,]
simulate(spid_lv_X, newdata = Xnew)
simulate(spid_lv_X, nsim=2, newdata = Xnew)

spider_mod_X_ssdm = stackedsdm(abund, formula_X = ~. -bare.sand, data = spider$x, ncores=2)
spid_lv_X_ssdm = cord(spider_mod_X_ssdm)
simulate(spid_lv_X_ssdm, newdata = Xnew)


ecoCopula documentation built on March 18, 2022, 6:56 p.m.