Skip to content

Commit

Permalink
Built site for gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
willvieira committed Jan 13, 2024
1 parent 021d8b8 commit 6d238b9
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .nojekyll
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6f0bdd65
009542d0
6 changes: 3 additions & 3 deletions extinction_risk.html
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ <h3 class="anchored" data-anchor-id="effect-of-climate-and-competition-on-suitab
<div class="cell" data-hash="extinction_risk_cache/html/fig-sp_comp_vs_nocomp_d16094c587343e1e05cb99780e95ace4">

</div>
<div class="cell" data-hash="extinction_risk_cache/html/fig-sp_comp_vs_nocomp2_6b7f8095651bb624f6d76e4b8dc3e7b0">
<div class="cell" data-hash="extinction_risk_cache/html/fig-sp_comp_vs_nocomp2_0b66cbb47aa31009fe3f91891af91a5c">
<div class="cell-output-display">
<div id="fig-sp_comp_vs_nocomp2" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
Expand All @@ -493,7 +493,7 @@ <h3 class="anchored" data-anchor-id="effect-of-climate-and-competition-on-suitab
</div>
</div>
<p>We further estimated the relative effect of climate and competition on changing suitable probability from the center to the border of the species distribution (<a href="#fig-diff_sp_hist">Figure&nbsp;<span>19.12</span></a>). Specifically, we quantified the distinct contributions of temperature and competition to changes in suitable probability. Positive values of the relative difference signify an increase in suitable probability from the center towards the border, negative values indicate a decrease, and zero implies no net change. In the hot range, most species exhibited negative values of the relative difference in suitable probability, indicating a decline in suitability due to higher temperature and intensified competition toward the hot border of the species distribution. At the cold range, most species showed positive values for the competition effect, meaning a reduction in the effect of competition toward the cold border. However, the climate effect at the cold range showed a less clear pattern, with some species experiencing an increase and others a decrease in suitable probability as temperature decreased toward the cold range. Overall, the relative difference in suitable probability from the center toward the border was more influenced by climate rather than competition.</p>
<div class="cell" data-hash="extinction_risk_cache/html/fig-diff_sp_hist_56c6975534ecbb0100882a6a148e6b0f">
<div class="cell" data-hash="extinction_risk_cache/html/fig-diff_sp_hist_484d3a2955e1c0511f8794db1f9cb59a">
<div class="cell-output-display">
<div id="fig-diff_sp_hist" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
Expand All @@ -512,7 +512,7 @@ <h3 class="anchored" data-anchor-id="suitable-probability-across-the-mean-annual
<div class="cell" data-hash="extinction_risk_cache/html/fig-sp_over_MAT1_266a66e29e6a60c0eb88ad06ca7af021">

</div>
<div class="cell" data-hash="extinction_risk_cache/html/fig-sp_diff_over_MAT_4260b0b6cb8ded7a6fa726078e2f7c3a">
<div class="cell" data-hash="extinction_risk_cache/html/fig-sp_diff_over_MAT_5dfdc5bae139f9d9c6d5f59550a2917e">
<div class="cell-output-display">
<div id="fig-sp_diff_over_MAT" class="quarto-figure quarto-figure-center anchored">
<figure class="figure">
Expand Down
Binary file modified extinction_risk_files/figure-html/fig-diff_sp_hist-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified extinction_risk_files/figure-html/fig-sp_diff_over_MAT-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions guide_IPM.html

Large diffs are not rendered by default.

Binary file modified guide_IPM_files/figure-html/fig-sizeDist-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion search.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@
"href": "guide_IPM.html#run-the-ipm",
"title": "15  A guide to use the forest-IPM code",
"section": "Run the IPM",
"text": "Run the IPM\nThe primary function of the forest IPM is the mkKernel().\n\nK_abibal = mkKernel(\n Nvec_intra = N_sp,\n Nvec_inter = N_het,\n delta_time = delta_time,\n plotSize = plotSize,\n Temp = Temp,\n Prec = Prec,\n pars = pars_abibal,\n plot_random = plot_random\n)\n\nThe K_abibal object is a list of the \\(P\\), \\(F\\), and \\(K\\) matrices of dimension \\(z^2\\) as described in Equation 14.2. This kernel object is the core output of the IPM model, serving as the foundation for projecting populations over time or calculating the asymptotic population growth rate (\\(\\lambda\\)) and other metrics.\nWe can extract the asymptotic population growth rate (\\(\\lambda\\)) using the leading eigen value of the matrix \\(k\\):\n\n(max(Re(eigen(K_abibal$K)$values)))\n\n[1] 1.2105\n\n\nGiven that our matrix is density-dependent, we can project the population vector over time by continuously updating the Kernel at each time step to account for the evolving size distribution of individuals. In the following code, we demonstrate a simple loop to trace the evolving population over time while assuming that there is only conspecific density-dependence (N_het = 0). Note that this code is slow and can take 5-10 minutes to run due to the slow eigen() computation.\n\nset.seed(0.0)\n\n# Initial population size (small)\nN_sp <- init_pop(\n params = pars_abibal,\n L = 127,\n h = 1,\n N = 1\n)\n\n# define no heterospecific competition\nN_het <- init_pop(\n params = pars_abibal,\n L = 127,\n h = 1,\n N = 0\n)\n\n# generate initial Kernel\nK0 = mkKernel(\n Nvec_intra = N_sp,\n Nvec_inter = N_het,\n delta_time = delta_time,\n plotSize = plotSize,\n Temp = Temp,\n Prec = Prec,\n pars = pars_abibal,\n plot_random = plot_random\n)\n\n\ntime_max = 200\n# vector to save lambda over time\nlambdas = max(Re(eigen(K0$K)$values))\n# matrix to save size distribution\nntmat = matrix(0, nrow = length(N_sp$Nvec), ncol = time_max)\nntmat[, 1] <- N_sp$Nvec\n\nfor(Time in 2:time_max)\n{\n # update the state\n ntmat[, Time] <- K0$K %*% ntmat[, Time - 1]\n N_sp$Nvec <- ntmat[, Time]\n\n # update the kernel\n K0 <- mkKernel(\n Nvec_intra = N_sp,\n Nvec_inter = N_het,\n delta_time = delta_time,\n plotSize = plotSize,\n Temp = Temp,\n Prec = Prec,\n pars = pars_abibal,\n plot_random = plot_random\n )\n\n # calculate pop growth rate\n lambdas[Time] = max(Re(eigen(K0$K)$values))\n\n cat(' Time step', Time, 'of', time_max, '(', round(Time/time_max * 100, 1), '%)\\r')\n}\n\n\n\n\nFor each time iteration, we saved the focal species’ size (\\(z\\)) distribution and the population growth rate (\\(\\lambda\\)). We can visualize how each measure involved time for these species-specific conditions. In Figure 15.2 and Figure 15.3, we can visualize how \\(\\lambda\\) and the size density distribution evolve.\n\n\nCode\nntmat |>\n as_tibble() |>\n pivot_longer(cols = everything(), values_to = 'Density') |>\n mutate(Time = parse_number(name)) |>\n group_by(Time) |>\n reframe(N = sum(Density)) |>\n left_join(\n lambdas |>\n enframe(name = 'Time') |>\n rename(lambda = value)\n ) |>\n pivot_longer(cols = c(N, lambda)) |>\n mutate(\n name = factor(name, levels = c('N', 'lambda'), labels = c(expression(textstyle('Population size')), expression(lambda)))\n ) |>\n ggplot() +\n aes(Time, value) +\n facet_wrap(\n ~name,\n scales = 'free_y',\n labeller = label_parsed\n ) +\n geom_path(linewidth = 1.2) +\n theme_classic() +\n labs(\n y = NULL\n )\n\n\n\n\n\nFigure 15.2: Population size (left panel) and population growth rate (right panel) over time.\n\n\n\n\n\n\nCode\nsuppressPackageStartupMessages(library(plotly))\n\nntmat |>\n as.data.frame() |>\n pivot_longer(cols = everything(), values_to = 'Density') |>\n mutate(Time = parse_number(name)) |>\n group_by(Time) |>\n mutate(x = 127:(n() + 126)) |>\n ggplot() +\n aes(x, Density) +\n aes(group = name) +\n aes(frame = Time) +\n geom_path() +\n theme_classic() +\n xlab('Size (mm)') ->\np\n\nggplotly(p) |>\n animation_opts(frame = 50) |>\n animation_slider(\n hide = FALSE,\n currentvalue = list(prefix = \"Time step: \", font = list(color = 'black'))\n ) |>\n animation_button(\n x = 0.9, xanchor = 'left', y = 1, yanchor = 'top'\n ) \n\n\n\n\n\nFigure 15.3: Population size distribution over time.\n\n\n\nWe can also see how these two quantities interact over time.\n\n\nCode\nntmat |>\n as.data.frame() |>\n pivot_longer(cols = everything()) |>\n group_by(name) |>\n reframe(N = sum(value)) |>\n mutate(Time = parse_number(name)) |>\n arrange(Time) |>\n bind_cols(lambda = lambdas) |>\n ggplot() +\n aes(N, lambda) +\n aes(color = Time) +\n geom_path(linewidth = 1.2) +\n theme_classic() +\n labs(x = 'Population size', y = expression(lambda)) +\n geom_hline(yintercept = 1, alpha = 0.2)\n\n\n\n\n\nFigure 15.4: Correlation between population growth rate and total population size over time."
"text": "Run the IPM\nThe primary function of the forest IPM is the mkKernel().\n\nK_abibal = mkKernel(\n Nvec_intra = N_sp,\n Nvec_inter = N_het,\n delta_time = delta_time,\n plotSize = plotSize,\n Temp = Temp,\n Prec = Prec,\n pars = pars_abibal,\n plot_random = plot_random\n)\n\nThe K_abibal object is a list of the \\(P\\), \\(F\\), and \\(K\\) matrices of dimension \\(z^2\\) as described in Equation 14.2. This kernel object is the core output of the IPM model, serving as the foundation for projecting populations over time or calculating the asymptotic population growth rate (\\(\\lambda\\)) and other metrics.\nWe can extract the asymptotic population growth rate (\\(\\lambda\\)) using the leading eigen value of the matrix \\(k\\):\n\n(max(Re(eigen(K_abibal$K)$values)))\n\n[1] 1.210656\n\n\nGiven that our matrix is density-dependent, we can project the population vector over time by continuously updating the Kernel at each time step to account for the evolving size distribution of individuals. In the following code, we demonstrate a simple loop to trace the evolving population over time while assuming that there is only conspecific density-dependence (N_het = 0). Note that this code is slow and can take 5-10 minutes to run due to the slow eigen() computation.\n\nset.seed(0.0)\n\n# Initial population size (small)\nN_sp <- init_pop(\n params = pars_abibal,\n L = 127,\n h = 1,\n N = 1\n)\n\n# define no heterospecific competition\nN_het <- init_pop(\n params = pars_abibal,\n L = 127,\n h = 1,\n N = 0\n)\n\n# generate initial Kernel\nK0 = mkKernel(\n Nvec_intra = N_sp,\n Nvec_inter = N_het,\n delta_time = delta_time,\n plotSize = plotSize,\n Temp = Temp,\n Prec = Prec,\n pars = pars_abibal,\n plot_random = plot_random\n)\n\n\ntime_max = 200\n# vector to save lambda over time\nlambdas = max(Re(eigen(K0$K)$values))\n# matrix to save size distribution\nntmat = matrix(0, nrow = length(N_sp$Nvec), ncol = time_max)\nntmat[, 1] <- N_sp$Nvec\n\nfor(Time in 2:time_max)\n{\n # update the state\n ntmat[, Time] <- K0$K %*% ntmat[, Time - 1]\n N_sp$Nvec <- ntmat[, Time]\n\n # update the kernel\n K0 <- mkKernel(\n Nvec_intra = N_sp,\n Nvec_inter = N_het,\n delta_time = delta_time,\n plotSize = plotSize,\n Temp = Temp,\n Prec = Prec,\n pars = pars_abibal,\n plot_random = plot_random\n )\n\n # calculate pop growth rate\n lambdas[Time] = max(Re(eigen(K0$K)$values))\n\n cat(' Time step', Time, 'of', time_max, '(', round(Time/time_max * 100, 1), '%)\\r')\n}\n\n\n\n\nFor each time iteration, we saved the focal species’ size (\\(z\\)) distribution and the population growth rate (\\(\\lambda\\)). We can visualize how each measure involved time for these species-specific conditions. In Figure 15.2 and Figure 15.3, we can visualize how \\(\\lambda\\) and the size density distribution evolve.\n\n\nCode\nntmat |>\n as_tibble() |>\n pivot_longer(cols = everything(), values_to = 'Density') |>\n mutate(Time = parse_number(name)) |>\n group_by(Time) |>\n reframe(N = sum(Density)) |>\n left_join(\n lambdas |>\n enframe(name = 'Time') |>\n rename(lambda = value)\n ) |>\n pivot_longer(cols = c(N, lambda)) |>\n mutate(\n name = factor(name, levels = c('N', 'lambda'), labels = c(expression(textstyle('Population size')), expression(lambda)))\n ) |>\n ggplot() +\n aes(Time, value) +\n facet_wrap(\n ~name,\n scales = 'free_y',\n labeller = label_parsed\n ) +\n geom_path(linewidth = 1.2) +\n theme_classic() +\n labs(\n y = NULL\n )\n\n\n\n\n\nFigure 15.2: Population size (left panel) and population growth rate (right panel) over time.\n\n\n\n\n\n\nCode\nsuppressPackageStartupMessages(library(plotly))\n\nntmat |>\n as.data.frame() |>\n pivot_longer(cols = everything(), values_to = 'Density') |>\n mutate(Time = parse_number(name)) |>\n group_by(Time) |>\n mutate(x = 127:(n() + 126)) |>\n ggplot() +\n aes(x, Density) +\n aes(group = name) +\n aes(frame = Time) +\n geom_path() +\n theme_classic() +\n xlab('Size (mm)') ->\np\n\nggplotly(p) |>\n animation_opts(frame = 50) |>\n animation_slider(\n hide = FALSE,\n currentvalue = list(prefix = \"Time step: \", font = list(color = 'black'))\n ) |>\n animation_button(\n x = 0.9, xanchor = 'left', y = 1, yanchor = 'top'\n ) \n\n\n\n\n\nFigure 15.3: Population size distribution over time.\n\n\n\nWe can also see how these two quantities interact over time.\n\n\nCode\nntmat |>\n as.data.frame() |>\n pivot_longer(cols = everything()) |>\n group_by(name) |>\n reframe(N = sum(value)) |>\n mutate(Time = parse_number(name)) |>\n arrange(Time) |>\n bind_cols(lambda = lambdas) |>\n ggplot() +\n aes(N, lambda) +\n aes(color = Time) +\n geom_path(linewidth = 1.2) +\n theme_classic() +\n labs(x = 'Population size', y = expression(lambda)) +\n geom_hline(yintercept = 1, alpha = 0.2)\n\n\n\n\n\nFigure 15.4: Correlation between population growth rate and total population size over time."
},
{
"objectID": "sens_analysis.html#simulation-summary",
Expand Down

0 comments on commit 6d238b9

Please sign in to comment.