simulate_ss_pva: Run a stochastic simulation for a count-based single-site...

Description Usage Arguments Details Value Examples

View source: R/MultisitePVA.R

Description

This function uses a stochastic algorithm if log-lambdas or mean log-lambdas and variance are provided.

Usage

1
2
simulate_ss_pva(initial_pops, n_years = 100, n_runs = 1000, K = NA,
  quasi_extinction_thresholds = 0, ...)

Arguments

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))

Details

This function is not yet vectorized, so provide a single population per run.

Value

A list-based S3 object of class ssPVARes containing elements final_pops (vector), n_years, n_runs, initial_pops, decline_risk and extinction_risk.

Examples

 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
)

cmartin/msPVA documentation built on May 13, 2019, 8:23 p.m.