knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
Figure 28.5 investigates how changes in the male dominance parameter (gamma) impacts the sex ratio in the context of three scenarios
Load the package
library(redstart)
There param_ranges() function has a "figure = ..." arguement and also a "scenario = ...".
The intial range of the parameters are made by setting "figure = 28.5" and "scenario" to "winter", "summer", or "int". This sets the fixed parameters for each value and the min of gamma to 1 and the max of gamma to 5.
F28.5.range.winter <- param_ranges(figure = 28.5, scenario = "winter") F28.5.range.summer <- param_ranges(figure = 28.5, scenario = "summer") F28.5.range.inter <- param_ranges(figure = 28.5, scenario = "int")
This code makes a dataframe which summaries these parameters.
data.frame(winter = head(F28.5.range.winter), int = head(F28.5.range.inter), summer = head(F28.5.range.summer))
param_seqs() generates values between the minimum and the maxium.
F28.5.win.seq <- param_seqs(F28.5.range.winter) F28.5.int.seq <- param_seqs(F28.5.range.inter) F28.5.sum.seq <- param_seqs(F28.5.range.summer,len.out= 20)
For Figure 28.5 only the breeding ground carrying capacity is varied.
head(F28.5.win.seq,3)
All combinations of parameters are created using param_grid()
F28.5.win.grid <- param_grid(param.seqs = F28.5.win.seq) F28.5.int.grid <- param_grid(param.seqs = F28.5.int.seq) F28.5.sum.grid <- param_grid(param.seqs = F28.5.sum.seq)
Finally runFAC_multi() is called for each scenario's grid.
F28.5.FAC.win <- runFAC_multi(param.grid = F28.5.win.grid) F28.5.FAC.int <- runFAC_multi(param.grid = F28.5.int.grid) F28.5.FAC.sum <- runFAC_multi(param.grid = F28.5.sum.grid)
Once all calls to runFAC_mulit() are done we can plot using plot_Fig28_5().
plot_Fig28_5(dat.winter.lim = F28.5.FAC.win$multiFAC.out.df.RM, dat.intermediate = F28.5.FAC.int$multiFAC.out.df.RM, dat.summer.lim = F28.5.FAC.sum$multiFAC.out.df.RM, drain = T)
Vary gamma by
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.