calculate.theta: Calculates species habitat specialization using co-occurrence...

Description Usage Arguments Details Value Author(s) Examples

Description

Calculates species habitat specialization using co-occurrence based theta metric.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
calculate.theta(input.matrix, species.data = NULL, psample = 5, reps = 10,
  method = "multiplicative", beta.div.method = "hellinger",
  beta.div.sqrt.D = FALSE, beta.div.samp = TRUE, beals.file = NULL,
  pa.transform = FALSE, force.subsample = FALSE, parallel = FALSE,
  no.cores = 2, remove.out = F, verbal = F, juicer = F, tcltk = F)

calculate.theta.0(temp.matrix, sci.name, sp, remove.out, psample, reps, method,
  beta.div.method, beta.div.sqrt.D, beta.div.samp, force.subsample, parallel,
  win.pb, verbal, juicer)

calculate.theta.tcltk(input.matrix, species.data = NULL, juicer = T)

beals.2(x, include = TRUE, verbal = FALSE)

Arguments

input.matrix

Community data (matrix or data.frame, samples x species). If data are not presence-absence, the matrix will be automatically transformed into presence-absence and warning will be printed.

species.data

Species data (matrix or data.frame). If suplied, it should have at least two columns - the first containing species name, the second containing layer.

psample

Minimal frequency of species. Habitat specialization will be calculated for species occurring in number of samples equal or higher than minimal frequency threshold. Default = 5.

reps

Number of random subsamples. Specifies how many times the fixed number of samples (specified by psample) will be randomly drawn from all samples containing target species. Default = 10.

method

Beta-diversity algorithm used to calculate theta measure. Currently available are 'additive', 'multiplicative', 'pairwise.jaccard', 'pairwise.sorensen', 'pairwise.simpson', 'multi.sorensen', 'multi.simpson', 'rao', 'beals' and 'beta.div'). See Details for available options.

beta.div.method

Argument for the function beta.div, if the method = 'beta.div'. See Details.

beta.div.sqrt.D

Argument for the function beta.div, if the method = 'beta.div'. See Details.

beta.div.samp

Argument for the function beta.div, if the method = 'beta.div'. See Details.

beals.file

Contains pre-calculated matrix of species co-occurrences. Can be used if method = 'beals' to speed up repeated calculation.

pa.transform

Logical; should the compositional data be transformed into presence-absence form? This choice applies only if method is "rao" or "beta.div", since the other methods must be calculated on presence-absence data only (for these methods the matrix is automatically transformed into p/a form).

force.subsample

Logical; should the subsampling be forced even for beta diversity metrics which are not influenced by sample size (c('pairwise.jaccard', 'pairwise.sorensen', 'pairwise.simpson', 'rao', 'beta.div'))? Default behaviour is force.subsample = FALSE, meaning that beta diversity metrics dependent on sample size (method = c('additive', 'multiplicative', 'beals', 'multi.sorensen', 'multi.simpson')) will subsample number of plots equal to psample, while method not dependent on sample size (method = c('pairwise.jaccard', 'pairwise.sorensen', 'pairwise.simpson', 'beta.div')) will be calculated using all plots containing target species. If force.subsample = TRUE, even methods not dependent on sample size will be calculated using subsampling.

parallel

Logical; should be the parallel calculation used?

no.cores

Number of cores (if parallel = TRUE). Note that in case of large datasets the calculation may be limited by RAM of the computer, and increasing number of cores may result in saturation of RAM and calculation collapse.

remove.out

Logical; should be the algorithm removing outliers (sensu Botta-Dukat 2012) applied?

verbal

Logical; if TRUE, tcltk progress bar will popup during the calculation.

juicer

Logical argument specific for launching the function from JUICE software; logical (default = F) - is the function launched from JUICE? If juicer = TRUE, function is expecting that species.data have JUICE-specific structure, which enables to import data back to JUICE.

tcltk

Logical argument specific for launching the function from JUICE sofware.

temp.matrix

Internal argument; matrix with species composition of plots containing target species.

sci.name

Internal argument; the name of the species for which the current calculation is done.

sp

Internal argument; the order of the species for which the current calculation is done.

win.pb

Internal argument.

x

Internal argument of beals.2 function; input compositional matrix.

include

Internal argument of beals.2 function; include argument from vegan::beals.

Details

Function calculate.theta calculates theta metric of species habitat specialization using range of proposed beta diversity measures; it uses internal functions calculate.theta.0 and beals.2 (modified from the library vegan) . Function calculate.theta.tcltk launches tcltk clickable interface, which enables to select methods and parameters used for calculation; this function is primarily used to be lounched externally, e.g. from JUICE program.

The function calculate.theta offers the following method argument to calculate beta diversity among samples:

Value

The function calculate.theta returns data.frame, with species in rows and the following columns:

Author(s)

David Zeleny (zeleny.david@gmail.com). Partly based on codes written by Jason Fridley (Fridley et al. 2007) and David Zeleny (Zeleny 2009), extended for other published algorithms and optimised for speed and applicability on large datasets. Function beals.2 is based on function beals from vegan, written by Miquel De Caceres and Jari Oksanen.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
sc <- sample.comm (simul.comm (totS = 100), Np= 100)
niches <- sc$simul.comm$range
additive <- calculate.theta (sc$a.mat, method = 'add')
multi <- calculate.theta (sc$a.mat, method = 'multiplicative')
beals <- calculate.theta (sc$a.mat, method = 'beals')
bray <- calculate.theta (sc$a.mat, method = 'beta.div', beta.div.method = 'percentagedifference', beta.div.sqrt.D = TRUE)
# Visualize the relationship using function pairs with Spearmann's correlation in the boxes above diagonal (see Examples in ?pairs)
panel.cor <- function(x, y, digits = 2, prefix = "", cex.cor, ...)
{
  usr <- par("usr"); on.exit(par(usr))
  par(usr = c(0, 1, 0, 1))
  r <- abs(cor(x, y, method = 'spearman'))
  txt <- format(c(r, 0.123456789), digits = digits)[1]
  txt <- paste0(prefix, txt)
  if(missing(cex.cor)) cex.cor <- 0.8/strwidth(txt)
  text(0.5, 0.5, txt, cex = cex.cor * r)
}
pairs (cbind (niches = niches[names (niches) %in% additive$sci.name], additive = additive$theta, multi = multi$theta, beals = beals$theta, bray = bray$theta), upper.panel = panel.cor)

zdealveindy/genspe documentation built on May 4, 2019, 9:13 p.m.