simulate_tapnet {tapnet}R Documentation

Creates a simulated along with all parameters, abundances, traits and phylogeny used

Description

Simulation function to produce a tapnet object, i.e. one or more networks along with their descriptors, abundances, traits, phylogenetic information

Usage

simulate_tapnet(
  nlower,
  nhigher,
  ntraits_nopem,
  ntraits_pem,
  pem_noise = 0.5,
  abuns = "lognormal",
  meanlog = 0,
  sdlog = 1,
  tmatch_type_pem = "normal",
  tmatch_type_obs = "normal",
  npems_lat = NULL,
  lat_low = 1,
  lat_high = 1,
  tmatch_width_pem = 1,
  pem_shift = 0,
  tmatch_width_obs = 1,
  Nwebs = 1,
  prop_species = 1,
  new_abuns = FALSE,
  Nobs = 1000
)

Arguments

nlower

species number in lower trophic level;

nhigher

species number in higher trophic level;

ntraits_nopem

number of phylogenetically uncorrelated traits (for each level);

ntraits_pem

number of phylogenetically correlated traits (for each level);

pem_noise

noise (sd of normal dist) to put on PEMs;

abuns

abundances set to "lognormal", "equal" or a list of two abundance vectors;

meanlog

parameters of the log-normal distribution for drawing abundances;

sdlog

same as before, but width;

tmatch_type_pem

type of trait matching function for latent traits;

tmatch_type_obs

type of trait matching function for observed traits (can be a vector as long as there are traits);

npems_lat

number of phylogenetic eigenvectors to be used to construct latent traits. If NULL, all eigenvectors will be used;

lat_low

vector of PEM linear combination parameters for lower trophic level; if 1, all values will be set to 1, if "random", values will be drawn from a uniform dist;

lat_high

same for higher trophic level;

tmatch_width_pem

width of trait matching function for latent (PEM-based) traits;

pem_shift

shift parameter for latent trait matching;

tmatch_width_obs

width of trait matching function for observed traits, can be a single value or a vector of length ntraits_nopem + ntraits_pem;

Nwebs

number of webs to be simulated;

prop_species

proportion of species in the phylogeny that appear in each web (species are drawn randomly). With multiple networks, this allows to create networks with partly overlapping species composition.

new_abuns

If abuns = "lognormal" and Nwebs > 1, should new abundances be drawn for each web?

Nobs

number of observed interactions per web

Details

This function was written to explore the fitting of networks by different methods. Hence, we first have to simulate such networks. It is a very nice starting point for simulations, but irrelevant for tapnet-based analyses. The function internally sets up all the parameters and then calls simnetfromtap for the simulation of the actual network. Lots of options means, regrettably, lots of decisions for the user.

Value

A tapnet object, with a highly nested structure. There are six entries at the top level: trees, traits_all, networks, sim_params and the two tmatch types. Within networks, there is a list of 5 entries (for each of the Nweb networks): abundances, traits, PEMs, web and I_mat. "I_mat" is the actual output from simnetfromtap, while "web" is a single draw from a multinomial distribution with I_mat as probabilities and Nobs as size.

Author(s)

Gita Benadi <gita.benadi@biom.uni-freiburg.de>, Jochen Fründ <jochen.fruend@biom.uni-freiburg.de> and Carsten Dormann <carsten.dormann@biom.uni-freiburg.de>

References

Benadi et al. in prep

Examples

tapnet <- simulate_tapnet(nlower=10, nhigher=20, ntraits_nopem=2, ntraits_pem=0) 
# a minimal call of simulate_tapnet
str(tapnet, 1) # the structure at the first level
str(tapnet, 2) # the structure at the first and second level


[Package tapnet version 0.3 Index]