| species_mix.simulate | R Documentation | 
Simulate species mix data for model fitting.
species_mix.simulate(
  archetype_formula,
  species_formula,
  all_formula = NULL,
  data,
  offset = NULL,
  nArchetypes = 3,
  alpha = NULL,
  beta = NULL,
  gamma = NULL,
  delta = NULL,
  logTheta = NULL,
  powers = NULL,
  size = NULL,
  family = "bernoulli"
)
archetype_formula | 
 formula to simulate species_mix data, needs to have the format: cbind(spp1,spp2,spp3,...,sppN)~1 + x1 + x2  | 
species_formula | 
 formula to simulate species_mix species-specific responses, e.g: ~1  | 
all_formula | 
 formula to simulate biases in the data  | 
data | 
 a matrix of variables to simulate data from.  | 
offset | 
 used to offset sampling effort for abundance data (log link function).  | 
nArchetypes | 
 number of groups to simulate.  | 
alpha | 
 coefficients for each species archetype. vector S long.  | 
beta | 
 coefficients for each species archetype. Matrix of G x number of parameters. Each row is a different species archetype.  | 
gamma | 
 coefficients for each species archetype. Matrix of S x number of parameters. Each row is a different species archetype.  | 
delta | 
 coefficients for all_formula, these should describe overall biases in the dataset.  | 
logTheta | 
 coefficients for the dispersion variables for negative.binomial and gaussian distributions - should be number of species long and on the natural log scale.  | 
powers | 
 Is the power parameter for Tweedie distribution.  | 
size | 
 Is for the binomial model and this represents the number of binomial trials per site, can be fixed or vary.  | 
family | 
 Which statistical distribution to simulate data for. 'bernoulli','binomial', 'gaussian', 'ippm', 'negative.binomial' and 'poisson'.  | 
archetype_formula <- stats::as.formula(paste0('cbind(',paste(paste0('spp',
1:20),collapse = ','),")~1+x1+x2"))
species_formula <- stats::as.formula(~1)
beta <- matrix(c(-3.6,0.5,
                 -0.9,1.0,
                  0.9,-2.9,
                  2.2,5.4),
                4,2,byrow=TRUE)
dat <- data.frame(y=rep(1,100),
                  x1=stats::runif(100,0,2.5),
                  x2=stats::rnorm(100,0,2.5))
simulated_data <- species_mix.simulate(archetype_formula,species_formula,
                                       data=dat, nArchetypes = 4, beta=beta,
                                       family="bernoulli")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.