Skip to content

Commit f8dd561

Browse files
authored
Merge pull request #19 from hanamayall/patch-1
Update 10_complex_experiments_end.qmd
2 parents 9feee93 + fa6fac6 commit f8dd561

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

10_complex_experiments_end.qmd

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,9 @@ Could you modify this to ask about the interaction between Z and K? This would
378378

379379
Our final experiment for this section involves manipulating how the basal producers compete with each other. The default paramterisation of the model has each producer growing via the logistic equation and competing with itself via density dependence. There is only intraspecific competition, no interspecific competition.
380380

381-
We can modify this assumption by invoking another function called `ProducerCompetition`. This function acts like `Environment` that we use to set `K` and `BioenergeticResponse` that we used to modify the functional response between Type II and Type III.
381+
We can modify this assumption by invoking another function called `ProducerCompetition`. This function acts like `LogisticGrowth` that we use to set `K` and `BioenergeticResponse` that we used to modify the functional response between Type II and Type III.
382382

383-
The theory to recall is that coexistence among species is mediated by the balance between intraspecific and interspecific competition. When intraspecific competition is greater than interspecific competition, there is coexistence. However, when interspecific competition is greater than intraspecific competition, there will be compeitive exclusion and no coexistence.
383+
The theory to recall is that coexistence among species is mediated by the balance between intraspecific and interspecific competition. When intraspecific competition is greater than interspecific competition, there is coexistence. However, when interspecific competition is greater than intraspecific competition, there will be competitive exclusion and no coexistence.
384384

385385
We call the competition parameters $\alpha$. $\alpha~ii$ defines intraspecific competition and $\alpha~ij$ defines interspecific competition. The $\alpha~ij$ defines how the species $j$ reduces the carrying capacity (equilibrium) of species $i$.
386386

@@ -393,14 +393,15 @@ What we can do is set $\alpha~ii = 1$ and then vary $\alpha~ij$ from $<1$ to $>1
393393
S = 20 # define the number of species
394394
C = 0.2 # define the connectance (complexity) of the network
395395
Z = 100 # Predator Prey Mass Ratio
396+
t = 300 # time steps
396397
397398
# here we set the
398399
interspecific_vals = 0.8:0.05:1.2 # a set of (9) values between 0.8 and 1.2 in steps of 0.05
399400
# collect(0.8:0.05:1.2) # see them if you want to
400401
401402
402403
# set collecting data frame
403-
# we will look at how Richness, Biomass and Stability are affected by the hill exponent
404+
# we will look at how Richness, Biomass and Shannon Diversity are affected by interspecific competition
404405
df_collect_comp = DataFrame(InterComp = [], FinalRichness = [], FinalBiomass = [], ShannonDiversity = [])
405406
406407
for alpha_ij in interspecific_vals
@@ -411,30 +412,31 @@ for alpha_ij in interspecific_vals
411412
foodweb = Foodweb(:niche; S = S, C = C, Z = Z)
412413
413414
# enhance detail in the network
414-
# specify K
415-
LogisticGrowth(foodweb; K = 10)
416-
# we fix intraspecific = 1 and vary interspecific
417-
ProducerCompetiton(foodweb; αii = 1.0, αij = 1)
418-
# set the hill exponent to 1 (type II Functional Response)
419-
BioenergeticResponse(foodweb, h = 1)
415+
#We fix intraspecific = 1 (diag) and vary interspecific (off)
416+
p = ProducersCompetition(foodweb; diag = 1.0, off = alpha_ij)
417+
#Specify K and competition in LogisticGrowth
418+
r = LogisticGrowth(K = 10, producers_competition = p)
419+
420+
#Set the hill exponent to 1 (type II Functional Response)
421+
b = BioenergeticResponse(h = 1)
420422
421-
# define parameters with extras
422-
params_comp = default_model(foodweb, BodyMass(; Z = z))
423+
#Define parameters with extras
424+
params_comp = default_model(foodweb, BodyMass(; Z = Z), b, r)
423425
424-
# set bodymass
426+
# set initial biomasses
425427
B0 = rand(S)
426428
427429
# simulate
428430
# note verbose = false ; remove this to see extinction detail for each sim
429-
out_comp = simulate(params_comp, B0, verbose = false)
431+
out_comp = simulate(params_comp, B0, t, verbose = false)
430432
431433
# generate stats and add to collector
432434
# collect data
433435
fin_rich = richness(out_comp)
434-
fin_bio = biomass(out_comp).total
435-
stab = community_cv(out_comp)
436+
fin_bio = total_biomass(out_comp)
437+
s_div = shannon_diversity(out_comp)
436438
437-
push!(df_collect_comp, [alpha_ij, fin_rich, fin_bio, stab])
439+
push!(df_collect_comp, [alpha_ij, fin_rich, fin_bio, s_div])
438440
end
439441
440442
df_collect_comp
@@ -451,8 +453,8 @@ p1 = @df df_collect_comp plot(:InterComp, [:FinalRichness],
451453
p2 = @df df_collect_comp plot(:InterComp, [:FinalBiomass],
452454
ylabel = "Biomass",
453455
xlabel = "alpha_ij")
454-
p3 = @df df_collect_comp plot(:InterComp, [:FinalStability],
455-
ylabel = "Stability",
456+
p3 = @df df_collect_comp plot(:InterComp, [:ShannonDiversity],
457+
ylabel = "Shannon Diversity",
456458
xlabel = "alpha_ij")
457459
458460
plot(p1, p2, p3, layout = (3,1), legend = false)
@@ -462,11 +464,11 @@ plot(p1, p2, p3, layout = (3,1), legend = false)
462464

463465
Perhaps consider expanding the code above to assess one of these?
464466

465-
Is this pattern sensitive to specie richness?
467+
Is this pattern sensitive to species richness?
466468
Is this pattern sensitive to the functional response?
467469
Is this pattern sensitive to the PPMR?
468470
Is this pattern sensitive to values of K?
469471

470472
## Experiment 5: Multiple networks (replicates)
471473

472-
To Do: run S (3 values), C (3 values) and h (3 values) where there are 5 replicate networks per combination. Note we need 45 networks...
474+
To Do: run S (3 values), C (3 values) and h (3 values) where there are 5 replicate networks per combination. Note we need 45 networks...

_freeze/10_complex_experiments_end/execute-results/html.json

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)