From 6f60526d9b00e54e41024217eed1a1e86fe0e315 Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Mon, 23 Sep 2024 12:24:30 -0400 Subject: [PATCH] feat: add wild model carrying capacity math is totally wrong --- .gitignore | 4 + Report.html | 575 ---------------------------------------------------- project.R | 65 ++++-- 3 files changed, 57 insertions(+), 587 deletions(-) create mode 100644 .gitignore delete mode 100644 Report.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bbb6696 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.* +!.gitignore +Report_files +Report.html \ No newline at end of file diff --git a/Report.html b/Report.html deleted file mode 100644 index dcb9345..0000000 --- a/Report.html +++ /dev/null @@ -1,575 +0,0 @@ - - - - - - - - - -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/project.R b/project.R index 8f170a2..a5d1d60 100644 --- a/project.R +++ b/project.R @@ -44,16 +44,16 @@ wild_immature_to_adult_rate <- 1 / (wild_begin_breeding - 2) # * `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) + c_Y0 <- c(30) + c_Y1 <- c(30) + c_I <- c(30) + c_A <- c(30) # wild population groups - w_Y0 <- c() - w_Y1 <- c() - w_I <- c() - w_A <- c() + w_Y0 <- c(100) + w_Y1 <- c(100) + w_I <- c(100) + w_A <- c(100) years <- seq(1, simulation_years) @@ -72,24 +72,48 @@ simulate_condor_population <- function(rd1, rdI, rdA) { 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) + c_Y0[t] <- captive_productivity_rate_dc * (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) { + last_captive_population <- c_Y0[t - 1] + c_Y1[t - 1] + c_I[t - 1] + c_A[t - 1] + released_to_wild <- if (last_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 + + # carrying capacity death rate + last_wild_population <- w_Y0[t - 1] + w_Y1[t - 1] + c_I[t - 1] + c_A[t - 1] + approx_wild_growth_rate <- (wild_productivity_rate * (w_A[t - 1] / 2) + released_to_wild) / last_wild_population + rd_carrying <- approx_wild_growth_rate * (last_wild_population / wild_carrying_capacity) # r * P / M + + w_Y1[t] <- (w_Y0[t - 1] + # inflow from year zero + released_to_wild) * # inflow from captive + (1 - rd1) * # outflow to deaths (death rate) + (1 - rd_carrying) # outflow to deaths (carrying capacity) + + w_I[t] <- w_I[t - 1] + # last year's population + w_Y1[t - 1] - # inflow from year one + w_I[t - 1] * wild_immature_to_adult_rate - # outflow to adult + w_I[t - 1] * rdI - # outflow to deaths (death rate) + w_I[t - 1] * rd_carrying # outflow to deaths (carrying capacity) + + w_A[t] <- w_A[t - 1] + # last year's population + w_I[t - 1] * wild_immature_to_adult_rate - # inflow from immature + w_A[t - 1] * rdA - # outflow to deaths (death rate) + w_A[t - 1] * rd_carrying # outflow to deaths (carrying capacity) + + w_Y0[t] <- wild_productivity_rate * (w_A[t] / 2) * + (1 - rd_carrying) # deaths due to carrying capacity } captive_population <- c_Y0 + c_Y1 + c_I + c_A plot( years, c_Y0, - ylim = c(0, 50), + ylim = c(0, 150), col = "red", main = "Condor Population in Captivity", xlab = "Time (years)", @@ -99,4 +123,21 @@ simulate_condor_population <- function(rd1, rdI, rdA) { points(years, c_I, col = "darkgreen") points(years, c_A, col = "blue") points(years, captive_population) + + wild_population <- w_Y0 + w_Y1 + w_I + w_A + plot( + years, + w_Y0, + ylim = c(0, wild_carrying_capacity + 100), + col = "red", + main = "Condor Population in the Wild", + xlab = "Time (years)", + ylab = "Population" + ) + points(years, w_Y1, col = "orange") + points(years, w_I, col = "darkgreen") + points(years, w_A, col = "blue") + points(years, wild_population) } + +simulate_condor_population(0.086, 0.086, 0.086)