-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCoral_Reef_Model_Markdown.Rmd
369 lines (284 loc) · 14.3 KB
/
Coral_Reef_Model_Markdown.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
---
title: "BIOL 381_ Coral Reef Model"
author: "Gavin Briske, Matt Futia, Liza Morse"
date: "10/14/2020"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(ggplot2)
library(reshape2)
library(dplyr)
```
**Part A**
![Individual flow diagram representing societal factors that influence the willingness of the public to participate in coral reef conservation.](C:/Users/mttft/Desktop/UVM/UVM Courses/Quant Reasoning/Coral_Reef_Model/SimpleModel_Futia.png)
![Team flow diagram representing societal factors that influence the willingness of the public to participate in coral reef conservation.](C:/Users/mttft/Desktop/UVM/UVM Courses/Quant Reasoning/Coral_Reef_Model/Case Study Flow Chart.png)
```{r}
require(deSolve)
Time = seq(0,50,0.1)
# Scenario 1: C = 0.8, P = 0.5
Pars = c(kappa = 1.014, j = 1.68, sigma = 0.5, phi = 0.2, C = 0.8, P = 0.55)
social_model <- function(Time, State, Pars) {
with(as.list(c(State, Pars)), {
dX <- kappa*X*(1 - X)*(-1 + j*(1 - C) - sigma*P*(1 - X) + phi*(2*X - 1))
list(c(dX))
})
}
State = c(X = 0.2)
out.2 = data.frame(ode(y = State, times = Time, func = social_model, parms = Pars))
out.2$Initial = 0.2
State = c(X = 0.5)
out.5 = data.frame(ode(y = State, times = Time, func = social_model, parms = Pars))
out.5$Initial = 0.5
State = c(X = 0.8)
out.8 = data.frame(ode(y = State, times = Time, func = social_model, parms = Pars))
out.8$Initial = 0.8
out = rbind(out.2, out.5, out.8)
# Scenario 2: C = 0.8, P = 5
Pars2 = c(kappa = 1.014, j = 1.68, sigma = 0.5, phi = 0.2, C = 0.8, P = 5)
social_model2 <- function(Time, State, Pars2) {
with(as.list(c(State, Pars2)), {
dX <- kappa*X*(1 - X)*(-1 + j*(1 - C) - sigma*P*(1 - X) + phi*(2*X - 1))
list(c(dX))
})
}
State = c(X = 0.2)
out.2 = data.frame(ode(y = State, times = Time, func = social_model2, parms = Pars2))
out.2$Initial = 0.2
State = c(X = 0.5)
out.5 = data.frame(ode(y = State, times = Time, func = social_model2, parms = Pars2))
out.5$Initial = 0.5
State = c(X = 0.8)
out.8 = data.frame(ode(y = State, times = Time, func = social_model2, parms = Pars2))
out.8$Initial = 0.8
out2 = rbind(out.2, out.5, out.8)
# Scenario 3: C = 0.8, P = 100
Pars3 = c(kappa = 1.014, j = 1.68, sigma = 0.5, phi = 0.2, C = 0.8, P = 100)
social_model3 <- function(Time, State, Pars3) {
with(as.list(c(State, Pars3)), {
dX <- kappa*X*(1 - X)*(-1 + j*(1 - C) - sigma*P*(1 - X) + phi*(2*X - 1))
list(c(dX))
})
}
State = c(X = 0.2)
out.2 = data.frame(ode(y = State, times = Time, func = social_model3, parms = Pars3))
out.2$Initial = 0.2
State = c(X = 0.5)
out.5 = data.frame(ode(y = State, times = Time, func = social_model3, parms = Pars3))
out.5$Initial = 0.5
State = c(X = 0.8)
out.8 = data.frame(ode(y = State, times = Time, func = social_model3, parms = Pars3))
out.8$Initial = 0.8
out3 = rbind(out.2, out.5, out.8)
# Scenario 4: C = 0.4, P = 0.5
Pars4 = c(kappa = 1.014, j = 1.68, sigma = 0.5, phi = 0.2, C = 0.4, P = 0.5)
social_model4 <- function(Time, State, Pars3) {
with(as.list(c(State, Pars3)), {
dX <- kappa*X*(1 - X)*(-1 + j*(1 - C) - sigma*P*(1 - X) + phi*(2*X - 1))
list(c(dX))
})
}
State = c(X = 0.2)
out.2 = data.frame(ode(y = State, times = Time, func = social_model4, parms = Pars4))
out.2$Initial = 0.2
State = c(X = 0.5)
out.5 = data.frame(ode(y = State, times = Time, func = social_model4, parms = Pars4))
out.5$Initial = 0.5
State = c(X = 0.8)
out.8 = data.frame(ode(y = State, times = Time, func = social_model4, parms = Pars4))
out.8$Initial = 0.8
out4 = rbind(out.2, out.5, out.8)
p1 = ggplot(out, aes(x = time, y = X)) +
geom_line(out, mapping = aes(time, X, color = as.character(Initial)), size = 1.5) +
labs(x = 'Time', y = "Proportion willing to participate", color = "Initial proportion") +
theme_classic() +
theme(legend.position = c(.8, .5),
axis.title.y = element_text(margin = margin(t = 0, r = 10, b = 0, l = 0)))+
scale_x_continuous(expand = c(0,0)) +
scale_y_continuous(breaks = seq(0,1,0.2)) +
annotate("text", x = 6, y=1, label = "Scenario 1", size = 6) +
theme(text = element_text(size = 20))
p2 = ggplot(out2, aes(x = time, y = X)) +
geom_line(out2, mapping = aes(time, X, color = as.character(Initial)), size = 1.5) +
labs(x = 'Time', y = "", color = "Initial proportion") +
theme_classic() +
theme(legend.position = c(.8, .5),
axis.title.y = element_text(margin = margin(t = 0, r = 10, b = 0, l = 0)))+
scale_x_continuous(expand = c(0,0)) +
scale_y_continuous(breaks = seq(0,1,0.2)) +
annotate("text", x = 6, y=1, label = "Scenario 2", size = 6) +
theme(text = element_text(size = 20))
p3 = ggplot(out3, aes(x = time, y = X)) +
geom_line(out3, mapping = aes(time, X, color = as.character(Initial)), size = 1.5) +
labs(x = 'Time', y = "Proportion willing to participate", color = "Initial proportion") +
theme_classic() +
theme(legend.position = c(.8, .5),
axis.title.y = element_text(margin = margin(t = 0, r = 10, b = 0, l = 0)))+
scale_x_continuous(expand = c(0,0)) +
scale_y_continuous(breaks = seq(0,1,0.2)) +
annotate("text", x = 6, y=1, label = "Scenario 3", size = 6) +
theme(text = element_text(size = 20))
p4 = ggplot(out4, aes(x = time, y = X)) +
geom_line(out4, mapping = aes(time, X, color = as.character(Initial)), size = 1.5) +
labs(x = 'Time', y = "", color = "Initial proportion") +
theme_classic() +
theme(legend.position = c(.8, .5),
axis.title.y = element_text(margin = margin(t = 0, r = 10, b = 0, l = 0)))+
scale_x_continuous(expand = c(0,0)) +
scale_y_continuous(breaks = seq(0,1,0.2)) +
annotate("text", x = 6, y=1, label = "Scenario 4", size = 6) +
theme(text = element_text(size = 20))
```
```{r, fig.show = "hold", out.width = "45%", fig.cap = "Proportion of people willing to participate in coral reef conservation over time with three different initial starting proportions (0.2, 0.5, and 0.8) across four scenarios. Scenarios differ based on live coral cover (Scenario 1, 2 and 3: 0.8; Scenario 4: 0.4) and parrotfish abundance (Scenarios 1 and 4: 0.5; Scenario 2: 5; Scenario 3: 100).", fig.align = "center"}
par(mfrow = c(2,2))
p1
p2
p3
p4
```
```{r}
Table1 = data.frame(matrix(nrow = 6, ncol = 3))
colnames(Table1) = c("Parameter", "Description", "Value")
Table1$Parameter = c("$\\kappa$", 'j', 'C', 'P', "$\\sigma$", "$\\phi$")
Table1$Description = c("Interactions with others", "Sensitivity to dead coral", "Live coral cover", "Parrotfish abundance", "Fishing pressue", "Public pressure")
Table1$Value = c("1.014/y", "1.68", "a", "b", "0.5", "0.2")
```
```{r comment = '', echo = F, results = 'asis'}
knitr::kable(Table1, caption = "Model parameter symbols, description, and estimated parameter values.")
```
Based on the four scenarios, long-term results from this model result in either complete or absent willingness to participate in coral reef conservation. The ultimate outcome of the model depends on amount of live coral, parrotfish abundance, and the initial proportion of individuals willing to participate; high initial support for conservation with low abundance of live coral and low parrotfish abundance results in increased support for conservation. If any of these conditions are not met, the outcome will always result in no support for conservation.
**Part B**
![Team flow diagram representing ecological and societal factors that influence coral reef conservation.](C:/Users/mttft/Desktop/UVM/UVM Courses/Quant Reasoning/Coral_Reef_Model/Eco_SocioFlowChart.png)
By including both the ecological and social components in our model, we predict the model will be more complex with the direction of the curve (i.e., positive or negative) changing more frequently. In addition, we predict coral, willingness to participate, and macroalgae are likely the most important paramaters for determining overall system dynamics since those are the three things tied together with just one interaction arrow. With the other parameters, the interactions between them can be positive or negative or they have a complicated feedback loop with unknown causes.
```{r}
coupled_model = function(Time, State, Pars) {
with(as.list(c(State, Pars)), {
dM = a*M*C - (P*M)/(M+T) + gamma*M*T
dC = r*T*C - d*C - a*M*C
dT = (P*M)/(M+T) - gamma*M*T - r*T*C + d*C
dP = s*P*(1 - P/C) - sigma*P*(1 - X)
dX = kappa*X*(1 - X)*(-1 + j*(1 - C) - sigma*P*(1 - X) + phi*(2*X - 1))
return(list(c(dM,dC,dT,dP,dX)))
})
}
pars = c(a = 0.1, gamma = 0.8, r = 1.0, d = 0.44, s = 0.49, sigma = 0.5, kappa= 1.014, j=1.68, sigma = 0.5, phi = 0.2)
times = seq(0, 100, by = 0.1)
# Scenario 1: M = 0.05, C = 0.9, T = 0.05, P = 0.4, X = 0.5
yini1 = c(M = 0.05, C = 0.9, T = 0.05, P = 0.4, X = 0.5)
out_total1 = data.frame(ode(yini1, times, coupled_model, pars))
final1 = melt(out_total1, id.vars = "time")
final_eco1 = filter(final1, variable != "X")
final_cons1 = filter(final1, variable == "X")
# Scenario 2: M = 0.05, C = 0.3, T = 0.05, P = 0.4, X = 0.5
yini2 = c(M = 0.05, C = 0.3, T = 0.05, P = 0.4, X = 0.5)
out_total2 = data.frame(ode(yini2, times, coupled_model, pars))
final2 = melt(out_total2, id.vars = "time")
final_eco2 = filter(final2, variable != "X")
final_cons2 = filter(final2, variable == "X")
# Scenario 3: M = 0.05, C = 0.9, T = 0.3, P = 0.4, X = 0.5
yini3 = c(M = 0.05, C = 0.9, T = 0.3, P = 0.4, X = 0.5)
out_total3 = data.frame(ode(yini3, times, coupled_model, pars))
final3 = melt(out_total3, id.vars = "time")
final_eco3 = filter(final3, variable != "X")
final_cons3 = filter(final3, variable == "X")
# Scenario 4: M = 0.05, C = 0.9, T = 0.05, P = 50, X = 0.5
yini4 = c(M = 0.05, C = 0.9, T = 0.05, P = 50, X = 0.5)
out_total4 = data.frame(ode(yini4, times, coupled_model, pars))
final4 = melt(out_total4, id.vars = "time")
final_eco4 = filter(final4, variable != "X")
final_cons4 = filter(final4, variable == "X")
# Scenario 5: M = 0.05, C = 0.9, T = 0.05, P = 0.4, X = 0.8
yini5 = c(M = 0.05, C = 0.9, T = 0.05, P = 0.4, X = 0.8)
out_total5 = data.frame(ode(yini5, times, coupled_model, pars))
final5 = melt(out_total5, id.vars = "time")
final_eco5 = filter(final5, variable != "X")
final_cons5 = filter(final5, variable == "X")
# Scenario 6: M = 0.6, C = 0.9, T = 0.05, P = 0.4, X = 0.5
yini6 = c(M = 0.6, C = 0.9, T = 0.05, P = 0.4, X = 0.5)
out_total6 = data.frame(ode(yini6, times, coupled_model, pars))
final6 = melt(out_total6, id.vars = "time")
final_eco6 = filter(final6, variable != "X")
final_cons6 = filter(final6, variable == "X")
par(mfrow=c(1,2))
eco_graph = function(data,i){
ggplot(data, aes(x = time, y = value)) +
geom_line(data, mapping = aes(time, value, color = variable)) +
theme_classic() +
theme(legend.position = c(0.8, 0.75)) +
ylab("Relative Cover") +
scale_x_continuous(expand = c(0,0)) +
annotate("text", x = 4, y = max(data$value), label = i, size = 6) +
theme(text = element_text(size = 20))
}
conserve_graph = function(data, t){
ggplot(data, aes(x = time, y = value)) +
geom_line(data, mapping = aes(time, value, color = variable)) +
theme_classic() +
ylab("Fraction that are conservationists") +
theme(legend.position = "none") +
scale_x_continuous(expand = c(0,0)) +
annotate("text", x = 4, y = 1, label = t, size = 6) +
theme(text = element_text(size = 20))
}
f1 = eco_graph(final_eco1, "A")
f2 = eco_graph(final_eco2, "B")
f3 = eco_graph(final_eco3, "C")
f4 = eco_graph(final_eco4, "D")
f5 = eco_graph(final_eco5, "E")
f6 = eco_graph(final_eco6, "F")
c1 = conserve_graph(final_cons1, "A")
c2 = conserve_graph(final_cons2, "B")
c3 = conserve_graph(final_cons3, "C")
c4 = conserve_graph(final_cons4, "D")
c5 = conserve_graph(final_cons5, "E")
c6 = conserve_graph(final_cons6, "F")
```
```{r, fig.show = "hold", out.width = "45%", fig.cap = "Model predictions for the relative cover of macroalgae (M), coral reef (C), and algae turf (T), along with parrotfish density (P) over time. Six scenarios were modeled, with each scenario adjusting one of the ecological parameters (Scenario 1: M = 0.05, C = 0.9, T = 0.05, P = 0.4, X = 0.5; Scenario 2: M = 0.05, C = 0.3, T = 0.05, P = 0.4, X = 0.5; Scenario 3: M = 0.05, C = 0.9, T = 0.3, P = 0.4, X = 0.5; Scenario 4: M = 0.05, C = 0.9, T = 0.05, P = 50, X = 0.5; Scenario 5: M = 0.05, C = 0.9, T = 0.05, P = 0.4, X = 0.8; Scenario 6: M = 0.6, C = 0.9, T = 0.05, P = 0.4, X = 0.5).", fig.align = "center"}
par(mfcol = c(3,2))
f1
f2
f3
f4
f5
f6
```
```{r, fig.show = "hold", out.width = "45%", fig.cap = "Model predictions for the proportion of the population willing to participate in conservation over time. Six scenarios were modeled, with each scenario adjusting one of the ecological parameters and corresponding to the scenarios in Figure 5. Note the change in scale for the y axis among frames.", fig.align = "center"}
par(mfcol = c(3,2))
c1
c2
c3
c4
c5
c6
```
Under most scenarios, the proportion of the population willing to participate in conservation ultimately became 1.0 (i.e., 100% of the population) while the macro algae cover increased and the cover of all other parameters approach 0 (i.e., locally extinct). Under the scenario when parrotfish density was increased, the ecological parameters had the same outcome (increased macro algae while all others decline); however, the proportion of the population willing to participate in conservation became absent (Figure 6D). Based on this information, the parrotfish density appears to have the greatest impact on coral reef conservation when taking into account the social and ecological components.
=======
dx/dt = Kx(1−x)(−1 +j(1−C) − σP(1−x) +φ(2x−1))
*Defined Variables (description in table)*
x = fraction of individuals (humans) in the population willing to participate in coral conservation
C = live coral cover
P = Parrotfish abundance (try different values)
*Undefined Variables (description not in table)*
K = human growth rate per year
j = coral growth rate per year
σ = Parrotfish growth rate per year
φ = unknown interaction term
```{r}
#parameters
K = 1.014
j = 1.68
σ = 0.5
φ = 0.2
#equation - change in willingness to participate in coral conservaiton
change_wtp <- Kx(1−x)(−1 +j(1−C) − σP(1−x) +φ(2x−1))
```
Equilibrium points occur when dx/dt = 0.
dx/dt = 0 at 3 points:
1) when x = 0
In this case, none of population supports coral reef conservation.
2) when (1-x) = 0 aka x = 1
In this case, all of population supports coral reef conservation.
3) When (−1 +j(1−C) − σP(1−x) +φ(2x−1)) = 0
-1 + j - jC - σP + σPx + 2φx - φ = 0
j - jC - σP + σPx + 2φx = 1
Not sure what this means...