Transitivity – a FORTRAN program for the analysis of ... · of the strength of competition and...
Transcript of Transitivity – a FORTRAN program for the analysis of ... · of the strength of competition and...
Transitivity 1
Transitivity – a FORTRAN program for the analysis of multivariate competitive
interactions Version 1.1
Werner Ulrich
Nicolaus Copernicus University in Toruń
Chair of Ecology and Biogeography
Lwowska 1, 87-100 Toruń; Poland
e-mail: ulrichw @ umk.pl
Latest update: 16.12.2013
1. Introduction
Species differ in their competitive ability, and
these differences may translate to observed inequali-
ties in species’ relative abundances within multi-
species assemblages. Ecologists have devoted much
effort inferring competitive processes from observed
patterns of species abundances and morphology, and
from changes in the temporal and spatial distribution
of species (Chesson 2000).
Many theoretical models of competitive inter-
actions assume that species can be ranked unequivo-
cally (A>B>C…>Z) according to their competitive
strength or resource utilization efficiency (Tilman
1988). However, intransitive competitive networks
(Gilpin 1975) can generate loops in the hierarchy of
competitive strength (e.g. the rock-scissors-paper
game, in which A>B>C>A). Theoretical studies have
shown that competitive intransitivity can moderate the
effects of competition, allowing weak competitors to
coexist with strong ones (Laird and Schamp 2006).
Despite the conceptual simplicity of intransi-
tive competitive hierarchies, the empirical estimation
of the strength of competition and the frequency of
competitive intransitivity in nature has proven diffi-
cult. The Fortran 95 software Transitivity is based up-
on the construction of patch transition matrices (P),
such as those used in Markov chain models as pro-
posed by Ulrich et al. (2013). The basis is a randomi-
zation test to evaluate the degree of intransitivity from
these P matrices in combination with empirical or sim-
ulated C matrices. Ulrich et al. (2013) related empiri-
cally-derived competition matrices C to an explicit
colonization-interaction model to obtain patch transi-
tion matrices P and used a ‘reverse engineering’ ap-
proach to infer the structure of the competition (C) and
the transition (P) matrices from an empirical (temporal
or spatial) A matrix. There is no unique solution to this
problem because a large number of different competi-
tion matrices (C) can generate the same patch transi-
tion matrix (P) that will reproduce the A matrix. How-
ever, by simulating a large set of stochastically created
C matrices, the set of matrices that provide the best fit
to an empirical A matrix can be analyzed with respect
to their transitivity patterns.
2. Metrics and Reversed engineering
Ulrich et al. (2013) used a simple Markov chain
model that predicts relative abundances. In this model,
a m m patch transition matrix P describes the proba-
2 Transitivity
bility pij of a transition from a patch occupied by spe-
cies i to a patch occupied by species j in a single time
step.
If the probabilistic outcome of species interac-
tions are fully described by the entries of C, Ulrich et
al.
(2013) calculated the patch transition matrix P in
terms of the competi-
tion matrix C.
The model as-
sumes:
1. There are many homogeneous patches, each of
which can be colonized and occupied by individuals of
a set of m species;
2. All species produce a large number of potential
propagules, so there is a ‘propagule rain’, and coloni-
zation is never limited by dispersal limitation;
3. Only a single species can occupy one patch at a
time;
4. In a single time-step, a species occupying a patch
either retains its occupancy or is replaced by a differ-
ent species;
5. During a single time-step, each resident species in a
patch may potentially engage in a pairwise competi-
tive encounter with all remaining (m − 1) species that
do not occupy that patch. The (m − 1) invading species
may all interact with the resident species and each one
can potentially replace it;
6. Within a time step, the order in which the potential-
ly invading species encounter the resident is random;
7. During a single time step, one of the invading spe-
cies replaces the resident species, or the resident spe-
cies persists in the patch;
8. Local dispersal limitation is not important and the
set of patches is spatially unstructured.
To generate the formula for pij, i, j = 1, ...,m, for
an arbitrary m, we need the following notation: given a
set A = {a1, ..., an} of species with the corresponding
competition matrix C, let P(A)[aj → ai] denote the
probability that species aj is replaced by ai, i, j = 1, ...,
n.
Within this notation: for 1 ≤ i ≠ j ≤ m
and for 1 ≤ i ≤ m
These equations generate the required transition
matrix P for an arbitrary number m of species in terms
of competitive strength matrices for sets consisting of
(m − 1) species.
The calculation of the total probability for all pij
of the transition matrix P from the entries of the com-
petition matrix C needs the evaluation of all combina-
tions of cik (k ≠ i,j). Because this becomes computa-
tionally challenging at higher species richness Transi-
tivity uses the approximation introduced by Ulrich et
al. (2013)
where is the geometric average of the respective cik
values.
To estimate the degree of intransitivity in a giv-
en community, we need first to estimate the transition
matrix P from an observed distribution of species
abundances or occurrences (Ulrich et al. 2013). De-
pending on the data, there are three different scenarios.
The first and most obvious approach relies on appro-
priate time series data. If data are available from at
least t+1 time steps, the single abundance vectors of
each step can be converted into two matrices N1,t,
which runs from generation 1 to t, and N2,t+1, which
runs from generation 2 to t+1. Combining these two
matrices yields:
P = N2,t+1 N1,tT (N1,tN1,t
T)-1
where T denotes the transpose. This approach
allows for the estimation of the P matrix from an A
matrix of consecutive temporal censuses of an assem-
blage. To estimate P Transitivity uses a ‘reverse engi-
neering’ approach and generates n = 100,000 random-
ly assembled C matrices, in which each entry above
the diagonal in the C matrix is chosen from a random
uniform [0,1] distribution. It then transformed the ran-
domly assembled C matrices into P transition matrices
Transitivity 3
to predict the N2,t+1 matrices from our Markov chain
model. The software uses average rank order correla-
tions between respective columns in the predicted and
observed N2,t+1 matrices to assess goodness of fit, and
selects those P and C matrices that generated the best
fit to the observed vector of relative abundances.
The second approach is based on spatial abundance
data for m species collected at i = 1 to n sites for which
environmental variables are available. Ulrich et al.
(2013) partitioned the variance of species abundances
into a part explained by competitive effects and a sec-
ond part explained by the environmental variables:
PU=U+E. Using multiple regression they received in
P = I + XTHTUT(UUT)-1
with U being an mn matrix of species relative abun-
dances among n sites, H being the nh matrix of h
environmental variables, X being the vector of regres-
sion parameters that solves UT=HX, and I being the
m×m identity matrix.
As with time series data, the software uses the
‘reverse engineering’ approach to compare predicted
and observed environmental terms E = XTHT to find
those C and P matrices that best mimic the observed
abundance distributions. For the environmental calcu-
lations the abundance data contained in the abundance
vector A are initially ln(x) transformed (leaving zero
counts unchanged) with x being the adjusted absolute
abundances where the least abundant species has at
least abundance x=1. To avoid undesired effects of
differential measurements the environmental variables
are Z-transformed. After multiple regression the re-
sulting vector U is back transformed.
The third approach uses spatial data only and
tries to identify the best fitting C and P matrices di-
rectly from the matrix of observed relative abundances
at n sites using reversed engineering (Ulrich et al.
2013).
3. Metrics of transitivity
Transitiv estimates transitivity of C matrices by
(i<j)
Where N is a count of species pairs for which
cij < cji after the matrix has been sorted to maximize
the number of matrix elements with p > 0.5 in the up-
per right triangle (Ulrich et al. 2013). Accordingly
transitivity in the P matrix is estimated by
(i<k and i,k≠j)
4. Program run
Transitivity first asks for the method to esti-
mate the degree of transitivity. The options are envi-
ronmental date (e), time series data (t), or as the de-
fault abundance data only (n).
Next the program asks whether to calculate
bivariate competitive strength matrices C (option b) or
only transition matrices P (option p). In the first case
the output contains also the respective P matrices.
Then give the names of the output and matrix
file names. Both are shown in the two Figures below.
Carriage returns assign the default names Output.txt
and Matrix.txt.
The default number of random matrices C or P
is 100,000. You can change this number with the next
option.
As a standard, Transitivity eliminates empty
rows and columns from the abundance matrix. You
can choose whether to retain these. Of course, the in-
put matrix should in general not contain empty col-
umns, because they have no sound ecological interpre-
tation in the present context. However, in some cases
you may wish to retain empty rows, for instance in
automatic data processing of large data sets or for
comparison of patterns with and without focal species.
The last option regards the input files. Give
them with extension (example: file.txt). In the case of
multiple runs a carriage return results in the question
for the name of the file that contains the matrix file
4 Transitivity
names for multiple analysis (cf. the example above).
The first line of the batch file has to be a comment
line. All of the files have to be in the same directory.
Input files have to be space delimited. Tab delimita-
tion is not allowed.
In the case of the time series and abundance
only approaches you need a single input files as shown
above. For the environmental variable approach the
software asks for a second file that contains the re-
spective variables.
5. Output
Transitivity returns two output files. The first,
Matrix.txt, contains the species abundance matrix, the
abundance distribution, best fit transition and competi-
tion matrices as well as the observed and predicted
(dominant eigenvector of the transition matrix) abun-
Transitivity 5
dance distributions.
The second file, Output.txt, gives the file
name, method used (predicting competition and transi-
tion matrices (b) or transition matrices only (p)), the
benchmark limit and matrix match (see below), the
numbers of best fitting competition or transition matri-
ces used for the calculation of confidence limits, num-
bers of species and sites, and four metrics. The first
(Metric1) is either C (in the case of the method = ’b’
option) or P (in the case of the method = ’p’ option)
of the best performing competition or transition ma-
trix. Next, the mean metric value and the lower
(DownCL) and upper (UpCL) 95% confidence limit of
the NBestFit performing matrices are given (in the
example below only the best fitting: NBestFit =1).
Then, the probability is given that the predicted degree
of transitivity is less than 1.0. Finally, in the case of
the environmental approach the software provides the
average coefficient of determination (r2) of the multi-
ple regressions of each species involved.
An important point regards the BenchM and
Match output. The reverse engineering procedure uses
rank order correlation to compare predicted abundanc-
es and observed abundances and retains as a default
those competition and transition matrices that predict
abundances that are correlated with the observed ones
by r > 0.95. If less than NBestFit (default = 100) out
6 Transitivity
of the 100,000 random test matrices fulfil this criterion
the threshold is reduced by a step of 0.1, thus the sec-
ond threshold is r = 0.85. The software reduces the
threshold as long as sufficient (k = NBestFit) test ma-
trices fulfil the required correlation. In the case shown
in the software window the threshold was r = 0.0 and
the abundances predicted by the single best fit compe-
tition matrix correlated weakly (r = 0.443) with the
observed abundances across the sites. That means even
100,000 random competition matrices were not able to
mimic observed abundances. In such a case the fit is
very low and the predicted degree of intransitivity is
not very reliable. This is a strong indication that other
factors overrule competition and that competitive ef-
fects are not the major driver to determine species
abundances. The correlation for the right eigenvector
can be inferred from the Matrix.txt file where observed
and predicted abundances of the best fit are given.
6. Citing Transitivity
Transitivity is freeware but nevertheless if you
use Turnover in scientific work you should cite Tran-
sitivity as follows:
Ulrich W. 2012. Transitivity – a FORTRAN program
for the analysis of bivariate competitive interactions.
Version 1.1. www.keib.umk.pl.
7. System requirements
Transitivity is written in FORTRAN 95, has
been compiled under a 64 bit architecture, and runs
under Windows 8, 7, XP, and Vista. The present ver-
sion is only limited by the computer’s memory.
8. Acknowledgements
Development of this program was supported
by grants from the Polish Science Committee (KBN, 3
P04F 034 22, KBN 2 P04F 039 29 ).
9. References
Chesson, P. 2000. Mechanisms of maintenance
of species diversity. Annual Review of Ecology and
Systematics 31: 343–366.
Gilpin, M. E. 1975. Limit cycles in competi-
tion communities. American Naturalist 109: 51–60.
Laird, L. A. and B. S. Schamp. 2006. Competi-
tive intransitivity promotes species co-existence.
American Naturalist 168: 182-193.
Tilman, D. 1988. Plant Strategies and the Dy-
namics and Structure of Plant Communities. Mono-
graphs in Population Biology 26. Princeton University
Press, Princeton.
Ulrich, W., Soliveres, S., Kryszewski W.,
Maestre F. T., Gotelli, N. J. 2014. Matrix models for
quantifying competitive intransitivity. Oikos, in press.