Description Usage Arguments Details Value Examples
This function uses a stochastic algorithm if log-lambdas or mean log-lambdas and variance are provided.
1 2 | simulate_ss_pva(initial_pops, n_years = 100, n_runs = 1000, K = NA,
quasi_extinction_thresholds = 0, ...)
|
initial_pops |
Number. Initial population sizes. |
n_years |
A number. How many years should we simulate? |
n_runs |
A number. How many simulations should we do? |
K |
A number. Maximum population size (carrying capacity). |
quasi_extinction_thresholds |
A number. Near extinction threshold for the population. |
... |
Either log_lambdas (a vector of log(lambdas) calculated as in Morris & Doak 2002, p.64-65) or growth_rate_means and growth_rate_vars (Numbers: Mean and variance of log(lambdas)) |
This function is not yet vectorized, so provide a single population per run.
A list-based S3 object of class ssPVARes
containing elements final_pops (vector), n_years, n_runs, initial_pops, decline_risk and extinction_risk.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## @knitr ssExample
# From a precalculated mean log-lambdas
res <- simulate_ss_pva(
growth_rate_means = 0.043,
growth_rate_vars = 0.051,
initial_pops = 70,
K = 286,
quasi_extinction_thresholds = 20,
n_years = 50,
n_runs = 100
)
print(res)
hist(res)
# From a vector of log-lambdas
res <- simulate_ss_pva(
log_lambdas = c(-0.0503626618483076, -0.0316522478682412, -0.205890697055539,
-0.0407897021414208, 0.151024474883104, -0.141017433696716, 0.105149579850484,
0.104087724782143, 0.18297223483855),
initial_pops = 70,
K = 286,
quasi_extinction_thresholds = 20,
n_years = 50,
n_runs = 100
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.