commit ae0c50b6895b42f24cd11f2ec198d43a0aeb4cb0 Author: Michael Thomas Date: Sat Sep 21 14:54:30 2024 -0400 chore: initial commit diff --git a/Condors.pdf b/Condors.pdf new file mode 100644 index 0000000..cc74ed1 Binary files /dev/null and b/Condors.pdf differ diff --git a/Report.html b/Report.html new file mode 100644 index 0000000..dcb9345 --- /dev/null +++ b/Report.html @@ -0,0 +1,575 @@ + + + + + + + + + +report + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+

Condor Populations Project 3

+

Michael Thomas, Emily, Menna

+
+
source("project.R")
+
+
+

Part A. Suppose year 1, immature, and adult birds have the same mortality rate, 0.086.

+
+
simulate_condor_population(0.086, 0.086, 0.086)
+
+
+
+

+
+
+
+
+
+
+

Part B. Suppose year 1 and immature birds have a mortality rate of 0.138, while adult condors have a mortality of half that amount, 0.069.

+
+
simulate_condor_population(0.138, 0.138, 0.069)
+
+
+
+

+
+
+
+
+
+
+

Part C. (Bustamante 1996) found a mortality of 65.9% for year-1 bearded vultures. Use this mortality and immature and adult mortality of 0.086.

+
+
simulate_condor_population(0.659, 0.086, 0.086)
+
+
+
+

+
+
+
+
+
+
+

Part D. Consider year 1, immature, and adult mortalities of 0.659, 0.138, and 0.069, respectively.

+
+
simulate_condor_population(0.659, 0.138, 0.069)
+
+
+
+

+
+
+
+
+
+
+

Part E. Consider year 1, immature, and adult mortalities of 0.659, 0.099, and 0.099, respectively.

+
+
simulate_condor_population(0.659, 0.099, 0.099)
+
+
+
+

+
+
+
+
+
+
+

Part F. Under the assumptions of Part d, suppose that a program of double-clutching persists for five years. Afterwards, all captive birds are returned to the wild. Compare the number of wild condors for this scenario to that in Part d. 

+
+
+ +
+ + +
+ + + + + \ No newline at end of file diff --git a/Report.qmd b/Report.qmd new file mode 100644 index 0000000..5b22064 --- /dev/null +++ b/Report.qmd @@ -0,0 +1,39 @@ +# Condor Populations Project 3 + +Emily Fowler, Menna Ellaqanny, Michael Thomas + +```{r} +source("project.R") +``` + +## Part A. Suppose year 1, immature, and adult birds have the same mortality rate, 0.086. + +```{r} +simulate_condor_population(0.086, 0.086, 0.086) +``` + +## Part B. Suppose year 1 and immature birds have a mortality rate of 0.138, while adult condors have a mortality of half that amount, 0.069. + +```{r} +simulate_condor_population(0.138, 0.138, 0.069) +``` + +## Part C. (Bustamante 1996) found a mortality of 65.9% for year-1 bearded vultures. Use this mortality and immature and adult mortality of 0.086. + +```{r} +simulate_condor_population(0.659, 0.086, 0.086) +``` + +## Part D. Consider year 1, immature, and adult mortalities of 0.659, 0.138, and 0.069, respectively. + +```{r} +simulate_condor_population(0.659, 0.138, 0.069) +``` + +## Part E. Consider year 1, immature, and adult mortalities of 0.659, 0.099, and 0.099, respectively. + +```{r} +simulate_condor_population(0.659, 0.099, 0.099) +``` + +## Part F. Under the assumptions of Part d, suppose that a program of double-clutching persists for five years. Afterwards, all captive birds are returned to the wild. Compare the number of wild condors for this scenario to that in Part d. diff --git a/project.R b/project.R new file mode 100644 index 0000000..8f170a2 --- /dev/null +++ b/project.R @@ -0,0 +1,102 @@ +#################### +# Global Constants # +#################### + +# age at which birds in captivity begin breeding (become adults) +captive_begin_breeding <- 7 +# age at which birds in the wild begin breeding (become adults) +wild_begin_breeding <- 8 +# if the captive population exceeds this amount, then the entire year one +# population will be released +max_in_captivity <- 150 +# carrying capacity in the wild +wild_carrying_capacity <- 400 +# percentage of children which will make it to year 1 in captivity, +# per mating pair +captive_productivity_rate <- 0.9 +# percentage of children which will make it to year 1 in captivity, +# per mating pair (with double clutching) +captive_productivity_rate_dc <- 1.8 +# percentage of children which will make it to year 1, per mating pair +wild_productivity_rate <- 0.3729 + +################################ +# Global Simulation Parameters # +################################ + +# number of years to simulate +simulation_years <- 50 + +###################### +# Derived Parameters # +###################### + +# rate at which captive immature birds will become adults +# an approximation which assumes an equal distribution of immature bird ages +captive_immature_to_adult_rate <- 1 / (captive_begin_breeding - 2) +# rate at which wild immature birds will become adults +# an approximation which assumes an equal distribution of immature bird ages +wild_immature_to_adult_rate <- 1 / (wild_begin_breeding - 2) + +# Simulates the Condor population over time using the given parameters. +# * `rd1` - death rate of year one birds +# * `rdI` - death rate of immature birds +# * `rdA` - death rate of adult birds +simulate_condor_population <- function(rd1, rdI, rdA) { + # captive population groups + c_Y0 <- c(10) + c_Y1 <- c(10) + c_I <- c(10) + c_A <- c(10) + + # wild population groups + w_Y0 <- c() + w_Y1 <- c() + w_I <- c() + w_A <- c() + + years <- seq(1, simulation_years) + + for (t in 2:simulation_years) { + # model captive population changes (year 1, immature, and adult) + c_Y1[t] <- c_Y0[t - 1] - # last year's population + rd1 * c_Y0[t - 1] # outflow to deaths + + c_I[t] <- c_I[t - 1] - # last year's population + rdI * c_I[t - 1] - # outflow to deaths + captive_immature_to_adult_rate * c_I[t - 1] + # outflow to adult + c_Y1[t - 1] # inflow from year 1 + + c_A[t] <- c_A[t - 1] - # last year's population + rdA * c_A[t - 1] + # outflow to deaths + captive_immature_to_adult_rate * c_I[t - 1] # inflow from immature + + # model new births in captive population + c_Y0[t] <- captive_productivity_rate * (c_A[t] / 2) + + # sum of all population groups + captive_population <- c_Y0[t] + c_Y1[t] + c_I[t] + c_A[t] + released_to_wild <- if (captive_population > max_in_captivity) { + c_Y1[t] + } else { + 0.8 * c_Y1[t] + } + # subtract the released birds from the captive year one population + c_Y1[t] <- c_Y1[t] - released_to_wild + } + + captive_population <- c_Y0 + c_Y1 + c_I + c_A + plot( + years, + c_Y0, + ylim = c(0, 50), + col = "red", + main = "Condor Population in Captivity", + xlab = "Time (years)", + ylab = "Population" + ) + points(years, c_Y1, col = "orange") + points(years, c_I, col = "darkgreen") + points(years, c_A, col = "blue") + points(years, captive_population) +}