Theory, Examples & Exercises
This is an old revision of the document!
Note: variation partitioning is sometimes also called commonality analysis in reference to the common (shared) fraction of variation (Kerlinger & Pedhazur 1973). It is also a synonym to variance partitioning1).
In case we have two or more explanatory variables, one may be interested in variation in species composition explained by each of them. If some of these explanatory variables are correlated, one must expect that variation explained by the first or the other variable cannot be separated - it will be shared.
The way how to approach this problem is variation partitioning, when variation explained by each variable (or set of variables) independently (marginal variation) is partitioned into variation attributable purely to given environmental variable (partial variation), and shared variation attributable to two or more variables.
Variation can be partitioned into individual variables (e.g. variation explained by soil pH vs variation explained by soil Ca) or into groups of variables (e.g. soil variables vs climatic variables).
Result can be visualized using Venn's diagram (see figure on the right). Meaning of the fractions in Venn's diagram is the following2):
If the variation is partitioned among groups with the same number of variables (e.g. two soil and two climatic variables), than variation explained by each group is comparable without adjustement. However, if groups contain different numbers of variables, variation explained by not adjusted R2 is not comparable, since R2 tends to increase with the number of explanatory variables. Here, use of adjusted R2 is recommended.
vegan offers function
varpart, which can partition variation among up to four variables (or groups of variables). Note that
varpart is based on redundancy analysis (
rda) and uses adjusted R2 to express explained variation. The reason for using only
rda is that in R, there is still no function available to calculate adjusted R2 for unimodal ordination methods (like
vegan) - variation partitioning (using linear constrained ordinatino -
rda) among up to four matrices of environmental variables. First argument (
Y) is dependent (usually species composition) matrix (but could be also only one variable - in that case
varpartis conductin linear regression). Next arguments (up to four) are (groups of) explanatory variables. Uses either formula interface (with ~) or matrices.
Example: how much variation in species data (
vasc.hell) explains variables
# Carpathian wetlands - import data vasc <- read.delim ('http://www.davidzeleny.net/anadat-r/data-download/vasc_plants.txt', row.names = 1) chem <- read.delim ('http://www.davidzeleny.net/anadat-r/data-download/chemistry.txt', row.names = 1) # transform data using Hellinger transformation vasc.hell <- decostand (vasc, 'hell') # upload library vegan if not yet done library (vegan) # apply function varpart vp1 <- varpart (vasc.hell, ~ Mg, ~ Ca, data = chem)
In this function, the first is coming the species matrix, than explanatory matrices (or variables) - if using
formula interface, each has to start with tilda (~). If these variables are part of matrix of explanatory variables, you need to specify the environmental matrix in argument
Partition of variation in RDA Call: varpart(Y = vasc.hell, X = ~Mg, ~Ca, data = chem) Explanatory tables: X1: ~Mg X2: ~Ca No. of explanatory tables: 2 Total variation (SS): 39.151 Variance: 0.56741 No. of observations: 70 Partition table: Df R.squared Adj.R.squared Testable [a+b] = X1 1 0.11987 0.10693 TRUE [b+c] = X2 1 0.13898 0.12632 TRUE [a+b+c] = X1+X2 2 0.16357 0.13860 TRUE Individual fractions [a] = X1|X2 1 0.01228 TRUE [b] 0 0.09465 FALSE [c] = X2|X1 1 0.03167 TRUE [d] = Residuals 0.86140 FALSE --- Use function 'rda' to test significance of fractions of interest
Alternative way how to use the function is not using
varpart (vasc.hell, chem$Mg, chem$Ca)
or, in case you use not-transformed data and you want them to be transformed (using
varpart (vasc, chem$Mg, chem$Ca, transfo = 'hell')
transfo is passed into function
decostand together with species data).
I can also plot directly so called Venn's diagram: