Pkg.add EcologicalNetworksDynamics
Using the Bioenergetic Food Web
Preamble: The Bioenergetic Food Web.
It is very worth pausing for a moment and looking at Delmas et al. (2017). It describes the BioEnergetic Food Web Model, provides some history of the model, and also showcases how the original Julia
version of the model worked. This section of the tutorials is designed to introduce a newer, faster and more flexible version of the Julia
package.
A very basic interpretation of the model is as follows:
- The model is a model of biomass dynamics, not numbers of individuals.
- The model is comprised of an equation for plants (producers) an equation for consumers (herbivores, predators).
- Plants have traits that make their biomass grow and sets their carrying capacity; they are eaten by consumers via an equation describing a functional response. To link to ecology courses you have, this can be logistic growth for the plant and a type II functional response.
- Consumer have three sets of traits. One is metabolism, which is a rate that describes losses of biomass due to, well, metabolism! The second set of traits correspond to the functional response - for example describing attack rates and handling times of prey items. The third corresponds to the numerical response, or the conversion of biomass they eat into new biomass (e.g. babies)
- We can make complex networks and systems of these equations by letting many of these parameters scale with body size via the rules of allometry and the Metabolic Theory of Ecology. This trick expands the two equations to n = number of species when we provide the toolbox with a list of species biomasses.
- Embedded in this process are rules about how to distribute species of different sizes across trophic levels, so that we end up with predators, omnivores, herbivores and plants. We can also designate the body size relationships for different groups of organisms, like producers, invertebrates, endothermic vertebrates and ectothermic vertebrates.
- Once we’ve done this, we can simulate the biomass dynamics of complex communities. And we can summarise things like changes in biodiversity (number of species), stability (coefficient of variation of the time series) and anything about the biomass of species, trophic levels or the community!
Preamble: Setup
One of main advantages of running food web models in Julia is that simulations are fast and can be readily stored in your active project. With this in mind, make a new folder in your project called out_objects
(right click > New Folder).
We will be using the EcologicalNetworksDynamics.jl
package (Lajaaiti et al. 2024) to implement the BEFW. Although we will go through and explain the functionality it may be useful to have both the preprint as well as the complete documentation on hand for more detailed explanations. You can install EcologicalNetworksDynamics
as you would any other normal Julia
package.
A first run using Ecological Networks Dynamics (END)
There are four major steps when running the BioEnergetic Food Web model in Julia. These should be familiar from our introduction to the DifferentialEquations
package:
- Generate an initial food web network
- Set the parameters for each species in the network to generate the equations
- Simulate the network and equations
- Explore output and plot
While in the previous example with Differential Equations
we assumed a simple 2-species network, one of the new activities here is to take advantage of a rich history of theory and tools to construct species rich networks with appropriate structural properties, such as connectance/complexity and levels of generalism/specialism and things the number of trophic levels and a body size distribution of the species across trophic levels.
Step 1: generate an initial network
## My first BEFW Modelling
## Packages I need
using DataFrames, Plots, Random, Distributions
using EcologicalNetworksDynamics
## Time to do some Experiments!
Here we make a foodweb, actually, a food chain, from an adjacency matrix using Foodweb
.
= [0 0 0; 1 0 0; 0 1 0] # 1 basal producer ⋅ Species 2 eats 1 ⋅ Species 3 eats 2
A = Foodweb(A) foodweb
Step 2: Generate the model parameters
Once the foodweb is created, the next step is to attribute values to the model parameters. This can be simply done by calling default_model
with foodweb as an argument.
# construct the equations and fixed parameters
# see below for body size dependent parameters etc
= default_model(foodweb) params
If we look at our params
object we can see that it has all the required parameters for the BEFW. Later in this tutorial you will see how we can access and modify these parameters.
Step 3: Simulate biomass dynamics
Everything is ready to run the simulation, which can be simply done by calling simulate with the model parameters (params) and a vector species’ initial biomass (B0).
# create body sizes for each species
= [0.5, 0.5, 0.5]
B0 # specify number of time steps
= 300
t
# use simulate function
# builds equations and uses DiffEq to run them!
= simulate(params, B0, t) sim
Step 4: Seeing the outputs!
To plot the time series, we can use the actual simulate
object directly.
plot(sim, label = ["Producer" "Consumer" "Top consumer";])
Eventually you may want to plot the biomass dynamics - the trajectory - of your community to see what is happening. For our minimal example, it can be done as follows:
# create multiple objects: time = t pulled from the sim.t component
# and Bx = biomass for each species pulled from the larger sim object
# note how julia allows multiple things on left of the =
= sim.t, sim[1,:], sim[2,:], sim[3,:] # unpack variables
t, B1, B2, B3
# Plot the basal species
plot(t, B1, lw = 3, label="Producer", xlabel = "Time", ylabel = "Biomass")
# add the herbivore
plot!(t, B2, lw = 3, label="Consumer")
# add the top predator
plot!(t, B3, lw = 3, label="Top consumer")
A More Complex Example
Step 1: Generate the initial network
In order to run the BEFW model with a more complex network, we have to construct an initial food web network (an adjacency matrix) using the niche model (Williams and Martinez 2000). The network is characterised by the number of species in the network and its connectance/complexity value.
Note that we are now using functionality provided by the EcologicalNetworks
package.
= 20 # define the number of species
S = 0.2 # define the connectance (complexity) of the network
C
# construct the food web
Random.seed!(12325) # ensures your network and this one are the same
= Foodweb(:niche; S = S, C = C) foodweb_niche
Step 2. Setting up the parameters, body masses (species) and running the model!
As above, our next step is to define a vector of bodymasses and then pass this, and the network to the simulate
function. Here we combine the Uniform
function from the Distributions package with the rand
function from the Random package.
# construct the equations and fixed parameters
# see below for body size dependent parameters etc
= default_model(foodweb_niche)
params_niche
# define bodymasses between 0 and 1 and get S = 20 of them.
# this will ensure your plot looks like the one in the document
Random.seed!(123)
= rand(S)
B0 = 300
t
# simulate using params and bodymasses
# note additional argument tmax for max time steps
# default is 300
= simulate(params_niche, B0, t) sim_niche
Step 3. Visualising the dynamics
Now we can move to plotting again. Note how we now ask for the time directly from the simulate object and all of the biomasses from that object as well.
Note too how we can suppress the legend (which covers some of the time series).
plot(sim_niche, legend = false)
One game to play now is to alter the bodymass distribution. rand
selects a random uniform number between 0 and 1. Can you figure out how to make the distribution uniform between 0 and 10? See what that does.
A bit more about the process: dissecting the ModelParameters
Let’s dissect the default_model
object a bit, to understand just a bit more about what is going on.
params_niche
Model (alias for EcologicalNetworksDynamics.Framework.System{<inner parms>}) with 17 components:
- Species: 20 (:s1, :s2, :s3, :s4, ..., :s20)
- Foodweb: 82 links
- Body masses: [396.6757314506745, 1000.0, 138.23722273578997, 150.62580571223663, ..., 1.0]
- Metabolic classes: [:invertebrate, :invertebrate, :invertebrate, :invertebrate, ..., :producer]
- GrowthRate: [·, ·, ·, ·, ..., 1.0]
- Carrying capacity: [·, ·, ·, ·, ..., 1.0]
- ProducersCompetition: 1.0
- LogisticGrowth
- Efficiency: 0.45 to 0.85.
- MaximumConsumption: [8.0, 8.0, 8.0, 8.0, ..., ·]
- Hill exponent: 2.0
- Consumers preferences: 0.07692307692307693 to 1.0.
- Intra-specific interference: [·, ·, ·, ·, ..., ·]
- Half-saturation density: [0.5, 0.5, 0.5, 0.5, ..., ·]
- BioenergeticResponse
- Metabolism: [0.0703591752903408, 0.05583797347522218, 0.09157425582526797, 0.08963029015067063, ..., 0.0]
- Mortality: [0.0, 0.0, 0.0, 0.0, ..., 0.0]
Walking through this
This section still reflects the old version of END structure and naming conventions
- The
network
component defines the food web and reports the number of species and the links - the
environment
component reports on values of the carrying capacity (K) and the baseline temperature (T
). Note that K is specified only for the basal species via[1, 1, ... nothing, nothing]
. All the producers have the same K at this point (1,1,1…). The presence of theT
suggests that we can ultimately work with climate change by running the model at different temperatures. There is a way to make some of the biorates and components of the functional response (see 3, 4) dependent not only on body mass, but also on temperature. - the
biorates
component contains detail on parameters central to making the model reflect a bit of reality:d
is …;r
is the intrinsic rate of increase (population growth rate) for the producers (plants);x
andy
are parameters associated with metabolic rates and consumption rates of the consumers (non-plant species). Finally,e
is an efficiency/assimilation rate for the consumers eating either plants or other animals. - the
functional_response
component defines the type of consumption function being used (e.g. Type I, II, or III sensu classic ecology and Holling). The functional response defines the interaction strength between species and how consumers change how much they eat dependent on the amount (density) of resource available.There are two options. The defaultBioenergetic Response
corresponds to a phenomenological formulation where there are just two variables that describe how consumer consumption varies with resource density: a half-saturation parameter and an asymptote. The alternative calledClassic Response
is more trait based and includes the parameters attack rate and handling time. There are several other features of the functional response that can be manipulated, and these are introduced in later tutorials. - the
producer_growth
details the default that all plants are growing logistically. - the
temperature response
componewnt defines the absence or presence of temperature dependence, and when present, the shape of the relationship between biorates and functional response parameters and temperature.
Helper Functions: What can we do with the outputs?
This section should be reviewed and revised by an END user who knows what we want to do with outputs.
As noted in the pre-amble, we are most often interested in additional information about the scenarios we build with the models. These include, for example, total biomass, biodiversity and stability. Let’s see how we can calculate some of these.
How long till steady state?
We can find out how long the simulations ran to reach steady state - remember that this is a deterministic model that typically reaches equilibrium for all species that survive.
size(sim_niche.t)
(51,)
Who went extinct and when?
Not a functionality in END.
We can also find out who went extinct, and when. You saw some of that detail, I hope, in the output of simulate
.
get_extinct_species(sim_niche)
Biomass, Diversity and Stability
First, we can get a measure of total biomass in the community, at equilibrium, and that of each species. Note how you can get the components too.
sim_niche.u
51-element Vector{Vector{Float64}}:
[0.906299638797481, 0.44349373245960455, 0.7456733811393941, 0.5120830400366143, 0.2538490889415096, 0.33415153638191886, 0.4273278808735992, 0.867547200255958, 0.09913361484360417, 0.12528740769155033, 0.6922086620547391, 0.13655147513745736, 0.03209667335274724, 0.3505458214588266, 0.9303323763821093, 0.9594335994071538, 0.5819123423876457, 0.3114475007050529, 0.12114752051812694, 0.20452981732035946]
[0.9169483131714715, 0.444402194534041, 0.7667640455857161, 0.5179071161683636, 0.25596644376248334, 0.3439614083570855, 0.42881389580038637, 0.8404857181508336, 0.10207349613818459, 0.12980979255930417, 0.7045585608788062, 0.14142469702894178, 0.033700254458592344, 0.35322775442579823, 0.9254383246584946, 0.8428424981719224, 0.5353929049386887, 0.2716712297929136, 0.11790964375471776, 0.20588623005171253]
[0.9372189186622565, 0.446138581295766, 0.8030805319662981, 0.5280429096670912, 0.25960285298532004, 0.36088969827160805, 0.43143000229873113, 0.7941678141517742, 0.107334065965393, 0.13803877097876832, 0.7224846396419364, 0.150274714852675, 0.03655779055568964, 0.35202356186576755, 0.8867871855452475, 0.6561325211685619, 0.45370991951901846, 0.21879863147029777, 0.1144327890249893, 0.21137607850479412]
[0.963419944890434, 0.4478457678502066, 0.8407656301021255, 0.5394619505769526, 0.26358620538619504, 0.3785307293750754, 0.43443524658702654, 0.7426580903726461, 0.11338938338304744, 0.1475698891121404, 0.7345099631141349, 0.16048747662896795, 0.03959434344670769, 0.3379755377009729, 0.7958692645000881, 0.48283669535781387, 0.36706195693003885, 0.17548000193294144, 0.1136592394878268, 0.22309854306314952]
[0.995616193064571, 0.44805738727466143, 0.8700643195894429, 0.5512240918443782, 0.2674989824178032, 0.3924051349926597, 0.4375425793363201, 0.6886449125246876, 0.11960335804730916, 0.15695502649258633, 0.7327878032629778, 0.17047486846995694, 0.0420936774665965, 0.3062032871443506, 0.6610340292426684, 0.34855000462048347, 0.2881369319293169, 0.14175624955652485, 0.11666389844136492, 0.24243967254676815]
[1.0331366869886944, 0.44448629343725343, 0.8788288901686566, 0.5620901047900512, 0.2708572048035862, 0.39695429480179645, 0.44018298027640984, 0.6333401253753693, 0.1252037789780579, 0.1640984843116221, 0.7114983769875807, 0.17795514254857084, 0.04354809380952039, 0.26092610308891634, 0.5154058541922188, 0.25624511921879434, 0.22330145420147088, 0.11586948470233616, 0.12436895504970236, 0.26962910331924905]
[1.0773089982155897, 0.43396923698721435, 0.8556572961992899, 0.5707904139404543, 0.2731983214483226, 0.38705755776238965, 0.4413794083264426, 0.57197930814629, 0.12978003467017415, 0.16724868374246712, 0.6675169557355778, 0.18101017312972054, 0.04388752925907648, 0.20909394578211202, 0.3805309865842198, 0.19230727005942244, 0.16943175281775166, 0.09443672996682428, 0.13906102138589269, 0.30741066949967055]
[1.1213743703927337, 0.4149870885160012, 0.7975741540831984, 0.5733620864984142, 0.2733077885606147, 0.36141676843558873, 0.4391552288251882, 0.5071960218562799, 0.13225598133704913, 0.1649144766546638, 0.6093837906327526, 0.17807037605762552, 0.04315159765633695, 0.1631734536430942, 0.2790930366914647, 0.15237925689592774, 0.12890880773111002, 0.0777317468581009, 0.16225155189984958, 0.35425475261372863]
[1.1573410183305781, 0.3875799067335869, 0.7122633234623346, 0.5656661531044221, 0.2699342224158771, 0.32362037390928877, 0.43151833519945715, 0.43980122366299085, 0.1320832740044849, 0.15754833392958092, 0.5485937790090555, 0.16967851768901068, 0.04155688582593655, 0.12670961646818607, 0.20790093579654878, 0.12919220653556573, 0.09920527144448085, 0.06511083602693121, 0.1957265685332169, 0.40863184877785175]
[1.1744909386178761, 0.35353525150930704, 0.6130415990319116, 0.5442924204781258, 0.2619765432579562, 0.2797239154423789, 0.41725964546931765, 0.3734718885747243, 0.12906194711831975, 0.14648620822639452, 0.49617455885534983, 0.15734180901650238, 0.039351964038387546, 0.0993990767009241, 0.15977668195469585, 0.1193453433823383, 0.07853078787521317, 0.05684848395648957, 0.23880211323157663, 0.46473430625333423]
[1.1636651009007108, 0.3155425241026375, 0.5129043599973696, 0.5086210124289895, 0.24908969960788688, 0.23553191470443982, 0.3966456636545259, 0.3124900352369809, 0.12355869405172261, 0.13330212010711523, 0.45885425946835634, 0.14280589051662543, 0.036833828434965285, 0.07940681588029759, 0.1280065867800307, 0.12159259236413968, 0.06534238144397321, 0.053601952458352684, 0.28528412637082984, 0.5126103913127859]
[1.1215900120487023, 0.2768216752264026, 0.42206636648520485, 0.46189135063482056, 0.23215126320140814, 0.19551978933588599, 0.37144587200796514, 0.26042387609908113, 0.11647562742120145, 0.11955373899209087, 0.4381554894529827, 0.1277697315605396, 0.034397853577932694, 0.06512710102028911, 0.10768752758342186, 0.13551750917697, 0.058102384679568894, 0.055907692857973916, 0.3220846544335181, 0.5412432565515389]
[1.051674472438156, 0.2396400556460993, 0.34499392466732914, 0.408962875223587, 0.21264909765819076, 0.16158429863184295, 0.3435589630316772, 0.2180232510648064, 0.10878792457246415, 0.10632571872188118, 0.43013574616355804, 0.11339063974249527, 0.03248700163555598, 0.055268908325187105, 0.0946316891444375, 0.1595784203240174, 0.05459709129704919, 0.0631635952778267, 0.33753068620574334, 0.5455404467088186]
⋮
[0.00032755644980272486, 0.00042642730013303957, 0.00024189593390109746, 3.1111688980955344e-5, 0.002186365444974394, 0.0001284836050334962, 0.009392611128074742, 0.2289263661082618, 0.027817843518977224, 0.00011632790937708126, 0.4448717546882417, 0.0001223774188672115, 0.198564855194196, 0.09669339044487263, 0.041438780171243736, 0.21624377256231636, 0.010260398961170272, 0.1106446052574405, 0.30895191650548376, 0.48344362584850714]
[0.0001996798247022266, 0.0003009378761392906, 0.00015346749983007282, 1.8190449427202614e-5, 0.0017884347223449826, 8.151473534424173e-5, 0.0077101296606787864, 0.23181199431785626, 0.025313811373776522, 7.379449257908107e-5, 0.44476144744230767, 7.763164111187508e-5, 0.19771575290544488, 0.0981753484444294, 0.0415237986113816, 0.21618611797874981, 0.010096001729578499, 0.1107711243020971, 0.3089588621965838, 0.4835526097023227]
[0.00011328126257715799, 0.0002025145740727682, 9.102676275323986e-5, 9.86615934389697e-6, 0.0014273867429624918, 4.834918126253599e-5, 0.006152674701416408, 0.2345821350465174, 0.022777702555973164, 4.3766536607882777e-5, 0.44485825775398713, 4.604210489119089e-5, 0.19677603845677671, 0.0996135511824476, 0.04163063947534051, 0.21611456663905765, 0.00992313898370846, 0.1108762739174712, 0.30896257460215903, 0.4836121681503955]
[6.07969185813491e-5, 0.00013150891522278353, 5.122984902532575e-5, 5.0559263528295375e-6, 0.0011197509119850043, 2.721092248119792e-5, 0.004805123705498752, 0.2371493862104039, 0.02034698607033935, 2.4630532478594332e-5, 0.44507776580317365, 2.591108561516969e-5, 0.19582059389086015, 0.10090484291104647, 0.04175110898630074, 0.21605866945798072, 0.009748297718843965, 0.1109547748500005, 0.308965762906422, 0.48361873148098766]
[2.9540113221979872e-5, 8.00347447973086e-5, 2.6268553079549285e-5, 2.3358462951272875e-6, 0.0008502538978690424, 1.3952641028662382e-5, 0.0036125895986525765, 0.23963412412998863, 0.017924696653654346, 1.2629101514971793e-5, 0.4453417610345992, 1.3285671319358326e-5, 0.19486664345382582, 0.10209874101875081, 0.041891604062307145, 0.2160237975426658, 0.00956208380761516, 0.11101835580249045, 0.3089707135225891, 0.48359145640506035]
[1.3166616427449579e-5, 4.60961582614326e-5, 1.241859399595492e-5, 9.875013357564836e-7, 0.0006289434801525733, 6.596183545884943e-6, 0.0026293723865516917, 0.24190491545204867, 0.015626334170708748, 5.970359692556319e-6, 0.44560575498650923, 6.280744324641365e-6, 0.19400924653479448, 0.10314206416955765, 0.04204857588531362, 0.2160007866180423, 0.009371522869382096, 0.11107366457263641, 0.3089769794039354, 0.48355133078668755]
[5.288582093742206e-6, 2.4853056623534485e-5, 5.32431964558186e-6, 3.7495755123700837e-7, 0.0004510237192764804, 2.8280327624688987e-6, 0.0018418173438047715, 0.24395924306889033, 0.013458321791607284, 2.559692577943294e-6, 0.44587256631997335, 2.692763414898462e-6, 0.19326957086896235, 0.10403490013949204, 0.04222157762263886, 0.21597907364688387, 0.009176377022194124, 0.11112583015368675, 0.30898347361961076, 0.4835073952384332]
[1.960571333984018e-6, 1.2748386630159753e-5, 2.115911956181734e-6, 1.3122771778296083e-7, 0.00031649230625780636, 1.1238747466059242e-6, 0.0012535673852407435, 0.2457433105385709, 0.011504652249667801, 1.0172301703560636e-6, 0.44612733302168156, 1.0701126911743665e-6, 0.19267165202271308, 0.1047507539103007, 0.04240100704365944, 0.21595925499391128, 0.008984468602875842, 0.11117426849212075, 0.30898978378818076, 0.48346305093339226]
[6.595296475377276e-7, 6.157495485353746e-6, 7.673573735587585e-7, 4.1573174269355544e-8, 0.0002163095240186386, 4.0758481170993133e-7, 0.0008246351715236552, 0.24730063052972948, 0.009744807150823888, 3.6890828571649465e-7, 0.4463589658982419, 3.880865976484553e-7, 0.19219749029253488, 0.10531819548561512, 0.042584771757986466, 0.21594251593637606, 0.008795235529894242, 0.11122083597743129, 0.3089962400343031, 0.48342085434013]
[2.0108052810226762e-7, 2.8004575219465937e-6, 2.5369560293790977e-7, 1.190656631256341e-8, 0.00014408987057401768, 1.3475139250220505e-7, 0.0005246117248146955, 0.24864251960077316, 0.008183727277329841, 1.2196446538994685e-7, 0.4465625705694917, 1.2830498581813105e-7, 0.19183327165148306, 0.10575941597710509, 0.04276848561656389, 0.21592768854223388, 0.008611086962690943, 0.11126649455166937, 0.30900276016604544, 0.4833835692529364]
[5.35850498787597e-8, 1.174593201709331e-6, 7.398752912499898e-8, 2.965192061208363e-9, 9.266705935747393e-5, 3.929875986723788e-8, 0.00031929137827090367, 0.24981133030734196, 0.006788855740405869, 3.556958190340493e-8, 0.4467437607797747, 3.7418723667047955e-8, 0.19155285868338037, 0.10610455981258715, 0.04295191471606665, 0.21591384077514106, 0.008430160333184566, 0.1113122756892104, 0.30900934087551246, 0.48335082223348647]
[3.2821854904203205e-8, 8.406671643638472e-7, 4.6640508998017896e-8, 1.7793663607263053e-9, 7.799523091116062e-5, 2.4773285240091262e-8, 0.0002627973314424048, 0.2502039748903548, 0.00631276636245039, 2.2422472598477954e-8, 0.4468055436036614, 2.358814075481337e-8, 0.19146688286657296, 0.10621159455428622, 0.04301932407939025, 0.21590899888568155, 0.008364030293673712, 0.11132929056683419, 0.3090117977250657, 0.4833397504740079]
# components
total_biomass(sim_niche)
51-element Vector{Float64}:
9.035052310145453
8.879184522388458
8.608521978391984
8.302235859798492
7.977752408265428
7.6479265310498565
7.293056293658903
6.933942335839723
6.569662630859385
6.203645482991124
5.835689949822736
5.4639327723474995
5.082524806480722
⋮
2.180830466139856
2.179270649906686
2.177861954789722
2.1766481390536
2.1755648676013255
2.174661007473904
2.1739250919601236
2.1733597626038192
2.1729302781639843
2.1726139439247745
2.172383095801758
2.172315739557126
Second, we can an estimate of species persistence - how many have gone extinct! Remember that we started with 20, so a value of 0.45 means that there are 12 species left.
# the percentage that persist
persistence(sim_niche)
51-element Vector{Float64}:
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
⋮
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
1.0
# quick calculation of number left (but see richness below!)
20*persistence(sim_niche) # the number left
51-element Vector{Float64}:
20.0
20.0
20.0
20.0
20.0
20.0
20.0
20.0
20.0
20.0
20.0
20.0
20.0
⋮
20.0
20.0
20.0
20.0
20.0
20.0
20.0
20.0
20.0
20.0
20.0
20.0
Third, we can look at measures of diversity. First, we can get species richness and a measure of diversity, using the Shannon index. This confirms that our persistence estimate (45%) is in line!
richness(sim_niche)
51-element Vector{Int64}:
20
20
20
20
20
20
20
20
20
20
20
20
20
⋮
20
20
20
20
20
20
20
20
20
20
20
20
shannon_diversity(sim_niche)
51-element Vector{Float64}:
15.838289686150633
15.938034479922063
16.062630873979742
16.120434078447378
16.08114076965578
15.938487296717936
15.697940272210305
15.410182133499104
15.107012611506958
14.810310060152338
14.548540861111752
14.364162310889597
14.284610563485106
⋮
8.172811865080977
8.1142305814134
8.05780958633494
8.006127953781233
7.956790341905648
7.911831829238024
7.87087151813162
7.835016456582986
7.803489117438748
7.776056823831216
7.751865699167424
7.743665633968
Section is no longer a built-in functionality in END. Alain should be able to address
Finally, we can look at stability - all built in metrics of stability are based on the coefficient of variation of species biomass. The CV is a measure of standardised variation - the standard deviation / mean It is not ‘stability’ in the strict mathematical sense, but an estimation of how variable the dynamics are.
defined as the average coefficient of variation estimated across all of the coefficients of variation for each species.
The master function is coefficient_of_variation
and delivers four results - Coefficient of Variation (CV) of community biomass and its partition into average species CV (community_cv
above), species mean CV and synchrony, along with the variation of each species; following Thibault & Connolly (2013):
coefficient_of_variation(sim_niche)
Note the warning…. do you understand what it’s talking about? Think about the extinctions detail above. You can follow the instructions, right?
coefficient_of_variation(sim_niche, last = 4)
You can get parts of this with specific helper functions, such as:
community_cv(sim_niche, last = 4)
What’s next
The next section will introduce how to create simulations where we work with multiple networks and collect data across these. We do this using loops, and collect information in a data frame. We then work on how to embed additional changes to parameters in the loops as well.