Learn R Programming

SpeciesMix (version 0.3.4)

artificial.data: Create an artificial data set

Description

artificial.data creates an artifical data set of multispecies presence absence data based on a binomial response

Usage

artificial.data(formula,data,theta,S,dist="bernoulli")

Arguments

formula
an object of class "formula" (or one that can be coerced to that class):a symbolic description of the model to be fitted
data
a data frame containing the variables in the formula
theta
coefficents for each species archetype. Matrix of G x number of parameters. Each row is a different species archetype.
S
number of species to create
dist
The distribution to sample from, "bernoulli" gives presence/absence (default), "negbin" gives abundances. For negbin, intercepts are chosen at random from -5 to 5, theta held at 1.

Value

Authors

Piers Dunstan and Scott Foster

Details

each species is a random realisation of the archetype species

Examples

Run this code
## for bernoulli
theta <- matrix(c(-0.9,-0.6,0.5,1,-0.9,1,0.9,-0.9),4,2,byrow=TRUE)
dat <- data.frame(y=rep(1,100),x=runif(100,0,2.5))
dat1 <- artificial.data(y~1+x,dat,theta,20)
## for negbin
theta <- matrix(c(-0.9,-0.6,0.5,1,-0.9,1,0.9,-0.9),4,2,byrow=TRUE)
dat <- data.frame(y=rep(1,100),x=runif(100,0,2.5))
dat1 <- artificial.data(y~1+x,dat,theta,20,dist="negbin")

Run the code above in your browser using DataLab