Ne: Calculate the effective population size (Ne)

Description Usage Arguments Details Value Examples

View source: R/data_analysis.R

Description

Ne calculates the effective population size (Ne) between yr0 and yrt for several scenarios based on the loss of genetic diversity (expected heterozygosity) using the temporal approach.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Ne(
  data = NULL,
  scenarios = "all",
  gen = 1,
  yr0 = 1,
  yrt = 2,
  save2disk = TRUE,
  fname = "Ne",
  dir_out = "DataAnalysis"
)

Arguments

data

The output from collate_dat

scenarios

A vector of scenario names for which Ne needs to be calculated, default: 'all'

gen

The generation time express in years

yr0, yrt

The time window to be considered (first and last year respectively)

save2disk

Whether to save the output to disk, default: TRUE

fname

The name of the files where to save the output, defult: 'Ne'

dir_out

The local path to store the output. Default: DataAnalysis

Details

yr0 is adjusted by adding the number of years of the generation time (rounded to the nearest integer). In this way the user can provide the same yr0,yrt and gen to Nadults and Ne and these values are adjusted internally to correctly calculate the Ne/N ratios where relevant. If this behaviour is not desired, use gen=0.

NOTE: When a population goes extinct, the results of the calculations are spurious (they are 0.5). This may change in future versions.

Value

A data.table (data.frame if data.table is not loaded) with Ne values

Examples

1
2
3
4
5
6
# Using Pacioni et al. example data. See ?pac.clas for more details.
data(pac.clas)
# Calculate Ne for all scenarios in the data. Note the odd value for scenario
# 12, consequent to the population going extinct.
NeAll <- Ne(data=pac.clas, scenarios='all', gen=2.54, yr0=50, yrt=120,
         save2disk=FALSE)

Example output

Effective population size based on loss of gene diversity from year 53 to year 120
NOTE: The first year used in the calculations is adjusted  using the generation time provided (yr0 + gen).  See documentation for more information.

vortexR documentation built on April 14, 2020, 7:23 p.m.