metacommunity: Create a metacommunity

View source: R/community.R

metacommunityR Documentation

Create a metacommunity

Description

Create a metacommunity

Usage

metacommunity(
  nsp = 2,
  nr = 1,
  niches = niches_uniform,
  dispersal = dispersal_custom,
  sp_names = paste0("sp", 1:nsp),
  r_names = paste0("r", 1:nr),
  niche_args = list(),
  dispersal_args = list(),
  comp_scale = 0.001
)

Arguments

niches

The niche scenario to use.

dispersal

The dispersal scenario to use

sp_names

A vector of species names

r_names

A vector of resource names

niche_args

A list of named arguments to be passed to the niche function

dispersal_args

A list of named arguments to be passed to the dispersal function

comp_scale

Scale for the strength of competition, see 'details'.

Details

The metacommunity describes the possible biological space for a flume model. It consists of a few named elements:

  • species: a list of species() objects, describing the niche and dispersal parameters for each possible species

  • competition: A square species interaction matrix describing the effect of each species on each other species; generated using the overlap between species' fundamental niches.

  • boundary: A function that returns a site by species matrix giving the colonisation flux from outside the river network; by default returns zero for all sites/species.

The comp_scale is treated as a multiplier, changing the value of the competition matrix. By default the comp_scale parameter is 0.001. This parameter must be:

  • a single value, interpreted as the overall strength of competition in the metacommunity,

  • a vector of length nsp, interpreted as the competitive strength of each species, or

  • a matrix with nsp rows and nsp columns, if asymmetric competition or fine control over the strength of each interaction is desired. For asymmetric competition, changing the value of comp_scale[i,j] will change the effect of species i on species j, but not the other way around.

Each species' fundamental niche is defined as the difference between a Gaussian colonisation function and a constant extinction function; a species will be present when c - e > 0. Niches can be automatically generated (see generate_niches(); alternatively, to specify the parameters manually, the following can be specified.

Value

A metacommunity object

Examples


	# defaults
	mc = metacommunity()

	# multiple species
	mc = metacommunity(nsp = 5)

	# multiple resources
	nlim = list( location = matrix(c(1, 2, 1, 3, 2, 4), ncol = 2))  # we need to specify the limits manually
	mc = metacommunity(nsp = 3, nr=2, niches = niches_custom, niche_args = nlim)

	# multiple species and resources with variance covariance matrices
	loc = matrix(c(1, 2, 1, 3, 2, 4), ncol = 2) # 3 species, 2 resources
	br_sp1 = matrix(c(1, 0.2, 0.2, 1), ncol = 2) # vcv matrix for one species
	breadth = list(br_sp1, br_sp1, br_sp1) # assume the same matrix for all species
	
	nopts = list(location = matrix(c(1, 2, 1, 3, 2, 4), ncol = 2), breadth = breadth, scale_c = c(0.5, 0.5, 0.55))
   # location of the species along the resource space
   # breadth defines the resouce utilisation 
   # scale competition 
	
	mc = metacommunity(nsp = 3, nr = 2, niches = niches_custom, niche_args = nopts)
	plot(mc)


flee-group/flume documentation built on Jan. 29, 2024, 6:44 p.m.