-1- Workshop 15: Q-mode MVA Murray Logan August 6, 2016 Table of contents 1 Q-mode Inference testing 13 2 Worked Examples 19 0.1. R-mode analyses • preserve euclidean (PCA/RDA) or χ 2 (CA/CCA) distances • based on either correlation or covariance of variables – data restricted by assumptions 0.2. Q-mode analyses • based on object similarity • unrestricted choice of similarity/distance matrix – filter data to comply • resulting scores not independent 0.3. Dissimilarity Sp1 Sp2 Sp3 Sp4 Site1 2 0 0 5 Site2 13 7 10 5 Site3 9 5 55 93 Site4 10 6 76 81 Site5 0 2 6 0 0.4. Distance measures • Euclidean distance √∑ d jk = ( y ji − y ki ) 2 > library(vegan) > vegdist(Y,method="euclidean") Site1 Site2 Site3 Site4 Site2 16.431677 Site3 104.129727 98.939375 Site4 107.944430 100.707497 24.228083 Site5 8.306624 15.329710 105.546198 107.596468
-2- 0.5. Distance measures • Bray-Curtis distance ∑ | y ji − y ki | d jk = ∑ y ji + y ki = 1 − 2 ∑ min ( y ji , y ki ) ∑ y ji + y ki > library(vegan) > vegdist(Y,method="bray") Site1 Site2 Site3 Site4 Site2 0.6666667 Site3 0.9171598 0.7055838 Site4 0.9222222 0.7019231 0.1044776 Site5 1.0000000 0.6279070 0.9058824 0.9116022 0.6. Distance measures • Hellinger distance ∑ (√ y ji √ y ki √ ) 2 d jk = ∑ y j − ∑ y k > library(vegan) > dist(decostand(Y,method="hellinger")) Site1 Site2 Site3 Site4 Site2 0.8423744 Site3 0.6836053 0.5999300 Site4 0.7657483 0.5608590 0.1092925 Site5 1.4142136 0.7918120 0.9028295 0.8159425 0.7. Multidimensional scaling • re-project objects (sites) in reduced dimensional space • must nominate the number of dimensions up-front • optimized patterns for the nominated dimensions
. . . . . . . . . . -3- 0.8. Q-mode analyses Site 6 Site 7 Site 5 Site 4 Site 8 Site 3 Site 2 Site 9 Site 10 1 e i t S Sites Sp1 Sp2 Sp3 Sp4 Sp5 Sp6 Sp7 Sp8 Sp9 Sp10 Site1 Site1 5 0 0 65 5 0 0 0 0 0 Site2 Site2 0 0 0 25 39 0 6 23 0 0 Site3 Site3 0 0 0 6 42 0 6 31 0 0 Site4 Site4 0 0 0 0 0 0 0 40 0 14 Site5 Site5 0 0 6 0 0 0 0 34 18 12 Site6 Site6 0 29 12 0 0 0 0 0 22 0 Site7 Site7 0 0 21 0 0 5 0 0 20 0 Site8 Site8 0 0 0 0 13 0 6 37 0 0 Site9 Site9 0 0 0 60 47 0 4 0 0 0 Site10 Site10 0 0 0 72 34 0 0 0 0 0 0.9. Multidimensional scaling 1. generate distance matrix > data.dist <- vegdist(data[,-1], "bray") > data.dist Site1 Site2 Site3 Site4 Site5 Site6 Site7 Site8 Site9 Site2 0.6428571 Site3 0.8625000 0.1685393 Site4 1.0000000 0.6870748 0.5539568 Site5 1.0000000 0.7177914 0.6000000 0.2580645 Site6 1.0000000 1.0000000 1.0000000 1.0000000 0.6390977 Site7 1.0000000 1.0000000 1.0000000 1.0000000 0.5862069 0.4128440 Site8 0.9236641 0.4362416 0.2907801 0.3272727 0.4603175 1.0000000 1.0000000 Site9 0.3010753 0.3333333 0.4693878 1.0000000 1.0000000 1.0000000 1.0000000 0.7964072 Site10 0.2265193 0.4070352 0.5811518 1.0000000 1.0000000 1.0000000 1.0000000 0.8395062 0.1336406
-4- Data Distances 0.10. Multidimensional scaling 2. choose # dimensions (k=2) 0.11. Multidimensional scaling 3. random configuration Site8 ● Site10 ● Site5 ● Dimension (axis) 2 Site7 ● Site3 ● Site6 ● Site4 Site9 ● ● Site1 Site2 ● ● Dimension (axis) 1 0.12. Multidimensional scaling 4. measure Kruskal’s stress
-5- Site8 ● Data Distances Site10 ● Site5 ● Dimension (axis) 2 Ordination Site7 ● Site3 Distances ● Iterations = 0 Site6 ● Stress = 0.368 ● ● ● ● ● ● Ordination distance ● Site4 Site9 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Site1 ● ● ● ● ● ● Site2 ● ● ● ● ● ● Dimension (axis) 1 Data distance 0.13. Multidimensional scaling 5. iterate - gradient descent Site8 ● Site7 ● Data Distances Site3 ● Dimension (axis) 2 Site5 ● Ordination Distances Site10 ● Site6 ● Iterations = 1 Stress = 0.329 ● ● Site1 ● ● ● Ordination distance ● ● ● ● ● ● ● ● ● ● ● Site9 ● ● ● ● ● ● ● ● ● Site2 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Site4 ● ● ● ● ● ● ● Dimension (axis) 1 Data distance 0.14. Multidimensional scaling 6. continual to iterate
-6- Site8 ● Site4 ● Site7 ● Site5 ● Data Distances Site3 ● Dimension (axis) 2 Ordination Distances Site2 ● Iterations = 10 Stress = 0.155 ● ● Site6 ● ● Site10 ● Site9 ● Ordination distance ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Site1 ● ● ● ● ● ● ● ● ● Dimension (axis) 1 Data distance 0.15. Multidimensional scaling 7. continual (stopping criteria) Site4 ● Site8 ● Data Site5 ● Distances Dimension (axis) 2 Ordination Site3 ● Distances Site2 ● Iterations = 34 Site7 ● Stress = 0.055 ● ● ● ● ● ● ● ● ● ● ● ● ● Site6 Ordination distance ● ● ● ● ● ● ● ● ● Site9 ● Site10 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Site1 ● ● ● ● ● Dimension (axis) 1 Data distance 0.16. Multidimensional scaling
-7- 0.16.1. Stopping criteria • convergence tolerance (stress below a threshold) • the stress ratio (improvement in stress) • maximum iterations Ideally stress < 0.2 0.17. Multidimensional scaling 0.17.1. Final configuration • axes have no real meaning • operate together to create ordination space • orientation of points is arbitrary 0.18. Multidimensional scaling 0.18.1. Starting contiguration • completely random • based on eigen-analysis • repeated random starts 0.19. Multidimensional scaling 0.19.1. Procrustes rotation Site4 Site4 ● ● Site5 ● Site7 ● Site8 ● Site5 ● Site6 Site8 ● ● Site3 ● Site3 Site2 ● ● Site7 ● Site2 ● Site6 ● Site9 ● Site10 ● Site9 ● Site10 ● Site1 Site1 ● ● 0.20. Multidimensional scaling
-8- 0.20.1. Procrustes rotation Site4 Site4 Site4 Site4 Site4 Site4 Site4 ● ● ● ● ● ● ● Site5 ● Site7 ● Site8 Site8 Site8 Site8 ● ● ● ● Site5 Site5 Site5 Site5 ● ● ● ● Site8 Site8 ● ● Site5 Site5 ● ● Site6 ● Site8 ● Site3 Site3 Site3 Site3 ● ● ● ● Site3 Site3 ● ● Site2 Site2 Site3 ● ● ● Site2 Site2 Site2 Site2 ● ● ● ● Site7 Site7 Site7 Site7 Site2 ● ● ● ● Site7 Site7 ● ● ● Site6 Site6 Site6 Site6 ● ● ● ● Site6 Site6 ● ● Site9 Site9 Site9 Site9 ● ● Site10 Site10 ● ● Site10 Site10 ● ● ● ● Site9 Site9 ● ● Site10 Site10 ● ● Site9 ● Site10 ● Site1 Site1 Site1 Site1 Site1 Site1 Site1 ● ● ● ● ● ● ● Root mean square error (rmse) • rmse < 0.01, and no one > 0.005 • stopping criteria 0.21. Multidimensional scaling metaMDS() • transform and scale • generates dissimilarity • PCoA for starting config • up to 20 random starts • procrustes used to determine final config • final scores scaled – PCA-like axes rotations 0.22. Multidimensional scaling > library(vegan) > data.nmds <- metaMDS(data[,-1]) Square root transformation Wisconsin double standardization Run 0 stress 9.575935e-05 Run 1 stress 9.419141e-05 ... New best solution ... procrustes: rmse 0.02551179 max resid 0.04216078 Run 2 stress 0.0005652599 ... procrustes: rmse 0.1885613 max resid 0.2962192 Run 3 stress 0.0003846328 ... procrustes: rmse 0.128145 max resid 0.2569595 Run 4 stress 0.1071568 Run 5 stress 0.08642
Recommend
More recommend