中文 | Español | English | português | Turkish

knitr::opts_chunk$set(echo = TRUE)
library(tidyr)
library(ggplot2)
library(deSolve)
library(ecoevoapps)
library(patchwork)
library(latex2exp)
theme_set(ecoevoapps::theme_apps())

Crescimento exponencial discreto

$N_{t+1} = \lambda N_t$

sidebarLayout(
  sidebarPanel(
    # User defined lambda -------
    sliderInput("lambda", label = "Taxa de crescimento populacional (lambda)",
                min = 0.01, max = 2, value = 1.2, step = .01),
    # User defined N0 -------
    numericInput("N0", label = "Tamanho inicial da população (N0)",
                min = 1, max = 100, value = 1),
    # User defined time ---------
    numericInput("time", label = "Número de passos a serem projetados",
                min = 1, max = 1000, value = 30)
    ),

  # Panel of plots -----
  mainPanel(
    renderPlot({plots_to_print()}, width = 450, height = 450)
  )
)

# Generate trajectories for sp 1 --------

exponential_pop_df <- reactive({
  run_discrete_exponential_model(N0 = input$N0, lambda = input$lambda, time = input$time)
})


# Make plot -----------
trajaectory_plot <- reactive({
  plot_discrete_population_growth(exponential_pop_df()) +
    ylab(latex2exp::TeX("Population size at time $t$ ($N_t$)")) +
    labs(caption = latex2exp::TeX(paste0("Parameter values: $\\lambda = $", input$lambda)),
         title = "Population growth with the discrete exponential model")
})

# Make a list of plots  ----
plots_to_print <- reactive({trajaectory_plot()})

Crescimento logístico discreto {.tabset}

Modelo padrão de crescimento logístico

Uma das formas de se modelar o crescimento logístico de uma população com crescimento discreto é através do mapa logístico, que é a versão discreta da equação logística contínua:

$$N_{t+1} = r_dN_t\left(1-\frac{N_t}{K}\right)$$

Essa equação foi notoriamente estudada por Robert May no artigo clássico de 1976 "Modelos matemáticos simples com dinâmicas muito complicadas", onde ele demonstra o potencial que esse modelo tem de gerar dinâmicas caóticas.

sidebarLayout(
  sidebarPanel(
    # User defined lambda -------
    sliderInput("rd_dl", label = "Taxa de crescimento populacional (rd):",
                min = 0.01, max = 4.5, value = 1.05, step = .01),
    # User defined N0 -------
    numericInput("N0_dl", label = "Tamanho inicial da população (N0)",
                min = 1, max = 100, value = 1),
    # User defined carrying capacity (K) ----------    
    numericInput("K_dl", label = "Capacidade de suporte (K)",
                 min = 1, max = 1000, value = 100),
    # User defined time ---------
    numericInput("time_dl", label = "Número de passos a serem projetados",
                min = 1, max = 1000, value = 30)

    ),

  # Panel of plots -----
  mainPanel(
    renderPlot({plots_to_print_dl()}, width = 450, height = 800)
  )
)

# Get user defined parameters for discrete logistic  ------

params_dl <- reactive({c(rd = input$rd_dl, K = input$K_dl)})
dl_df <- reactive({
  run_discrete_logistic_model(N0 = input$N0_dl,
                                       params = params_dl(),
                                       time = input$time_dl)


})
# Generate trajectories for discrete logistic --------
trajaectory_plot_dl <- reactive({
  plot_discrete_population_growth(dl_df()) +
    labs(title = "Population growth with the discrete logistic model")
})

# cobweb for standard discrete logistic model -----
cobweb_dl <- reactive({
  plot_discrete_population_cobweb(dl_df(),
                                  params_vec = params_dl(),
                                  model_type = "discrete_logistic")
})

# Make plot caption ----
plot_caption_dl <- reactive({
    latex2exp::TeX(paste0("Parameter values: $r_d = $", input$rd_dl, "; K = ", input$K_dl))
})
# Make a list of plots  ----
plots_to_print_dl <- reactive({{trajaectory_plot_dl()/cobweb_dl()} + 
    labs(caption = plot_caption_dl())})

Modelo de Ricker

Outra forma de se modelar uma população com crescimento discreto e com uma capacidade de suporte é usando o modelo de Ricker, descrito originalmente em um artigo de 1954 sobre estoques pesqueiros e sua recuperação.

$$N_{t+1} = N_t e^{(r (1 - N_t/K))}$$

sidebarLayout(
  sidebarPanel(
    # User defined lambda -------
    sliderInput("r_ricker", label = "Taxa de crescimento populacional (r):",
                min = 0.01, max = 3, value = 1.01, step = .01),
    # User defined N0 -------
    numericInput("N0_ricker", label = "Tamanho inicial da população (N0)",
                min = 1, max = 100, value = 1),
    # User defined carrying capacity (K) ----------    
    numericInput("K_ricker", label = "Capacidade de suporte (K)",
                 min = 1, max = 1000, value = 100),
    # User defined time ---------
    numericInput("time_ricker", label = "Número de passos a serem projetados",
                min = 1, max = 1000, value = 30, step = 5)

    ),

  # Panel of plots -----
  mainPanel(
    renderPlot({plots_to_print_ricker()}, width = 450, height = 800)
  )
)
params_ricker <- reactive({c(rd = input$r_ricker, K = input$K_ricker)})

ricker_df <- reactive({
  run_ricker_model(N0 = input$N0_ricker,
                                 params = params_ricker(),
                                 time = input$time_ricker)
})
# Generate trajectories for discrete logistic --------
trajaectory_plot_ricker <- reactive({
  plot_discrete_population_growth(ricker_df()) +
    labs(title = "Population growth with the Ricker model")
})

# cobweb plot for ricker model -----
cobweb_ricker <- reactive({
    plot_discrete_population_cobweb(ricker_df(),
                                  params_vec = params_ricker(),
                                  model_type = "ricker")
})

# Make plot caption ----
plot_caption_ricker <- reactive({
    latex2exp::TeX(paste0("Parameter values: $r = $", input$r_ricker, "; K = ", input$K_ricker))
})

# Make a list of plots  ----

plots_to_print_ricker <- reactive({{
  trajaectory_plot_ricker()/cobweb_ricker()} + 
    labs(caption = plot_caption_ricker())})

Modelo de Beverton-Holt

Uma terceira forma de se modelar crescimento populacional discreto é com o modelo de Beverton-Holt, também desenvolvido no contexto de manejo de recursos pesqueiros.

$$N_{t+1} = \frac{RN_t}{1+\left(\frac{R-1}{K}\right)N_t}$$

sidebarLayout(
  sidebarPanel(
    # User defined lambda -------
    sliderInput("r_bh", label = "Taxa de crescimento populacional (R):",
                min = 0.01, max = 3, value = 1.25, step = .01),
    # User defined N0 -------
    numericInput("N0_bh", label = "Tamanho inicial da população (N0)",
                min = 1, max = 100, value = 1),
    # User defined carrying capacity (K) ----------    
    numericInput("K_bh", label = "Capacidade de suporte (K)",
                 min = 1, max = 1000, value = 100),
    # User defined time ---------
    numericInput("time_bh", label = "Número de passos a serem projetados",
                min = 1, max = 1000, value = 30, step = 5)

    ),

  # Panel of plots -----
  mainPanel(
    renderPlot({plots_to_print_bh()}, width = 450, height = 800)
  )
)
# Get user defined parameters for discrete logistic  ------
params_bh <- reactive({c(rd = input$r_bh, K = input$K_bh)})
bh_df <- reactive({
  run_beverton_holt_model(N0 = input$N0_bh, 
                          params = params_bh(),
                          time = input$time_bh)
})
# Generate trajectories for beverton-holt model --------
trajaectory_plot_bh <- reactive({
  plot_discrete_population_growth(bh_df()) +
    labs(title = "Population growth with the Beverton-Holt model")
})

# Generate cobweb for beverton-holt model --------
cobweb_bh <- reactive({
  plot_discrete_population_cobweb(bh_df(),
                                  params_vec = c(rd = input$r_bh, K = input$K_bh),
                                  model_type = "beverton_holt") 
})

# Make plot caption ----
plot_caption_bh <- reactive({
    latex2exp::TeX(paste0("Parameter values: $r = $", input$r_bh, "; K = ", input$K_bh))
})

# Make a list of plots  ----

plots_to_print_bh <- reactive({{trajaectory_plot_bh()/cobweb_bh()} + 
    labs(caption = plot_caption_bh())})

References

"Simple mathematical models with very complicated dynamics", Robert May, 1976.

"Stock and Recruitment", Bill Ricker, 1954.

Course notes on the Ricker model from UGA course on population ecology

Dr. Sebastian Bonhoeffer's lecture notes on Ecology and Evolution (see Ch. 1)

Dr. Jan Engelstädter's e-book on analysis of biological data.


suppressWarnings(ecoevoapps::print_app_footer(language = "pt"))


gauravsk/ecoevoapps-mirror documentation built on April 5, 2025, 1:59 a.m.