Trace:

en:indirect_ordination_suppl

This shows you the differences between two versions of the page.

Both sides previous revision Previous revision Next revision | Previous revision | ||

en:indirect_ordination_suppl [2016/06/28 16:29] 127.0.0.1 external edit |
en:indirect_ordination_suppl [2017/10/11 20:36] (current) |
||
---|---|---|---|

Line 1: | Line 1: | ||

- | ====== Unconstrained ordination ====== | + | redirected to suppl_vars |

- | ===== Supplementary variables in unconstrained ordination ===== | + | |

- | | + | |

- | Environmental variables can be used as supplementary to interpret gradients in species composition recovered by axes of unconstrained ordination. There is a reasonable expectation that gradients of changes in species composition of communities are caused by some (unknown) environmental variables. Calculating relationship of available environmental variables with samples scores on ordination axes of unconstrained ordination can help with an interpretation of these underlying ecological gradients. | + | |

- | | + | |

- | <WRAP left round box 96%> | + | |

- | ==== R functions ==== | + | |

- | * ''envfit'' (''vegan'') - fits supplementary variables on ordination scores, using multiple regression. Tests the significance of each variable using permutation test((Note that the option to test the significance of supplementary variables passively projected onto ordination diagram is not available in CANOCO 5, where it would have to be done manually. CANOCO 5 alternative is to check the t-values reported together with results of regression coefficients - if absolute value of these t-values exceeds 2.1, one can consider them as significant (in case that number of samples minus number of supplementary variables is higher than 18) - see the CANOCO 5 manual ([[en:references|ter Braak & Šmilauer 2012]]), page 226.)). Wrapper for functions ''vectorfit'' and ''factorfit'' applied on quantitative or qualitative environmental variables, respectively. Results can be plotted onto ordination diagram using ''plot'' function. | + | |

- | * ''scores'' (''vegan'') - extract scores of samples or species on ordination axes. | + | |

- | * ''ordisurf'' (''vegan'') - projects supplementary environmental variable as a non-linear surface onto ordination diagram (using GAM model). | + | |

- | * ''p.adjust.envfit'' - home-made function (author: D. Zeleny) to adjust the p-values in the object created by the function ''envfit'', using ''p.adjust'' function. Definition is [[en:customized_functions:p.adjust.envfit|here]]. | + | |

- | </WRAP> | + | |

- | | + | |

- | ==== Examples of use ==== | + | |

- | | + | |

- | === PCA on Hellinger-standardized Vltava data with passively projected environmental variables === | + | |

- | | + | |

- | Let's use data from river valley again and calculate PCA on them, using Hellinger standardisation (on log-transformed original data): | + | |

- | <code rsplus> | + | |

- | vltava.spe <- read.delim ('http://www.davidzeleny.net/anadat-r/data-download/vltava-spe.txt', row.names = 1) | + | |

- | vltava.env <- read.delim ('http://www.davidzeleny.net/anadat-r/data-download/vltava-env.txt') | + | |

- | | + | |

- | library (vegan) | + | |

- | PCA <- rda (X = decostand (log1p (vltava.spe), method = 'hellinger')) | + | |

- | </code> | + | |

- | | + | |

- | The function ''envfit'' calculates multiple regression of environmental variable with ordination axes (environmental variable is used as dependent and selected ordination axes as explanatory variables). Significance is tested by permutation test. Vectors (for continual variables) and centroids (for categorical variables) can be projected onto ordination diagram using ''plot'' function. | + | |

- | | + | |

- | <code rsplus> | + | |

- | ef <- envfit (PCA, vltava.env [, c('ASPSSW', 'SOILDPT', 'pH')], perm = 999) | + | |

- | ef | + | |

- | </code> | + | |

- | <code> | + | |

- | ***VECTORS | + | |

- | | + | |

- | PC1 PC2 r2 Pr(>r) | + | |

- | ASPSSW -0.87822 0.47826 0.4769 0.001 *** | + | |

- | SOILDPT 0.94893 0.31549 0.2891 0.001 *** | + | |

- | pH 0.38093 0.92460 0.3885 0.001 *** | + | |

- | --- | + | |

- | Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | + | |

- | Permutation: free | + | |

- | Number of permutations: 999 | + | |

- | </code> | + | |

- | | + | |

- | The variable the most strongly related to the first two ordination axes is aspect, followed by pH and soil depth (judged by the value of r<sup>2</sup>). pH is strongly related to the second ordination axis, while soil depth and xericity to the first (according to the coefficients in PC1 and PC2 columns). | + | |

- | | + | |

- | | + | |

- | The result table contains the following columns: | + | |

- | * PC1, PC2 - relationship of the environmental variable with the first and second PCA axis. __These values are not correlation coefficients__, but coordinates of the vector head on given ordination axes assuming that the vector is of a length = 1 unit((The help function to ''envfit'' calls this '//direction cosines which are the coordinates of the heads of unit length vectors//', see ''?envfit''.)). | + | |

- | * r2 - variation explained by the multiple regression model; square-root of this value is used to scale lengths of vectors (arrows) in the ordination diagrams (variables with higher sqrt (r<sup>2</sup>) are represented by longer arrows). | + | |

- | * Pr(>r) - significance of the regression, calculated by permutation test with given number of permutations. Indicates whether the variable is related to ordination axes more than would be randomly generated one. | + | |

- | | + | |

- | The function ''envfit'' executed three permutation tests, all three with highly significant results. When the number of tested variables increases, correction for multiple testing would be desirable. In the case above, we may extract the significance values from ''ef'' object and apply Bonferroni correction using the function ''p.adjust'': | + | |

- | <code rsplus> | + | |

- | ef.adj <- ef | + | |

- | pvals.adj <- p.adjust (ef$vectors$pvals, method = 'bonferroni') | + | |

- | ef.adj$vectors$pvals <- pvals.adj | + | |

- | ef.adj | + | |

- | </code> | + | |

- | In the code above, I first copied the original ''ef'' object created by function ''envfit'' into new, ''ef.adj'' object. Then I extracted the significance values from ''ef'' (''ef$vectors$pvals'') and applied function ''p.adjust'' with Bonferroni's method of adjustment. By these adjusted values I replaced the original P-values in the copy of original results ''ef.adj''. Newly printed results show adjusted P-values: | + | |

- | <code> | + | |

- | ***VECTORS | + | |

- | | + | |

- | PC1 PC2 r2 Pr(>r) | + | |

- | ASPSSW -0.87822 0.47826 0.4769 0.003 ** | + | |

- | SOILDPT 0.94893 0.31549 0.2891 0.003 ** | + | |

- | pH 0.38093 0.92460 0.3885 0.003 ** | + | |

- | --- | + | |

- | Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | + | |

- | Permutation: free | + | |

- | Number of permutations: 999 | + | |

- | </code> | + | |

- | | + | |

- | Alternatively, you can use custom-build function ''p.adjust.envfit'' (definition [[en:customized_functions:p.adjust.envfit|here]]), giving exactly the same results as above. | + | |

- | First, source the definition of this custom made function from this website: | + | |

- | <code rsplus> | + | |

- | source ('http://www.davidzeleny.net/anadat-r/doku.php/en:customized_functions:p.adjust.envfit?do=export_code&codeblock=0') | + | |

- | </code> | + | |

- | ... and just use it (the results should be the adjusted results above): | + | |

- | <code rsplus> | + | |

- | ef.adj <- p.adjust.envfit (ef) | + | |

- | ef.adj | + | |

- | </code> | + | |

- | | + | |

- | To draw the variables onto the ordination diagram, use the function ''plot'' on the object of the class ''envfit''. This is a low-level graphical function, which means that it adds the vectors (for quantitative variables) or centroids (for qualitative variables) of the environmental variables into already existing ordination diagram: | + | |

- | <code rsplus> | + | |

- | ordiplot (PCA, display = 'sites') | + | |

- | plot (ef) | + | |

- | </code> | + | |

- | {{:obrazky:ordination_unc15.png|}} | + | |

- | | + | |

- | In case of PCA, the coordinates of the arrow heads on the ordination axes represent the values of Pearson's correlation coefficient between the variable and given ordination axis (in case of other unconstrained ordination - CA, DCA or NMDS - the situation is more complicated and the link is not that straightforward). To confirm this, let's calculate correlation of each environmental variable with each ordination axis. | + | |

- | | + | |

- | To get scores of samples (or species) on ordination axes, we need function ''scores'' (applicable on object created by ''vegan'' ordination functions: | + | |

- | | + | |

- | <code rsplus> | + | |

- | scores.pca <- scores (PCA, display = 'sites', choices = 1:2) | + | |

- | scores.pca | + | |

- | </code> | + | |

- | <code> | + | |

- | PC1 PC2 | + | |

- | 1 -0.36770382 0.178399044 | + | |

- | 2 -0.46395458 0.209974936 | + | |

- | 3 -0.26899925 0.127517062 | + | |

- | 4 -0.32793000 0.254319805 | + | |

- | 5 0.03691218 0.536838689 | + | |

- | 6 0.22455684 0.622463000 | + | |

- | ... | + | |

- | </code> | + | |

- | (argument ''display'' specifies that we want scores of ''sites'', not ''species'', and argument ''choices'' points to ordination axes we want to extract - the first two). | + | |

- | | + | |

- | Correlation between each environmental variable and each axis scores can be calculated as follows: | + | |

- | <code rsplus> | + | |

- | cor (vltava.env [, c('ASPSSW', 'SOILDPT', 'pH')], scores.pca) | + | |

- | </code> | + | |

- | <code> | + | |

- | PC1 PC2 | + | |

- | ASPSSW -0.6065085 0.3302958 | + | |

- | SOILDPT 0.5101798 0.1696164 | + | |

- | pH 0.2374247 0.5762849 | + | |

- | </code> | + | |

- | | + | |

- | We get exactly the same values if we take results of the function ''envfit'' and multiply each value in the column PC1 and PC2((To see the structure of the object returned by function ''envfit'', use the function ''str'' - e.g. ''str (ef)'' in this case. The object is list of lists, containing all relevant information. The printed version which is printed into command line when we type ''ef'' is product of the function ''print.envfit'', which is automatically called when the ''envfit'' object is evaluated.)) by it's appropriate sqrt (r2): | + | |

- | | + | |

- | <code rsplus> | + | |

- | arrow_heads <- ef$vectors$arrows # extracts matrix of coordinates of arrow heads from ef | + | |

- | r2 <- ef$vectors$r # extracts vector of r2 for each env. variable | + | |

- | arrow_heads * sqrt (r2) | + | |

- | </code> | + | |

- | <code> | + | |

- | PC1 PC2 | + | |

- | ASPSSW -0.6065085 0.3302958 | + | |

- | SOILDPT 0.5101798 0.1696164 | + | |

- | pH 0.2374247 0.5762849 | + | |

- | attr(,"decostand") | + | |

- | [1] "normalize" | + | |

- | </code> | + | |

- | | + | |

- | Note that these values are identical to Pearson's correlation coefficients in the table above. But this is true only for PCA, in which ordination scores are standardized to unit variance. In case of other unconstrained ordination, standard deviations of individual axes differ, and regression coefficients in multiple regression do not correspond to Pearson's correlation coefficients. Additionally, unimodal methods (DCA, CA) are using weighted multiple regression, with weights of samples reflecting their importance in analysis((Weights are basically sums of species presences-absences/abundances in samples, meaning that samples with more species (in case of presence-absence data) or higher overall species abundances (in case of abundance data) have higher weight in the regression.)). | + | |

- | | + | |

- | | + | |

- | | + | |

- | === Projecting environmental variable onto ordination as nonlinear surface === | + | |

- | | + | |

- | This can be done using function ''ordisurf'' from ''vegan''. It draws the surface of fitted environmental variable into ordination diagram using GAM models. This is fancy option in case that you don't expect linear relationship between ordination axis and environmental variable, or you don't want to relate the environmental variables directly to ordination axes (the latter may seem as relevant argument in case of NMDS, which is basically a method free of ordination axes((There is persistent discussion whether it is logical/possible/allowed to project supplementary environmental variables onto NMDS ordination diagram. See e.g. opinion of Jari Oksanen on this topic in [[http://vegan.r-forge.r-project.org/FAQ-vegan.html#I-have-heard-that-you-cannot-fit-environmental-vectors-or-surfaces-to-NMDS-results-which-only-have-rank_002dorder-scores|vegan's FAQ list]], which clarifies some misunderstanding related to NMDS non-metricity.))). | + | |

- | | + | |

- | To add e.g. pH into PCA ordination diagram using data from Vltava as in the example above, use the function ''ordisurf''. This function is both high- and low-level graphical function, meaning that it can either created the whole new ordination diagram and add the surface in it, or it can only add the surface into already existing ordination diagram (use argument ''add = TRUE''): | + | |

- | <code rsplus> | + | |

- | ordisurf (PCA, vltava.env[, 'pH'], main = 'pH + SOILDPT') | + | |

- | ordisurf (PCA, vltava.env[, 'SOILDPT'], add = T, col = 'green') | + | |

- | legend ('topleft', col = c('red', 'green'), lty = 1, legend = c('pH', 'SOILDPT')) | + | |

- | </code> | + | |

- | In this script, the first ''ordisurf'' draws new ordination diagram and adds pH values in it (including the title using argument ''main''). The second application of ''ordisurf'' adds the surface of soil depth variable, using different color (argument ''col''). We may also add the ''legend'' to ease the interpretation of the surface colors. | + | |

- | {{:obrazky:ordination_unc16.png|}} | + | |

- | | + | |

- | === Use of mean Ellenberg indicator values as supplementary variables === | + | |

- | Ellenberg indicator values are species attributes summarizing species optima along important ecological gradients (temperature, light, soil reaction, nutrients, moisture, continentality and salinity). Calculated mean of species indicator values occurring in particular plot (weighted or not by species abundances) are considered as useful estimates of habitat conditions inferred from species composition. These mean Ellenberg indicator values (mean EIVs) are commonly used in analysis of vegetation data, unfortunately often not appropriately (Zelený & Schaffers 2012). One example of common use is to project mean EIVs as supplementary onto ordination diagrams. Since both mean EIVs and scores on ordination axes are derived from the same species composition data, their relationship is likely to be biased in terms of correlation coefficients (in case of correlation) or //r//<sup>2</sup> (in case of regression) and also in terms of significance values. Namely, the correlation coefficient or //r//<sup>2</sup> tends to be higher and the values tend to be more often significant than would correspond to reality. | + | |

- | | + | |

- | An obvious solution is not to test the relationship of mean EIVs with ordination axes at all. Alternatively, one can use more conservative modified permutation test, which is NOT permuting the values of samples (either mean EIVs values or scores on ordination axes), but permuting the species attributes among species before calculating weighted mean (see Zelený & Schaffers 2012 and also [[http://davidzeleny.net/wiki/doku.php/eiv:start|this website]]). This modified permutation test is implemented in the function ''envfit.iv'' (Appendix S2 in Zelený & Schaffers 2012, calculating modified permutation test for multiple regression of mean EIVs with ordination axes). | + | |

- | | + | |

- | First, let's see what happens if we calculate regression between ordination axes and mean EIVs directly, without any modifications. Mean Ellenberg indicator values are in columns 23 to 28 of ''vltava.env'' data frame: | + | |

- | <code rsplus> | + | |

- | mean.eiv <- vltava.env[,23:28] | + | |

- | ef.eiv <- envfit (PCA, mean.eiv) | + | |

- | ef.eiv | + | |

- | </code> | + | |

- | <code> | + | |

- | ***VECTORS | + | |

- | | + | |

- | PC1 PC2 r2 Pr(>r) | + | |

- | LIGHT -0.84253 0.53864 0.7165 0.001 *** | + | |

- | TEMP -0.66254 0.74903 0.3868 0.001 *** | + | |

- | CONT -0.75163 0.65958 0.1298 0.001 *** | + | |

- | MOIST 0.80000 0.60000 0.6094 0.001 *** | + | |

- | REACT 0.75880 0.65133 0.6846 0.001 *** | + | |

- | NUTR 0.98471 0.17421 0.7674 0.001 *** | + | |

- | --- | + | |

- | Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | + | |

- | Permutation: free | + | |

- | Number of permutations: 999 | + | |

- | </code> | + | |

- | | + | |

- | All six mean EIVs are highly significantly related to the first two PCA ordination axes. | + | |

- | | + | |

- | The problem is, that even if species attributes (here Ellenberg indicator values) are random variable, there is rather high probability that mean of these random values will be also significantly correlated to ordination axes. Let's assign each species random value (using function ''rnorm'') and use these random values to calculate mean EIVs: | + | |

- | | + | |

- | <code rsplus> | + | |

- | set.seed (1234) | + | |

- | rand.ell <- matrix (rnorm (274*6), nrow = 274, ncol = 6) | + | |

- | </code> | + | |

- | | + | |

- | To calculate mean of random EIVs, we may use this simple customized function: | + | |

- | <code rsplus> | + | |

- | w.mean <- function (veg, spec.iv, pres.abs = F) | + | |

- | { | + | |

- | if (pres.abs) veg <- vegan:::decostand (veg, 'pa') | + | |

- | apply (spec.iv, 2, FUN = function (x) | + | |

- | { | + | |

- | veg.temp <- veg[,!is.na (x)] | + | |

- | x.temp <- x[!is.na (x)] | + | |

- | colSums (t(veg.temp)*x.temp)/rowSums (veg.temp) | + | |

- | }) | + | |

- | } | + | |

- | </code> | + | |

- | (the function has three arguments: ''veg'' for matrix of species composition, ''spec.iv'' for vector or matrix of species attributes (e.g. Ellenberg values) and ''pres.abs'' - if TRUE, the species data are transformed into presence absence form first and the mean is not weighted by abundances). | + | |

- | | + | |

- | Now, let's calculate the mean of random species attributes, and tests it's relationship with ordination axes using ''envfit'' function: | + | |

- | | + | |

- | <code rsplus> | + | |

- | mean.rand.eiv <- w.mean (vltava.spe, rand.ell, pres.abs = T) | + | |

- | ef.rand <- envfit (PCA, mean.rand.eiv) | + | |

- | ef.rand | + | |

- | </code> | + | |

- | <code> | + | |

- | ***VECTORS | + | |

- | | + | |

- | PC1 PC2 r2 Pr(>r) | + | |

- | [1,] 0.42347 0.90591 0.2969 0.001 *** | + | |

- | [2,] 0.99994 0.01055 0.5124 0.001 *** | + | |

- | [3,] 0.64532 -0.76391 0.4653 0.001 *** | + | |

- | [4,] -0.09964 -0.99502 0.0247 0.333 | + | |

- | [5,] 0.83329 -0.55284 0.2527 0.001 *** | + | |

- | [6,] -0.98172 -0.19035 0.1470 0.002 ** | + | |

- | --- | + | |

- | Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | + | |

- | Permutation: free | + | |

- | Number of permutations: 999 | + | |

- | </code> | + | |

- | (if you use the same set.seed value before generating random species attributes, you should get identical results). | + | |

- | From six randomly generated species attributes (which may represent e.g. Ellenberg indicator values, where you by accident mixed the species values between species), five are significantly related to ordination axes, even though they do not have any ecological meaning. | + | |

- | | + | |

- | The way to solve this problem is to use the modified permutation test, and customized function ''envfit.iv''. | + | |

- | | + | |

- | First, define the ''envfit.iv'' function (simply by sourcing it from this website): | + | |

- | <code rsplus> | + | |

- | source ('http://www.davidzeleny.net/anadat-r/doku.php/en:customized_functions:envfit.iv?do=export_code&codeblock=1') | + | |

- | </code> | + | |

- | | + | |

- | Then, just use it with the original Ellenberg species values (note that the matrix of species composition in argument ''veg'' is transformed into presence-absence data, not to weight the species attributes by species abundances): | + | |

- | <code> | + | |

- | ef.ell.modif <- envfit.iv (PCA, veg = decostand (vltava.spe, 'pa'), spec.iv = vltava.ell ) | + | |

- | ef.ell.modif | + | |

- | </code> | + | |

- | <code> | + | |

- | ***VECTORS | + | |

- | | + | |

- | PC1 PC2 r2 Pr(>r) | + | |

- | light -0.84175 0.53986 0.7161 0.001 *** | + | |

- | temp -0.66148 0.74997 0.3862 0.069 . | + | |

- | cont -0.74592 0.66603 0.1309 0.530 | + | |

- | moist 0.80007 0.59990 0.6097 0.004 ** | + | |

- | react 0.75902 0.65107 0.6846 0.001 *** | + | |

- | nutr 0.98474 0.17404 0.7671 0.001 *** | + | |

- | --- | + | |

- | Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | + | |

- | </code> | + | |

- | The situation now is rather different - continentality is no longer significant, and the significance of temperature became marginally significant (P = 0.69) compared to standard ''envfit'' function. | + | |

- | | + | |

- | By the way, how does this function work if we use it with those randomly generated variables? | + | |

- | <code rsplus> | + | |

- | set.seed (1234) | + | |

- | ef.rand.modif <- envfit.iv (PCA, veg = decostand (vltava.spe, 'pa'), spec.iv = rand.ell) | + | |

- | ef.rand.modif | + | |

- | </code> | + | |

- | <code> | + | |

- | ***VECTORS | + | |

- | | + | |

- | PC1 PC2 r2 Pr(>r) | + | |

- | [1,] 0.42347 0.90591 0.2969 0.163 | + | |

- | [2,] 0.99994 0.01055 0.5124 0.018 * | + | |

- | [3,] 0.64532 -0.76391 0.4653 0.037 * | + | |

- | [4,] -0.09964 -0.99502 0.0247 0.915 | + | |

- | [5,] 0.83329 -0.55284 0.2527 0.243 | + | |

- | [6,] -0.98172 -0.19035 0.1470 0.481 | + | |

- | --- | + | |

- | Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | + | |

- | | + | |

- | </code> | + | |

- | The predominance of significance disappeared, but still two attributes are related to ordination axes with P < 0.05. This is perhaps caused by multiple testing issue - we are conducting six independent significance tests at the level of significance P < 0.05, so there is fair probability that at least one of the results will be significant. Also, since the species attributes are randomly generated, it may happen that some of them will really be "lucky" and their values will partly reflect species ecological behaviour. To test the real efficiency of this test, we would need to repeat this test many times with many randomly generated random species values. | + | |

- | | + | |

- | Finally, let's project the mean Ellenberg indicator values onto the original ordination diagram: | + | |

- | <code rsplus> | + | |

- | ordiplot (PCA, display = 'sites') | + | |

- | plot (ef.ell.modif, col = 'gray') | + | |

- | plot (ef.ell.modif, col = 'red', p.max = 0.05) | + | |

- | </code> | + | |

- | {{ :obrazky:ordination_unc16.1.png?nolink|}} | + | |

- | ---- | + | |

- | | + | |

- | | + | |

- | ===== Exercise 1 ===== | + | |

- | Use [[en:data:simul|simulated data]], namely the artificial community data generated as response species along two simulated environmental gradients: ''simul.short.spe'' and ''simul.short.env''. | + | |

- | | + | |

- | -Calculate NMDS ordination (use Bray-Curtis distance); | + | |

- | -draw ordination diagram with sites and species, and with title reading "Artificial community data"; | + | |

- | -add to ordination diagram isolines for the environmental variables ''gradient1'' and ''gradient2'' from the data frame ''simul.short.env'' (use different colors for each variable - I used ''navy'' and ''lightblue'', but feel free to choose your favourite combination from 657 options in ''colors ()''); | + | |

- | -add legend to the top right corner with color-key to the surface isolines. | + | |

- | <hidden For hints click here ☛> | + | |

- | - Use ''metaMDS'' to calculate NMDS ordination. | + | |

- | - ''ordiplot'' with argument ''main'' | + | |

- | - You need to apply ''ordisurf'' function with argument ''add = TRUE'' twice, because it can calculate surface for only one variable at time. | + | |

- | - ''legend'', without borders (argument ''bty = "n"'' - border type is none), and adding also the lines - you need to specify one argument related to lines, e.g. line type (''lty = 1''), which will force ''legend'' to add lines in it. | + | |

- | </hidden> | + | |

- | | + | |

- | {{:obrazky:ordination_unc_ex7.png|}} | + | |

- | | + | |

- | [[en:indirect_ordination_suppl:solution_ex1|Solution]] | + | |

- | | + | |

- | ===== Exercise 2 ===== | + | |

- | | + | |

- | In this exercise you will see what happens when you passively project randomly generated supplementary (environmental) variables onto an ordination diagram, and how to interpret whether they are meaningful or not. | + | |

- | | + | |

- | Use [[en:data:vltava|Vltava data]] - you need to import both ''vltava.spe'' and ''vltava.env'' data frames into R. | + | |

- | - Calculate tb-PCA on log-transformed Vltava data (PCA on Hellinger-transformed data, for which you first log-transformed the original species composition data); | + | |

- | - draw ordination diagram only with sites, with symbols reflecting (by shape and colour) classification of samples into vegetation types (according to ''vltava.env$GROUP''); | + | |

- | - generate nine random variables (e.g. using function ''rnorm'') and project them as explanatory onto the the ordination diagram; | + | |

- | - report significance of relationship between these randomly generated variables and ordination axes; | + | |

- | - consider using Bonferroni correction for multiple testing on results before you interpret them. | + | |

- | | + | |

- | <hidden For hints click here ☛> | + | |

- | - ''rda'', ''decostand'', ''log1p''; | + | |

- | - ''ordiplot'' with arguments ''display = "sites"'' and ''type = "none"'' to draw no points; add points using function ''points'' with arguments ''col'' and ''pch''; | + | |

- | - function ''rnorm (n)'' generates //n// random values drawn from normal distribution; you can create matrix of nine columns and ''nrow (vltava.spe)'' rows to generate nine random supplementary variables; use ''envfit'' and ''plot'' to add these variables onto ordination diagram; | + | |

- | - are random variables significant? | + | |

- | - ''p.adjust'' | + | |

- | </hidden> | + | |

- | [[en:indirect_ordination_suppl:solution_ex2|Solution]] | + | |

en/indirect_ordination_suppl.txt · Last modified: 2017/10/11 20:36 (external edit)