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

Description Usage Arguments Examples

View source: R/cord_s3.R

Description

Simulates new data from a given cord object

Usage

1
2
## 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
abund = spider$abund
X = data.frame(spider$x)

spider_mod_ssdm = stackedsdm(abund,~1, data = 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=X)
spid_lv_X = cord(spider_mod_X)
Xnew = 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 = X, ncores=2)
spid_lv_X_ssdm = cord(spider_mod_X_ssdm)
simulate(spid_lv_X_ssdm, newdata = Xnew)

ecoCopula documentation built on Nov. 10, 2020, 3:50 p.m.