A Matlab class that generates an ecological community assembly by adding species in function of their trophic relation.
The class in defined in the file NTCommunity.m which contain the Community constructor (master community). This community has a set of parameter that describe the interaction model of the Community.
Call:
NT_community(Tr,cp,fcp,mu,fmu,cm,fcm,am,fam,dnt,an,fan,rit,mit,fas,mnti,nbf,sg,sgd,tsp,msp,max_r,tr_cal,res,dr,bc)
The inputs defines model and interaction type of the community matrix, and conditions of the grow rates:
TrInput trophic matrix, can be define by the Generalized Niche Model Stouffer et. alTr_init.mcpFraction of added competitive interactions of the CommunityfcpForce of mutual interactions of the CommunitymuFraction of added mutual interactions of the CommunityfmuForce of competitive interaction of the CommunitycmFraction of added comensal interactions of the CommunityfcmForce of comensal interactions of the CommunityamFraction added of anmensal interactions of the CommunityfamForce of anmensal interactions of the CommunityanFraction of added trophic interaction of the Community (that aren't inTr)fanForce of added trophic interaction of the CommunitydntFunction for preferential added interaction position (normalized tropic level domain)ritRange (standard deviation) of the distance between interact species of added interactions, in units of normalized trophic level
mitMean of the distance between interact species of added interactions, in units of normalized trophic level
fasAsymmetric forcemntiCoefficients mean of added interactionsnbfNon basal diagonal factorsgNon diagonal values standard deviationsgdDiagonal values standard deviationtspNon-same interaction spending time factor (0 only same type spending , 1 all type spendig)mspOverall spendig time factor (1 non-spending time model, 0 Holling type-1 model)max_rMaximum value of grow-rate (imposition for LP-optimization)min_mortMinimum value of non basal grow-rate (imposition for LP-optimization)tr_calBool value to force resilience of the trophic initial community (tophic skeleton community)resResilience for the trophic initial community (iftr_calistrue)drRange of acceptance for resilience(resdr, iftr_calistrue)bcbasal Competition (bool value, that if it's true, add competition between basal species)
Our goal is analize the stablitiy and feasibility of matrix a bases dynamics ecology system model. Where the vector biomases a determined by:
Here is known as Community Matrix, and
as grow rate.
In first instance, initial tropic interactions are obtained form the Tr matrix, this will be defined as trophic skeleton. The number of species correspond to the
Tr matrix dimension. A requirement for Tr is to be fully connected. Interactions are added by type, proportional to values cp, mu, cm, am ,an according to the total connectance . The position of interactions are randomly choose proportional to an function depends on the trophic levels if the interacting species. This function correspond to:
where is the normalized trophic level (Livine) of species
,
correspond to the
dfn function (matlab @ call), and and
correspond to
mitand rit respectively. In the adding interactions process, the basal species of Tr are preserved. Finally the bool value bc add competition between basal species.
The non-diagonal community matrix coefficients are defined by holling type I model:
is the set of all connected species with
(that interact with
), and
is the set of species that have same type interaction of
with
considering this,
tp and
msp. Coefficients and
are random generated from an beta distribution multiplied by an median factor:
with
, here
mnti and
sg. In case that is a predation interacion,
.
are force of interacion, this values are taken form
fcp,fmu, fcm, fam and fan. Interactions that belongs to the Tr matrix don't have force factor.
The diagonal elements of community matrix are randomly genereted by normal distribution with mean one and standard deviation =
sgd: . We add an bool variable
nbf that makes diagonal values for basal species zero.
Our aim is to have local stability of the community. For this it's necessary that the biomasses change rate be cero, i.e.:
so we have:
represents stability point of biomasses. At this point we have freedom of choise for the grow rates
and so
(biomasses), due there are related by lineal transformation. To solve this, we search the feasibility via an LP-optimization that maximize the minimal of biomasses
, holding the related equality, boundig the grow rates via a Chebyshov norm,
and lower bound non-basal grow rates
. Here
min_mort and
max_r.
Resilience is equal to minus the maximum eigenvalue of the Jacobean evaluated at the stability point :
So, if then the community is locally stable, if
then is locally unstable.
We first calculate the resilience and feasibility of the trophic skeleton community matrix, associated to their interactions (without considering added interactions). If tr_cal = true the program it will calculate resilience until
res
dr is reached (this step it's a little tricky because it enters in a while loop, and the program maybe can't exit the loop. It's better use tr_cal=false). After this, the rest interactions are adeed and feasibility and resilience calculated.
The output constitute a structure that contain a set of properties and variables that builds the community, The strucutre is sparatre by type data:
adjAdjoint matrix of the communitycomCommunity matrix ()
trTrophic matrixtr_iTrophic skeletontpType interaction matrixcoef_Cmatrix coeficients
coef_bmatrix coeficients
NvTrophic levels vector () Livine
espSpecies index vectorXBiomasses vector at stability ()
RGrow rate vector ()
kVector of percentage of interaction Wootton & Stoufferk_pVector of percentage of positive interaction Wootton & Stoufferk_mVector of percentage of negative interaction Wootton & StouffermVector of mean population interaction strength Wootton & Stoufferm_pVector of mean positive population interaction strength Wootton & Stoufferm_mVector of mean negative population interaction strength Wootton & StoufferaVector of mean percapita interaction strength Wootton & Stouffera_pVector of mean percapita population interaction strength Wootton & Stouffera_mVector of mean percapita population interaction strength Wootton & Stouffer
cpPorcentage of competitive interactionsmuPorcentage of mutual interactionsamPorcentage of amensal interactionscmPorcentage of comensal interactionsanPorcentage of trophic interactionsresCommunity resilience ()
res_trTrophic skeleton community resilence ()
conCommunity connectancecon_trTrophic skeleton community connectancemeAverage total interaction faced for one species Barbier & Arnoldime_trAverage total interaction faced for one species of trophic skeleton community Barbier & ArnoldigamaCarring capacity deviation Barbier & ArnoldivarTotal interaction deviation faced for one species Barbier & Arnoldivar_trTotal interaction deviation faced for one species of trophic skeleton community Barbier & Arnoldietareciprocal interaction effect Barbier & Arnoldieta_trreciprocal interaction effect of trophic skeleton community Barbier & Arnoldibasnumber of basal species of the communityLminimal of biomassesL_trminimal of biomasses of the trophic skeleton community
mstTrue if community is a aster one (first constructed)estTrue if community is locally stableFTrue if community is feasiblebcTrue if there are competition between basal species
Call: Sc=NT_SubComunity_init_Links(C,S)
SNumber of desire species on sub-communityCMaster community Class object
Constructions of sub-community starts from the master community (first initialized community). The process of assembly begins by taking an basal species. Once achieved this, candidates to add are direct predators of present species or new basal ones. This algorithm iterates until the S species are reached. The grow rates of the sub-community are directly taken from the master community C grow rates, as a subset of the present species. Sub-Community matrix is constructed in the same way as the master community, but only considering the susbet species in the sub-community. Then biomasses is calculated via the known lineal transformation () and finally all other properties (resilience, min of biomasses, etc.).
Returns a class object as constructor NT_community
Call: Sc=NT_SubComunity_add_Links(Si,C,S)
SNumber of desire species to addCMaster community Class objectSiSub-community Class object
Constructor of sub-community starting of the sub-community Si adding S desired species from master community C.
Has the same procedure as NT_SubCommunity_init_Links
Returns a class object as constructor NT_community