calculate_params_from_file: Extract population parameters from a data file

Description Usage Arguments Details Value Examples

View source: R/MultisitePVA.R

Description

This function expects a n_pop+1 columns layout with column headers as the first line. First column should be years, then counts for each population. E.g. :

Year;Pop1;Pop2
2010;35;26
2011;26;41
2012;33;35

Usage

1

Arguments

data_file

The path to the file

Details

This function calculates log(lambda) means and variances the standard way, unless there are gaps in the time series. In the latter case, regression analysis is used.

See Morris & Doak 2002, p.64-69 for calculation details

Value

A list containing initial_pops, growth_rate_corrs, growth_rate_means and growth_rate_vars parameters. Please see simulate_ms_pva for a description of each parameter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## @knitr paramsExample

params <- calculate_params_from_file(
 system.file("extdata", "PolarBear_Stirling2004.csv", package = "msPVA")
)
res <- do.call(
 "simulate_ms_pva",
 c(
   params,
   list(
     K = c(300,200),
     leaving_prob = 0.1,
     reaching_prob = 0.7,
     quasi_extinction_thresholds = c(20, 20),
     n_years = 50,
     n_runs = 100,
     with_progress_bar = FALSE
   )
 )
)
print(res)

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