1 Packages and data

# install the ape package by running install.packages()
install.packages("ape", repos = "http://cran.us.r-project.org")
# load the tidyverse package in your current R session
library(tidyverse)

# load the ggplot2 package in your current R session
library(ggplot2)

# load the patchwork package in your current R session
library(patchwork)

# load the fishualize package in your current R session
library(fishualize)

# load the vegan package in your current R session
library(vegan)

# load the ape package in your current R session
library(ape)

Read in datasets to use with community analysis

# re-familiarize with the Lizard Island fish community dataset
lfish <- read.csv(file =  "data/fishcoms_lizardisland.csv")
head(lfish)
##   X       Site  Exposure year depth transect         Family
## 1 1 Big Vickis Sheltered 2011  deep        1   Acanthuridae
## 2 2 Big Vickis Sheltered 2011  deep        1   Acanthuridae
## 3 3 Big Vickis Sheltered 2011  deep        1   Acanthuridae
## 4 4 Big Vickis Sheltered 2011  deep        1     Balistidae
## 5 5 Big Vickis Sheltered 2011  deep        1 Chaetodontidae
## 6 6 Big Vickis Sheltered 2011  deep        1 Chaetodontidae
##       Functional.Group  species abundance
## 1               Grazer aca.bloc         1
## 2               Grazer cte.bino         1
## 3               Grazer cte.stri         3
## 4     Macroinvertivore suf.chry         2
## 5 Obligate corallivore cha.baro         4
## 6 Obligate corallivore cha.ttus         2

Repeat Exercise I, Part I from R: Community analysis I - Class Exercises”

# filter Pomacentridae and calculate the abundance of each species
lizard.sum <- lfish %>%
  filter(Family == "Pomacentridae") %>%
  group_by(Site, Exposure, species) %>%
  summarize(abundance = sum(abundance))
## `summarise()` has grouped output by 'Site', 'Exposure'. You can override using
## the `.groups` argument.
lizard.sum
## # A tibble: 389 × 4
## # Groups:   Site, Exposure [14]
##    Site       Exposure  species  abundance
##    <chr>      <chr>     <chr>        <int>
##  1 Big Vickis Sheltered abu.whit         4
##  2 Big Vickis Sheltered acn.poly        23
##  3 Big Vickis Sheltered amb.cura        57
##  4 Big Vickis Sheltered amb.leuc         7
##  5 Big Vickis Sheltered amp.akin         3
##  6 Big Vickis Sheltered amp.clar         3
##  7 Big Vickis Sheltered chr.alis        12
##  8 Big Vickis Sheltered chr.tern       291
##  9 Big Vickis Sheltered chr.viri        79
## 10 Big Vickis Sheltered chy.roll        12
## # … with 379 more rows
# spread into wide format and get rid of NAs
lizard.wide <- lizard.sum %>%
  spread(key = species, value = abundance, fill = 0)
lizard.wide
## # A tibble: 14 × 57
## # Groups:   Site, Exposure [14]
##    Site  Expos…¹ abu.s…² abu.w…³ acn.p…⁴ amb.a…⁵ amb.c…⁶ amb.l…⁷ amp.a…⁸ amp.c…⁹
##    <chr> <chr>     <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
##  1 Big … Shelte…       0       4      23       0      57       7       3       3
##  2 Blue… Lagoon        4       0      35       0     307       1       0       0
##  3 Bomm… Oblique       0       0      62       0      57      21       0       0
##  4 Coco… Exposed       0      45     181       0      64      13       0       0
##  5 Gran… Shelte…       1       0       9       0       1       0       0       1
##  6 LTMP1 Exposed       1     268      72       0      54      19       0       0
##  7 LTMP3 Exposed       0      43     182       1      72      18       4       0
##  8 Monk… Lagoon        0       0       1       0      82      33       0       0
##  9 Nort… Shelte…       0       0      55       0      23       2       2       0
## 10 Palf… Lagoon        0       0      77       0     192       0       0       0
## 11 Pidg… Exposed       0       0     118       0      47      14       0       0
## 12 Reso… Shelte…       0       0      29       0       1       0       2       4
## 13 Stev… Oblique       0       0      23       0      44       7       1       1
## 14 Wash… Oblique       0       0      39       0      18       0       0       0
## # … with 47 more variables: amp.mela <dbl>, amp.peri <dbl>, chr.alis <dbl>,
## #   chr.lepi <dbl>, chr.marg <dbl>, chr.tern <dbl>, chr.viri <dbl>,
## #   chr.webe <dbl>, chr.xant <dbl>, chy.cyan <dbl>, chy.flav <dbl>,
## #   chy.rex <dbl>, chy.roll <dbl>, chy.talb <dbl>, das.arua <dbl>,
## #   das.reti <dbl>, das.trim <dbl>, dis.mela <dbl>, dis.pers <dbl>,
## #   dis.pros <dbl>, dis.pseu <dbl>, hgy.plag <dbl>, neg.mela <dbl>,
## #   neg.nigr <dbl>, neo.azys <dbl>, neo.cyan <dbl>, pgy.dick <dbl>, …

Split your dataset into metadata (site and exposure information) and numeric data

# isolate metadata
lizard.meta <- lizard.wide[1:2]
lizard.meta
## # A tibble: 14 × 2
## # Groups:   Site, Exposure [14]
##    Site            Exposure 
##    <chr>           <chr>    
##  1 Big Vickis      Sheltered
##  2 Blue Lagoon     Lagoon   
##  3 Bommie Bay      Oblique  
##  4 Coconut         Exposed  
##  5 Granite         Sheltered
##  6 LTMP1           Exposed  
##  7 LTMP3           Exposed  
##  8 Monkey's Butt   Lagoon   
##  9 North Reef      Sheltered
## 10 Palfrey Lagoon  Lagoon   
## 11 Pidgin Point    Exposed  
## 12 Resort          Sheltered
## 13 Steve's Gully   Oblique  
## 14 Washing Machine Oblique
# isolate numeric data
lizard.raw <- lizard.wide %>%
  ungroup() %>%
  select(-c(1:2))
lizard.raw
## # A tibble: 14 × 55
##    abu.sexs abu.whit acn.poly amb.aure amb.cura amb.leuc amp.a…¹ amp.c…² amp.m…³
##       <dbl>    <dbl>    <dbl>    <dbl>    <dbl>    <dbl>   <dbl>   <dbl>   <dbl>
##  1        0        4       23        0       57        7       3       3       0
##  2        4        0       35        0      307        1       0       0       0
##  3        0        0       62        0       57       21       0       0       4
##  4        0       45      181        0       64       13       0       0       0
##  5        1        0        9        0        1        0       0       1       0
##  6        1      268       72        0       54       19       0       0       0
##  7        0       43      182        1       72       18       4       0       0
##  8        0        0        1        0       82       33       0       0       0
##  9        0        0       55        0       23        2       2       0       0
## 10        0        0       77        0      192        0       0       0       0
## 11        0        0      118        0       47       14       0       0       0
## 12        0        0       29        0        1        0       2       4       0
## 13        0        0       23        0       44        7       1       1       0
## 14        0        0       39        0       18        0       0       0       0
## # … with 46 more variables: amp.peri <dbl>, chr.alis <dbl>, chr.lepi <dbl>,
## #   chr.marg <dbl>, chr.tern <dbl>, chr.viri <dbl>, chr.webe <dbl>,
## #   chr.xant <dbl>, chy.cyan <dbl>, chy.flav <dbl>, chy.rex <dbl>,
## #   chy.roll <dbl>, chy.talb <dbl>, das.arua <dbl>, das.reti <dbl>,
## #   das.trim <dbl>, dis.mela <dbl>, dis.pers <dbl>, dis.pros <dbl>,
## #   dis.pseu <dbl>, hgy.plag <dbl>, neg.mela <dbl>, neg.nigr <dbl>,
## #   neo.azys <dbl>, neo.cyan <dbl>, pgy.dick <dbl>, pgy.lacr <dbl>, …

2 PCA adjustments

2.1 Hellinger transformation

When a dataset has a non-normal distribution, a data transformation may be necessary before analyzing the data. The Hellinger transformation decreases the impact of rare species, so in our zero-inflated dataset, it may be useful.

The resulting PCA doesn’t explain much more variation (PC1 = 21.8%; PC2 = 17.8%), but it is easier to view the results in the ordination space.

Apply Hellinger transformation

# the decostand() function in vegan allows for transformations like Hellinger
lizard.hell <- decostand(lizard.raw, method = "hellinger")
head(lizard.hell)
##     abu.sexs   abu.whit  acn.poly amb.aure   amb.cura   amb.leuc   amp.akin
## 1 0.00000000 0.04563166 0.1094209        0 0.17225576 0.06036502 0.03951818
## 2 0.04161252 0.00000000 0.1230915        0 0.36455512 0.02080626 0.00000000
## 3 0.00000000 0.00000000 0.2353861        0 0.22569523 0.13699181 0.00000000
## 4 0.00000000 0.18284527 0.3667049        0 0.21805571 0.09827638 0.00000000
## 5 0.03634562 0.00000000 0.1090369        0 0.03634562 0.00000000 0.00000000
## 6 0.02358333 0.38607578 0.2001112        0 0.17330139 0.10279736 0.00000000
##     amp.clar   amp.mela amp.peri   chr.alis   chr.lepi   chr.marg   chr.tern
## 1 0.03951818 0.00000000        0 0.07903636 0.00000000 0.00000000 0.38920894
## 2 0.00000000 0.00000000        0 0.00000000 0.00000000 0.00000000 0.02942449
## 3 0.00000000 0.05978813        0 0.00000000 0.00000000 0.00000000 0.13369032
## 4 0.00000000 0.00000000        0 0.08619409 0.00000000 0.00000000 0.00000000
## 5 0.03634562 0.00000000        0 0.00000000 0.10903685 0.03634562 0.05140047
## 6 0.00000000 0.00000000        0 0.00000000 0.03335187 0.00000000 0.08503091
##     chr.viri   chr.webe   chr.xant   chy.cyan   chy.flav    chy.rex   chy.roll
## 1 0.20279155 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.07903636
## 2 0.06579517 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.22019275
## 3 0.11577921 0.00000000 0.00000000 0.00000000 0.00000000 0.04227659 0.10355607
## 4 0.00000000 0.11238334 0.00000000 0.00000000 0.00000000 0.04721045 0.07211515
## 5 0.06295246 0.05140047 0.00000000 0.00000000 0.03634562 0.00000000 0.14538247
## 6 0.11553426 0.21355615 0.06239563 0.04084753 0.00000000 0.03335187 0.06239563
##     chy.talb   das.arua  das.reti   das.trim   dis.mela   dis.pers   dis.pros
## 1 0.00000000 0.09679938 0.1020355 0.00000000 0.03226646 0.03226646 0.06036502
## 2 0.00000000 0.05504819 0.0000000 0.00000000 0.07207500 0.04161252 0.09978332
## 3 0.00000000 0.17685567 0.1232564 0.00000000 0.08455318 0.10355607 0.07322520
## 4 0.06676565 0.04721045 0.1907987 0.03854717 0.02725696 0.00000000 0.02725696
## 5 0.03634562 0.03634562 0.4794316 0.14076597 0.00000000 0.00000000 0.03634562
## 6 0.08169506 0.00000000 0.1131017 0.02358333 0.00000000 0.00000000 0.00000000
##     dis.pseu   hgy.plag   neg.mela   neg.nigr  neo.azys   neo.cyan   pgy.dick
## 1 0.00000000 0.05101775 0.04563166 0.00000000 0.2200279 0.00000000 0.00000000
## 2 0.00000000 0.13322506 0.00000000 0.10192944 0.2514030 0.02942449 0.00000000
## 3 0.05978813 0.00000000 0.00000000 0.11957626 0.2296207 0.00000000 0.00000000
## 4 0.00000000 0.00000000 0.00000000 0.14163134 0.2542360 0.00000000 0.00000000
## 5 0.00000000 0.00000000 0.03634562 0.00000000 0.2298699 0.00000000 0.00000000
## 6 0.00000000 0.00000000 0.02358333 0.08503091 0.2028715 0.00000000 0.03335187
##     pgy.lacr   pom.adel  pom.ambo   pom.bank  pom.brac   pom.chry   pom.coel
## 1 0.04563166 0.33063282 0.2488913 0.00000000 0.2115853 0.03951818 0.06844750
## 2 0.00000000 0.20806259 0.1995666 0.00000000 0.1638287 0.02942449 0.00000000
## 3 0.32196892 0.19373568 0.4087952 0.02989406 0.3781333 0.16644310 0.11957626
## 4 0.15176035 0.09827638 0.3022943 0.10902785 0.3393465 0.09442089 0.24226519
## 5 0.00000000 0.09616147 0.3964839 0.00000000 0.2838684 0.10280093 0.32508509
## 6 0.17489867 0.06239563 0.1247913 0.02358333 0.4751910 0.02358333 0.04716666
##     pom.gram   pom.lepi  pom.molu   pom.naga   pom.pavo pom.phil   pom.vaiu
## 1 0.00000000 0.10455528 0.6147586 0.18675564 0.00000000        0 0.00000000
## 2 0.19406787 0.00000000 0.7222500 0.02942449 0.00000000        0 0.00000000
## 3 0.02989406 0.07322520 0.3804893 0.13030520 0.05978813        0 0.00000000
## 4 0.00000000 0.33825002 0.3259459 0.11238334 0.00000000        0 0.05451393
## 5 0.00000000 0.09616147 0.4406672 0.24917300 0.00000000        0 0.00000000
## 6 0.05776713 0.32847780 0.4251546 0.09433333 0.00000000        0 0.00000000
##     pom.ward   pre.biac  ste.apic ste.fasc ste.livi   ste.nigr
## 1 0.12496746 0.03226646 0.0000000        0        0 0.03226646
## 2 0.06241878 0.02942449 0.0360375        0        0 0.08322504
## 3 0.06684516 0.00000000 0.1195763        0        0 0.05177804
## 4 0.16802321 0.00000000 0.1828453        0        0 0.00000000
## 5 0.05140047 0.00000000 0.0000000        0        0 0.00000000
## 6 0.12254259 0.00000000 0.1633901        0        0 0.00000000

Run PCA with Hellinger transformation

# run a PCA just like in the Class Exercises but with transformed data
# retain percent variation explained by PC1 and PC2
lizard.pca <- summary(rda(lizard.hell, scale = T))
lizard.pca
## 
## Call:
## rda(X = lizard.hell, scale = T) 
## 
## Partitioning of correlations:
##               Inertia Proportion
## Total              55          1
## Unconstrained      55          1
## 
## Eigenvalues, and their contribution to the correlations 
## 
## Importance of components:
##                           PC1    PC2    PC3     PC4     PC5     PC6     PC7
## Eigenvalue            11.9712 9.8071 6.5313 4.55176 4.34548 4.18776 3.19583
## Proportion Explained   0.2177 0.1783 0.1188 0.08276 0.07901 0.07614 0.05811
## Cumulative Proportion  0.2177 0.3960 0.5147 0.59748 0.67649 0.75263 0.81074
##                           PC8     PC9    PC10    PC11    PC12    PC13
## Eigenvalue            2.75820 2.32245 2.20156 1.24548 1.12381 0.75800
## Proportion Explained  0.05015 0.04223 0.04003 0.02265 0.02043 0.01378
## Cumulative Proportion 0.86089 0.90311 0.94314 0.96579 0.98622 1.00000
## 
## Scaling 2 for species and site scores
## * Species are scaled proportional to eigenvalues
## * Sites are unscaled: weighted dispersion equal on all dimensions
## * General scaling constant of scores:  5.171023 
## 
## 
## Species scores
## 
##                PC1        PC2       PC3       PC4       PC5        PC6
## abu.sexs -0.011871  0.0465375 -0.251814  0.089262  0.437297 -0.2741712
## abu.whit  0.460037  0.0100698 -0.313810 -0.164594 -0.172823 -0.2728939
## acn.poly  0.434148 -0.0660399  0.287317 -0.319931 -0.102002  0.1952710
## amb.aure  0.184057  0.0577673 -0.037663  0.132038 -0.301348  0.2880427
## amb.cura -0.111643 -0.6195950 -0.144941 -0.118238 -0.012271  0.0976955
## amb.leuc  0.342392 -0.2937935  0.031791  0.111514 -0.124992  0.0691159
## amp.akin -0.102282  0.4351832 -0.025070 -0.048111 -0.319517  0.2538308
## amp.clar -0.260429  0.5509033  0.108167 -0.190425  0.017417 -0.0208197
## amp.mela -0.008355 -0.2066756  0.399130  0.170532 -0.197591 -0.2770037
## amp.peri  0.245198 -0.2038519  0.219590 -0.173236  0.353784  0.2833782
## chr.alis -0.253370 -0.0207836 -0.028444 -0.467061 -0.225822  0.0876579
## chr.lepi -0.075217  0.5669954  0.065230 -0.122578  0.240212 -0.1664283
## chr.marg  0.200863  0.0885216  0.156387  0.037006  0.527690  0.1933677
## chr.tern -0.144026 -0.0253649 -0.154368  0.438801 -0.347029  0.1348038
## chr.viri -0.233587 -0.1752626 -0.320954  0.074137 -0.363811  0.2083585
## chr.webe  0.544696  0.0558075 -0.278833 -0.108907  0.015560 -0.1159172
## chr.xant  0.321777 -0.0004877 -0.364833 -0.125711 -0.010006 -0.4235467
## chy.cyan  0.321777 -0.0004877 -0.364833 -0.125711 -0.010006 -0.4235467
## chy.flav  0.139132  0.2721259 -0.011016  0.120702 -0.232996  0.2916707
## chy.rex   0.483074 -0.1786464  0.134567 -0.126974 -0.180090 -0.0233387
## chy.roll -0.479525  0.1780551  0.002731 -0.007095  0.230470 -0.0460066
## chy.talb  0.531022  0.0587967 -0.166667  0.018858  0.095444  0.0558495
## das.arua -0.123041 -0.2917806  0.391440  0.292305 -0.139541 -0.1750759
## das.reti  0.312258  0.2614051  0.084535  0.374496  0.142660  0.0508314
## das.trim  0.200456  0.3453876 -0.074814  0.188725  0.270884  0.0005826
## dis.mela -0.170568 -0.5297780  0.348048  0.056905  0.141025 -0.1363447
## dis.pers -0.397145 -0.1688676  0.358099  0.080370 -0.227510 -0.2397242
## dis.pros -0.474979 -0.2629231  0.195057 -0.171649  0.247272 -0.0433313
## dis.pseu -0.222794 -0.3299961  0.199241 -0.104880 -0.216606 -0.1320848
## hgy.plag -0.484315 -0.3521852 -0.263870 -0.071210  0.125369  0.0211382
## neg.mela -0.320913  0.4045867 -0.108993 -0.270654 -0.136996  0.0516414
## neg.nigr  0.316447 -0.4711350  0.228899 -0.195763 -0.014612 -0.0512508
## neo.azys  0.054277 -0.2597392 -0.081007 -0.115557  0.020735  0.5418899
## neo.cyan -0.278363  0.4088629  0.164010 -0.312504  0.018135 -0.0874470
## pgy.dick  0.321777 -0.0004877 -0.364833 -0.125711 -0.010006 -0.4235467
## pgy.lacr  0.401922 -0.3171541  0.398588  0.002770 -0.018241 -0.1086853
## pom.adel -0.595992 -0.1450807 -0.092424  0.039900 -0.150132 -0.0126439
## pom.ambo -0.082194  0.3644397  0.539932  0.044500  0.107489 -0.0388876
## pom.bank  0.459767 -0.1381609  0.233769 -0.177084 -0.117312 -0.0218879
## pom.brac  0.455267  0.1464347 -0.055033  0.318787 -0.129950 -0.0300135
## pom.chry -0.125500  0.4356969  0.406634 -0.137657 -0.136183 -0.2129410
## pom.coel  0.269514  0.3894246  0.222804  0.131921 -0.022168  0.0274861
## pom.gram -0.341394 -0.3756256 -0.286756 -0.107808  0.150730 -0.1337485
## pom.lepi  0.577520 -0.0179511  0.050453 -0.126769  0.031042 -0.0614220
## pom.molu -0.295001 -0.2840311 -0.387309  0.253941  0.036210 -0.0856262
## pom.naga -0.166978  0.6352945  0.153108 -0.008757 -0.089516 -0.1100018
## pom.pavo -0.008355 -0.2066756  0.399130  0.170532 -0.197591 -0.2770037
## pom.phil  0.245198 -0.2038519  0.219590 -0.173236  0.353784  0.2833782
## pom.vaiu  0.273275 -0.0317588  0.095827 -0.241145 -0.085985  0.0049348
## pom.ward -0.128548 -0.0787459 -0.113122 -0.554147 -0.236779  0.0635985
## pre.biac -0.469080  0.1651806  0.132201 -0.266850 -0.019234 -0.1335504
## ste.apic  0.564384 -0.2115076  0.142556 -0.124200 -0.096629 -0.0537061
## ste.fasc -0.016417 -0.0197490  0.210252  0.211774 -0.002172 -0.1620421
## ste.livi -0.177789 -0.0986960 -0.153175  0.223355  0.060774  0.0672489
## ste.nigr -0.331536 -0.5149591  0.151469 -0.032657  0.178830 -0.0433879
## 
## 
## Site scores (weighted sums of species scores)
## 
##            PC1       PC2      PC3       PC4      PC5      PC6
## sit1  -1.28001  0.187314 -0.58152  0.339828 -0.99376  0.28124
## sit2  -1.60325 -1.544010 -0.89738 -0.008861  1.95060 -0.79342
## sit3  -0.05971 -1.476992  2.85235  1.218694 -1.41207 -1.97959
## sit4   1.95294 -0.226962  0.68482 -1.723324 -0.61448  0.03527
## sit5   0.21366  2.278934 -0.03458  1.569206  2.59525 -0.12583
## sit6   2.29956 -0.003485 -2.60725 -0.898382 -0.07151 -3.02685
## sit7   1.31535  0.412830 -0.26915  0.943600 -2.15356  2.05848
## sit8  -1.27055 -0.705324 -1.09466  1.596192  0.43432  0.48059
## sit9   0.35874  0.828993 -0.84724  1.025818 -0.38048  1.11866
## sit10 -2.05964 -1.722744 -0.83486 -2.161939 -0.70752  0.63824
## sit11  1.75229 -1.456813  1.56929 -1.238017  2.52829  2.02514
## sit12 -1.60305  3.209191  1.42573 -2.419232 -0.19346 -0.57209
## sit13  0.10099  0.360204 -0.86810  0.242994 -0.96609  1.01818
## sit14 -0.11732 -0.141135  1.50255  1.513424 -0.01552 -1.15802
# extract the site scores and merge with metadata
lizard.scores <- as.data.frame(lizard.pca$sites) %>%
  bind_cols(lizard.meta)

# create convex hulls grouped by site exposure based on site scores
lizard.hulls <- lizard.scores %>%
  group_by(Exposure) %>%
  slice(chull(PC1, PC2))

# extract the loadings from species scores
lizard.loadings <- as.data.frame(lizard.pca$species) %>%
  mutate(species = rownames(.))

# plot the PCA results with color and convex hulls as exposure and species as loadings
lizard.plot2 <- ggplot() +
  geom_point(data = lizard.scores, aes(x = PC1, y = PC2, color = Exposure), size = 2) +
  geom_polygon(data = lizard.hulls, aes(x = PC1, PC2, fill = Exposure), alpha = 0.5) +
  geom_segment(data = lizard.loadings, aes(x = 0, xend = PC1*3,
                                           y = 0, yend = PC2*3), lwd = 0.1) +
  geom_text(data = lizard.loadings, aes(x = PC1*3, y = PC2*3, label = species), size = 3) +
  scale_fill_fish_d(option = "Stegastes_nigricans", end = 0.8) +
  scale_color_fish_d(option = "Stegastes_nigricans", end = 0.8) +
  theme_bw() +
  xlab("PC1 (21.8%)") +
  ylab("PC2 (17.8%)") +
  ggtitle("Hellinger transformed PCA, scale = T")
lizard.plot2

2.2 Scaling

When should you scale data for a PCA? If absolute abundances are not ecologically meaningful, scale your data. If they are ecologically meaningful, do not scale your data.

For example, when working with fish morphological traits, the measurement of eye diameter will always be smaller than the measurement of fish body depth. Thus, fish body depth values will always be bigger than eye diameter values. Is body depth a relatively more important trait than eye diameter? No. In this case, scale your data.

In contrast, when working with damselfish species counts at different sites, relative differences in species abundances across sites may indicate a response to an environmental condition. Thus, the absolute abundances may be ecologically meaningful. In this case, do not scale your data.

Now run the exact same PCA, but without scaling the data. In this case, the resulting PCA will explain a lot more variance without scaling. In the previous PCA, scaling erased the information from absolute abundances, which was ecologically meaningful.

Run PCA with Hellinger transformation but without scaling

# run the same PCA, but with scale = F
# retain percent variation explained by PC1 and PC2
lizard.pca <- summary(rda(lizard.hell, scale = F))

# extract the site scores and merge with metadata
lizard.scores <- as.data.frame(lizard.pca$sites) %>%
  bind_cols(lizard.meta)

# create convex hulls grouped by site exposure based on site scores
lizard.hulls <- lizard.scores %>%
  group_by(Exposure) %>%
  slice(chull(PC1, PC2))

# extract the loadings from species scores
lizard.loadings <- as.data.frame(lizard.pca$species) %>%
  mutate(species = rownames(.))

# plot the PCA results with color and convex hulls as exposure and species as loadings
lizard.plot3 <- ggplot() +
  geom_point(data = lizard.scores, aes(x = PC1, y = PC2, color = Exposure), size = 2) +
  geom_polygon(data = lizard.hulls, aes(x = PC1, PC2, fill = Exposure), alpha = 0.5) +
  geom_segment(data = lizard.loadings, aes(x = 0, xend = PC1*2,
                                           y = 0, yend = PC2*2), lwd = 0.1) +
  geom_text(data = lizard.loadings, aes(x = PC1*2, y = PC2*2, label = species), size = 3) +
  scale_fill_fish_d(option = "Stegastes_nigricans", end = 0.8) +
  scale_color_fish_d(option = "Stegastes_nigricans", end = 0.8) +
  theme_bw() +
  xlab("PC1 (30.3%)") +
  ylab("PC2 (20.5%)") +
  ggtitle("Hellinger transformed PCA, scale = F")
lizard.plot3


3 Distance-based ordination techniques

To examine how the four regimes of wave action impact reef fish community composition across all families, we need to use a distance-based ordination. With more than 200 fish species across all families, this is too much information to digest for a PCA, even with data transformations.

Distance-based ordination techniques compute relative distances between sites and produce a map-based visualization of how similar or distant those sites are to one another. This allows you to determine data groupings, or clusters.

We will review two distance-based ordination techniques:

3.1 Principal Coordinates Analysis (PCoA)

Include the entire dataset to the level of transect

# call the entire dataset
# group by transect, site, exposure, and species
# summarize the species abundances
lizard.sum <- lfish %>%
  group_by(transect, Site, Exposure, species) %>%
  summarize(abundance = sum(abundance))
## `summarise()` has grouped output by 'transect', 'Site', 'Exposure'. You can
## override using the `.groups` argument.
# convert data to wide format
lizard.wide <- lizard.sum %>%
  spread(key = species, value = abundance, fill = 0)

# isolate metadata
lizard.meta <- lizard.wide[1:3]

# isolate numeric data
lizard.raw <- lizard.wide %>%
  ungroup() %>%
  select(-c(1:3))

Create a distance matrix with Bray-Curtis dissimilarity metric and run PCoA

# create a distance matrix with vegdist() from the vegan package
# use the Bray-Curtis dissimilarity metric, which is a dissimilarity measure designed to handle abundance data
lizard.dist <- vegdist(lizard.raw, method = "bray")

# run the PCoA using the cmdscale() function
lizard.pcoa <- cmdscale(lizard.dist, k = 2, eig = T) 

# check PCoA output
lizard.pcoa
## $points
##               [,1]         [,2]
##  [1,] -0.169343902  0.111362282
##  [2,] -0.451281604  0.114325972
##  [3,]  0.159803853  0.049922107
##  [4,]  0.110401192 -0.143316894
##  [5,]  0.262134305  0.270832648
##  [6,]  0.013867453 -0.322687479
##  [7,]  0.015234736 -0.264395699
##  [8,] -0.211178112 -0.138801631
##  [9,]  0.168286115 -0.043361153
## [10,] -0.364013023  0.043814726
## [11,]  0.050287582 -0.224119652
## [12,]  0.168140226  0.128265348
## [13,]  0.007677336 -0.145804213
## [14,]  0.055376418 -0.013336868
## [15,] -0.210262137  0.075344861
## [16,] -0.427170514  0.040946293
## [17,]  0.090801781  0.017532823
## [18,]  0.074555675 -0.222151821
## [19,]  0.230138156  0.264666597
## [20,]  0.025580231 -0.291084943
## [21,]  0.020392030 -0.254786126
## [22,] -0.213405343 -0.080691422
## [23,]  0.253941794 -0.028540411
## [24,] -0.357736333  0.074330479
## [25,]  0.141707196 -0.125316972
## [26,]  0.211729977  0.324698546
## [27,] -0.025387340 -0.043907012
## [28,]  0.139600069 -0.008031405
## [29,] -0.140565449  0.193857385
## [30,] -0.390984455  0.176500523
## [31,]  0.114021352 -0.101267519
## [32,]  0.150646805 -0.042847986
## [33,]  0.163748562  0.163380808
## [34,]  0.045020697 -0.185569191
## [35,] -0.041610168 -0.203567529
## [36,] -0.167252931  0.104032274
## [37,]  0.145421117  0.082719968
## [38,] -0.330250941  0.135962648
## [39,]  0.178077348  0.033848600
## [40,]  0.234611185  0.287383041
## [41,]  0.073013160  0.049278691
## [42,]  0.196225903  0.140579304
## 
## $eig
##  [1]  1.723784e+00  1.145224e+00  6.463910e-01  5.537202e-01  4.762933e-01
##  [6]  3.911931e-01  3.342039e-01  3.073085e-01  2.848823e-01  2.359893e-01
## [11]  2.240308e-01  1.880727e-01  1.847469e-01  1.440149e-01  1.391043e-01
## [16]  1.303950e-01  1.281280e-01  1.209120e-01  1.039267e-01  9.532212e-02
## [21]  8.271850e-02  7.611610e-02  6.645071e-02  6.189100e-02  5.395885e-02
## [26]  5.074267e-02  4.549638e-02  3.884304e-02  3.297210e-02  2.469777e-02
## [31]  1.950817e-02  1.266073e-02  1.039242e-02  7.941789e-03  4.461808e-04
## [36]  6.591949e-17 -7.145177e-03 -9.277816e-03 -1.362953e-02 -1.981142e-02
## [41] -2.596988e-02 -2.815455e-02
## 
## $x
## NULL
## 
## $ac
## [1] 0
## 
## $GOF
## [1] 0.3479075 0.3523507
# correct negative eigenvalues with Cailliez correction (options = cailliez or lingoes) with pcoa() in ape package
lizard.pcoa <- pcoa(lizard.dist, correction = "cailliez")
lizard.pcoa
## $correction
## [1] "cailliez" "3"       
## 
## $note
## [1] "Cailliez correction applied to negative eigenvalues: D' = -0.5*(D + 0.104329701745337 )^2, except diagonal elements"
## 
## $values
##      Eigenvalues    Corr_eig Rel_corr_eig Broken_stick Cum_corr_eig
## 1   1.7237838249 2.047441399 0.1879345664  0.106963576    0.1879346
## 2   1.1452242740 1.381051412 0.1267666554  0.081963576    0.3147012
## 3   0.6463909538 0.799445512 0.0733810725  0.069463576    0.3880823
## 4   0.5537202216 0.691401691 0.0634637343  0.061130243    0.4515460
## 5   0.4762933230 0.599868974 0.0550619498  0.054880243    0.5066080
## 6   0.3911930529 0.499924068 0.0458880108  0.049880243    0.5524960
## 7   0.3342038932 0.432179235 0.0396697152  0.045713576    0.5921657
## 8   0.3073084585 0.401637311 0.0368662732  0.042142147    0.6290320
## 9   0.2848822844 0.375651340 0.0344810219  0.039017147    0.6635130
## 10  0.2359893126 0.312830802 0.0287147272  0.036239370    0.6922277
## 11  0.2240308465 0.303378349 0.0278470868  0.033739370    0.7200748
## 12  0.1880727102 0.258826312 0.0237576571  0.031466642    0.7438325
## 13  0.1847468591 0.256072043 0.0235048428  0.029383309    0.7673373
## 14  0.1440149003 0.206747423 0.0189773379  0.027460232    0.7863147
## 15  0.1391043155 0.202020965 0.0185434965  0.025674518    0.8048581
## 16  0.1303949702 0.188639231 0.0173151877  0.024007851    0.8221733
## 17  0.1281279671 0.187273350 0.0171898135  0.022445351    0.8393631
## 18  0.1209120374 0.178769672 0.0164092613  0.020974763    0.8557724
## 19  0.1039267405 0.158533473 0.0145517813  0.019585874    0.8703242
## 20  0.0953221167 0.146572789 0.0134539106  0.018270085    0.8837781
## 21  0.0827185050 0.131936709 0.0121104654  0.017020085    0.8958886
## 22  0.0761160962 0.123728268 0.0113570129  0.015829608    0.9072456
## 23  0.0664507120 0.112464123 0.0103230775  0.014693245    0.9175687
## 24  0.0618909965 0.105977306 0.0097276528  0.013606288    0.9272963
## 25  0.0539588474 0.097940583 0.0089899623  0.012564622    0.9362863
## 26  0.0507426737 0.092264447 0.0084689500  0.011564622    0.9447552
## 27  0.0454963831 0.086465149 0.0079366326  0.010603083    0.9526919
## 28  0.0388430427 0.077826274 0.0071436706  0.009677157    0.9598355
## 29  0.0329721021 0.071845038 0.0065946533  0.008784300    0.9664302
## 30  0.0246977736 0.061895057 0.0056813449  0.007922231    0.9721115
## 31  0.0195081685 0.054447557 0.0049977391  0.007088898    0.9771093
## 32  0.0126607325 0.048501185 0.0044519219  0.006282446    0.9815612
## 33  0.0103924229 0.044826215 0.0041145965  0.005501196    0.9856758
## 34  0.0079417893 0.042796658 0.0039283036  0.004743620    0.9896041
## 35  0.0004461808 0.034572345 0.0031733942  0.004008326    0.9927775
## 36  0.0000000000 0.024678559 0.0022652440  0.003294040    0.9950427
## 37 -0.0071451768 0.020459275 0.0018779561  0.002599596    0.9969207
## 38 -0.0092778157 0.017090137 0.0015687030  0.001923920    0.9984894
## 39 -0.0136295336 0.012806918 0.0011755465  0.001266026    0.9996649
## 40 -0.0198114162 0.003650404 0.0003350705  0.000625000    1.0000000
## 41 -0.0259698794 0.000000000 0.0000000000  0.000000000    1.0000000
## 42 -0.0281545469 0.000000000 0.0000000000  0.000000000    1.0000000
##    Cum_br_stick
## 1     0.1069636
## 2     0.1889272
## 3     0.2583907
## 4     0.3195210
## 5     0.3744012
## 6     0.4242815
## 7     0.4699950
## 8     0.5121372
## 9     0.5511543
## 10    0.5873937
## 11    0.6211331
## 12    0.6525997
## 13    0.6819830
## 14    0.7094432
## 15    0.7351178
## 16    0.7591256
## 17    0.7815710
## 18    0.8025457
## 19    0.8221316
## 20    0.8404017
## 21    0.8574218
## 22    0.8732514
## 23    0.8879446
## 24    0.9015509
## 25    0.9141155
## 26    0.9256802
## 27    0.9362832
## 28    0.9459604
## 29    0.9547447
## 30    0.9626669
## 31    0.9697558
## 32    0.9760383
## 33    0.9815395
## 34    0.9862831
## 35    0.9902914
## 36    0.9935855
## 37    0.9961851
## 38    0.9981090
## 39    0.9993750
## 40    1.0000000
## 41    1.0000000
## 42    1.0000000
## 
## $vectors
##          Axis.1       Axis.2       Axis.3       Axis.4       Axis.5
## 1  -0.169343902  0.111362282  0.044303106  0.104292114 -0.046394081
## 2  -0.451281604  0.114325972 -0.094927345  0.023648248  0.088962412
## 3   0.159803853  0.049922107 -0.044296366  0.127301353  0.042865962
## 4   0.110401192 -0.143316894 -0.169753553  0.016459880 -0.010569206
## 5   0.262134305  0.270832648  0.045551841 -0.032484782  0.012568717
## 6   0.013867453 -0.322687479  0.017001603 -0.035814885 -0.059302934
## 7   0.015234736 -0.264395699 -0.049010994 -0.090509674 -0.064912874
## 8  -0.211178112 -0.138801631  0.227704230 -0.098001556  0.172054733
## 9   0.168286115 -0.043361153  0.020701078  0.013116016 -0.017867373
## 10 -0.364013023  0.043814726 -0.105910018 -0.083957935 -0.214425424
## 11  0.050287582 -0.224119652 -0.231347906  0.084867915  0.164266117
## 12  0.168140226  0.128265348 -0.147813518 -0.283977803 -0.168372000
## 13  0.007677336 -0.145804213  0.074787355 -0.066385812 -0.153178770
## 14  0.055376418 -0.013336868 -0.001015276  0.035801613 -0.088934689
## 15 -0.210262137  0.075344861  0.093621305  0.068057230  0.013102024
## 16 -0.427170514  0.040946293 -0.176232807 -0.058110707  0.080936479
## 17  0.090801781  0.017532823  0.027054205  0.188692377  0.014687192
## 18  0.074555675 -0.222151821 -0.143056189 -0.030046549 -0.037711083
## 19  0.230138156  0.264666597  0.051949465 -0.024954209  0.014063083
## 20  0.025580231 -0.291084943 -0.016635631 -0.057735860 -0.184002881
## 21  0.020392030 -0.254786126 -0.073064253 -0.018848897 -0.155671847
## 22 -0.213405343 -0.080691422  0.269909352 -0.018949505  0.175080200
## 23  0.253941794 -0.028540411  0.098353719  0.024501475  0.038052762
## 24 -0.357736333  0.074330479 -0.020006864  0.047842684 -0.166770593
## 25  0.141707196 -0.125316972 -0.148210361  0.082823970  0.186726753
## 26  0.211729977  0.324698546 -0.060413632 -0.232992305  0.009572404
## 27 -0.025387340 -0.043907012  0.177208266  0.126345576 -0.018674142
## 28  0.139600069 -0.008031405  0.026226317  0.157300197  0.023778084
## 29 -0.140565449  0.193857385 -0.005355031  0.044217942 -0.074366481
## 30 -0.390984455  0.176500523 -0.122493624 -0.015717838  0.128308890
## 31  0.114021352 -0.101267519  0.094098672  0.025854130  0.113874909
## 32  0.150646805 -0.042847986 -0.112235206  0.027401681 -0.003487300
## 33  0.163748562  0.163380808  0.140587730  0.004175263 -0.026327636
## 34  0.045020697 -0.185569191  0.158446329  0.075310714 -0.002698490
## 35 -0.041610168 -0.203567529  0.149895658 -0.400188339  0.205562610
## 36 -0.167252931  0.104032274  0.109530486  0.113595079 -0.080454973
## 37  0.145421117  0.082719968  0.138710236  0.048767279 -0.090152914
## 38 -0.330250941  0.135962648 -0.027030723  0.004406455  0.021900806
## 39  0.178077348  0.033848600 -0.295398175  0.104706269  0.173673454
## 40  0.234611185  0.287383041  0.008954106 -0.192099973  0.052453703
## 41  0.073013160  0.049278691  0.134537671  0.101341932 -0.073463211
## 42  0.196225903  0.140579304 -0.064925258  0.089949235  0.005247608
##           Axis.6       Axis.7       Axis.8       Axis.9      Axis.10
## 1  -0.0197532965 -0.027801241 -0.022747705  0.130367974 -0.069444201
## 2  -0.1420812357 -0.059254567 -0.013855686 -0.072623605 -0.038896642
## 3   0.1084983418  0.089256411 -0.058085002  0.088744744 -0.047806840
## 4   0.0529796830 -0.122924768 -0.057258032  0.036792618 -0.004896148
## 5  -0.0039671325 -0.174265742 -0.042392237 -0.003977175  0.019263302
## 6  -0.0120032006  0.062623675  0.009396645  0.074232426 -0.124925766
## 7  -0.0222768723  0.056185656 -0.098059221 -0.054340079  0.076737629
## 8   0.0282679021  0.123384976 -0.014063703  0.036459577  0.132576064
## 9  -0.1295334112  0.002427031  0.016808797 -0.159069959  0.073559007
## 10  0.1382806049  0.014405731  0.098963730 -0.099753163  0.025568627
## 11  0.0032641572 -0.065819496  0.134514830  0.087446409  0.065133851
## 12 -0.0734932382  0.119211062 -0.032481554  0.065263023  0.023341599
## 13 -0.0657359024  0.024321124 -0.045635135 -0.016271714  0.153301527
## 14  0.0466522732  0.084171820 -0.171145509 -0.084800143  0.036712489
## 15 -0.1583418094 -0.026211307 -0.169353958  0.073553534 -0.027610742
## 16 -0.1549797229 -0.045309572 -0.034371827 -0.025286791  0.008482984
## 17  0.0308634381  0.039201877 -0.004909861 -0.025232121  0.001473440
## 18 -0.0070651204 -0.001315762  0.024706360  0.192584529 -0.005995451
## 19  0.0557488085 -0.266279074  0.018169965  0.016813790  0.079040030
## 20 -0.1369440704  0.001464967  0.056907202 -0.040062761 -0.062633828
## 21  0.0435329186 -0.068951552 -0.055398457  0.009636068 -0.057217569
## 22  0.0442913803  0.082675386  0.106365735  0.069227313 -0.040375080
## 23 -0.1704205673 -0.013322929  0.162020444 -0.208122904 -0.078611175
## 24  0.2205051880 -0.094980301  0.231943705 -0.034722452 -0.036297939
## 25 -0.0552026763  0.038840338  0.042771053 -0.016694810  0.123418475
## 26 -0.0466543513  0.101803817  0.127181656  0.025733937  0.025041435
## 27 -0.0774016090 -0.039249988  0.036959135  0.084788227  0.069716340
## 28  0.0865361797  0.084866862 -0.109912191  0.007354105  0.002787894
## 29  0.0573023721  0.008055381 -0.044767167  0.102479274 -0.010848163
## 30 -0.1263420007  0.001597870 -0.104390940 -0.063988416 -0.150593588
## 31  0.0599410714  0.040044421  0.074779925 -0.015881409 -0.093377121
## 32  0.0007983876 -0.114458547 -0.007820878  0.078901942 -0.071055384
## 33 -0.0907703330 -0.121337128 -0.003026797  0.045907220  0.034495963
## 34 -0.0810181862 -0.069446753  0.093697935  0.016161322 -0.040931244
## 35  0.2275841363 -0.154759027 -0.128359765 -0.084850639 -0.044167531
## 36  0.1322799807  0.104060943 -0.036775307 -0.065163055 -0.046844846
## 37 -0.0081487465  0.027614051 -0.020462804 -0.131206871 -0.019714702
## 38  0.0342984409  0.043777982  0.059138140  0.041292188  0.225054249
## 39  0.1246584588  0.093829691  0.019952927 -0.140076192 -0.005820761
## 40 -0.0255936717  0.169177219  0.083052065  0.104201114 -0.114289904
## 41  0.0109532832  0.043092248 -0.017047360 -0.009346092  0.017858912
## 42  0.1004901480  0.009597217 -0.105009152 -0.036470984 -0.001209192
##         Axis.11      Axis.12       Axis.13       Axis.14      Axis.15
## 1  -0.144086282  0.033341494 -0.0627504758 -0.0281932481  0.135447899
## 2   0.035246546  0.047517146  0.0037963278 -0.0281616142 -0.040930700
## 3  -0.044081252  0.074691437 -0.0454597073  0.0550804260 -0.104956623
## 4   0.096982269 -0.002764116  0.0290087331 -0.0257089328  0.071356616
## 5   0.026047575 -0.049100737 -0.1590288023  0.0118565702 -0.028566293
## 6  -0.013233288  0.046776831 -0.1298410645  0.0260617868  0.043570996
## 7   0.004533183 -0.148257174 -0.0610074545  0.0144388163 -0.063396730
## 8   0.108467046 -0.076806018 -0.0362494844  0.0364591361  0.045400141
## 9  -0.046891608  0.086293496  0.0425193023  0.0564527625  0.110280353
## 10  0.007019900  0.028025629 -0.0008451588  0.0267719421  0.009290673
## 11  0.039998249 -0.048063499  0.0199608941 -0.2014924280 -0.054860078
## 12  0.063467032  0.047310117  0.0057218311 -0.0238902302 -0.002672240
## 13 -0.063992446  0.012320960  0.0069391669  0.0240467073 -0.074845617
## 14  0.097333462  0.063864886  0.0208177651 -0.0939068979  0.089223685
## 15 -0.124206535 -0.132911118  0.0993709168  0.0171258876 -0.047958249
## 16  0.042691412  0.046694817 -0.0448818359 -0.0437769953 -0.040951306
## 17 -0.007448865  0.059173799  0.1082723796  0.0156884219 -0.094297063
## 18  0.009460354 -0.007107786  0.0478789190  0.1204947951 -0.009758791
## 19  0.093648818  0.025178201 -0.1001357645  0.0629265529 -0.078050123
## 20 -0.023270496  0.080535990 -0.0260135941  0.0002636819 -0.082197344
## 21  0.039535987 -0.050433840 -0.0598075816 -0.0189905258  0.016621016
## 22  0.081021274  0.066321516 -0.0722679178 -0.0029814893  0.025346368
## 23 -0.004261601 -0.011853102  0.0136645041  0.0282158614  0.023795579
## 24 -0.029642700 -0.013846215  0.0690905603 -0.0278830212 -0.005044924
## 25 -0.081050960 -0.037386718 -0.0215425563 -0.0270596432  0.084276530
## 26  0.050426140 -0.066234024  0.0254390275 -0.0057889304  0.038579465
## 27 -0.006861895  0.045029331 -0.0190199628 -0.0706745218  0.017694376
## 28  0.106273083  0.118591719  0.1053943906 -0.0369346141 -0.059980802
## 29 -0.067105170 -0.015330367 -0.0839008727 -0.0155601791  0.073020584
## 30  0.074475546  0.004436735 -0.0015732173  0.0613072853 -0.006123657
## 31  0.122114879 -0.048932336  0.0217287462  0.0909340943 -0.026859843
## 32  0.010955657 -0.115351574  0.1671528483  0.0860594623  0.077273221
## 33  0.001616547  0.012738337  0.0616263612 -0.0483075409  0.003289582
## 34 -0.017680341  0.023981626  0.0113198144  0.0285743474  0.010585915
## 35 -0.150993905  0.056367412  0.0795200080 -0.0420876969 -0.006702287
## 36  0.067317842 -0.174885907 -0.0082339519 -0.0331160124 -0.017112711
## 37 -0.007697602 -0.091681327  0.0167559442 -0.0776077746  0.018502127
## 38 -0.048823489  0.039994504  0.0624967259  0.1068509816  0.004420572
## 39 -0.152882480 -0.027542412 -0.1027151115  0.0444013026 -0.018597518
## 40 -0.080035282  0.011985611  0.0504738628 -0.0736083146 -0.047216001
## 41 -0.114011953 -0.005254134 -0.0433786159 -0.0197248745 -0.064097817
## 42  0.049625347  0.092570811  0.0097041004  0.0314446634  0.077201021
##          Axis.16      Axis.17       Axis.18       Axis.19      Axis.20
## 1   0.0192632332 -0.125762344 -0.0213001078  0.0599528120 -0.002131362
## 2  -0.0517199194  0.028211313  0.0393555810 -0.0115324188 -0.043135474
## 3  -0.0602362245 -0.028226820 -0.0001916871 -0.0812641550 -0.042312052
## 4   0.0268926969  0.033724681 -0.0354882824 -0.0810995591  0.041420110
## 5  -0.0158896761  0.019932586  0.0378531043  0.0120845244  0.005827331
## 6  -0.0603284286 -0.029532961 -0.0457869886  0.0443106654 -0.070190421
## 7   0.0142647279 -0.016619965  0.0241941048 -0.0007296062  0.070378024
## 8   0.0014025525 -0.019325673 -0.0583409199 -0.0106466286  0.038081384
## 9  -0.1101529216 -0.007516075  0.0540730201 -0.1161948385  0.074868350
## 10 -0.1145128123  0.035558926  0.0258727214  0.0562724453 -0.052812984
## 11 -0.0127841324 -0.050289431  0.0015709414 -0.0136197115  0.001698562
## 12  0.0742787226 -0.077603214  0.0867844568  0.0316301707  0.045233894
## 13  0.0667261564 -0.025848259  0.0176895893 -0.0270557943 -0.069713339
## 14 -0.0064372093  0.011507279 -0.0196968444  0.0714082656 -0.004865128
## 15 -0.0685889618 -0.064836988 -0.0224000666  0.0660841497  0.097325013
## 16 -0.0260148395 -0.019137679 -0.0218548872 -0.0679069624  0.017437267
## 17  0.0197672783 -0.095381095  0.0949098725 -0.0201259138 -0.060689939
## 18 -0.1140924088  0.021138973 -0.0168065834  0.0346114665  0.015541723
## 19 -0.0188571231 -0.007242483 -0.0383981914  0.0536985820  0.035282179
## 20  0.1336834906  0.031294727 -0.0369318961  0.0263507892  0.035043341
## 21 -0.0479065613 -0.010299802 -0.0434717574 -0.0841943441 -0.052526865
## 22  0.0285097852 -0.020532902 -0.0153100269 -0.0454360667  0.015819424
## 23  0.0007648133 -0.104136346 -0.0908626447  0.0064880015 -0.000202563
## 24  0.0185753284 -0.042536412  0.0142966029  0.0218919297  0.097921389
## 25  0.0092234144  0.039263887  0.1114621416  0.0886480417 -0.051574292
## 26 -0.0452052783  0.016102154 -0.0283812230  0.0524445478 -0.068436899
## 27 -0.0282527497  0.090138698  0.0495335629  0.0236728951  0.011149491
## 28 -0.0283292682  0.032024035 -0.0958233151  0.0916193566  0.036853965
## 29  0.0650608040  0.012376062  0.0608609010 -0.0630238953  0.026583805
## 30  0.0586662326  0.060633467  0.0177935947  0.0335610887 -0.030393913
## 31 -0.0067560329 -0.066155689  0.1510495924  0.0193093880  0.014095156
## 32  0.0575144436  0.055879405 -0.0194204690 -0.0351541495 -0.051000318
## 33  0.0520988977 -0.070090528 -0.0520278864 -0.0195679133 -0.103430230
## 34  0.0772074130  0.156017946  0.0235649954  0.0382576225  0.021859498
## 35  0.0007674031  0.000344795  0.0224096015  0.0131448925 -0.026429457
## 36  0.0593035458  0.014750037  0.0008702876 -0.0304677423 -0.052311010
## 37 -0.0705437238  0.037990250 -0.0331420796 -0.0228783172 -0.002633535
## 38  0.0524014407  0.014355577 -0.0887963930 -0.0331509956 -0.027746488
## 39  0.0613687238  0.009308687 -0.0857747173  0.0273246381  0.026815745
## 40 -0.0177951438  0.085916501 -0.0244053701 -0.0699375238  0.052564158
## 41 -0.0426657643  0.087349651  0.0313640585 -0.0145966170 -0.015372756
## 42  0.0493280756 -0.012744970  0.0291036072 -0.0241831202  0.046109216
##         Axis.21       Axis.22      Axis.23       Axis.24       Axis.25
## 1   0.012259861 -0.0196992525 -0.060740824 -2.032434e-02  0.0162516839
## 2   0.025827937  0.0323542314 -0.022190521  3.845920e-03 -0.0516174532
## 3   0.105522675 -0.0119684752 -0.029553413  4.530723e-02 -0.0174863154
## 4  -0.050122380  0.0555951877 -0.049026588 -1.271760e-02  0.0699408736
## 5  -0.020936413 -0.0175043137 -0.059041951 -7.106306e-02  0.0222283956
## 6  -0.016020215 -0.0575944394 -0.001890542  4.632957e-02  0.0127059271
## 7   0.001204899 -0.0111340111 -0.024708033  9.971439e-02 -0.0161962584
## 8   0.012279850  0.0077589702  0.035269235 -4.674713e-02 -0.0572386766
## 9  -0.044851474 -0.0333763171 -0.038411689 -1.541185e-02 -0.0087471888
## 10 -0.012898641 -0.0216698401 -0.014940243  4.704319e-05 -0.0200330252
## 11  0.027116784 -0.0402622075  0.014676657 -3.350764e-02  0.0156532808
## 12 -0.056221354 -0.0048906327  0.042305210 -8.337892e-03 -0.0362725172
## 13  0.036379167 -0.0511967918  0.016838467 -4.976119e-04  0.0653724665
## 14 -0.002282313  0.0185900559 -0.047334546  2.563458e-02 -0.0140572879
## 15  0.007182292  0.0263023696  0.001845498  2.790714e-03  0.0380363330
## 16  0.043286520  0.0019735657  0.011931928  2.262578e-02 -0.0195544263
## 17 -0.071609920  0.0633100457  0.005512213  1.344218e-02 -0.0076589878
## 18 -0.037171112  0.0428597297  0.060055341 -1.605930e-02 -0.0147953007
## 19 -0.017900159 -0.0465549052  0.008832986  5.323375e-02 -0.0164201249
## 20  0.048511510 -0.0055053025 -0.053325177 -7.517459e-02 -0.0322848955
## 21 -0.028199027  0.0662566017  0.029320510 -2.250469e-02  0.0432075788
## 22 -0.067078342 -0.0158477302  0.014179577  2.460059e-02  0.0010640037
## 23  0.032668706 -0.0082344112  0.053308205 -1.365690e-02  0.0161072488
## 24 -0.005894142 -0.0113346201  0.029440700  2.928396e-02  0.0113360287
## 25 -0.027907656 -0.0412835354  0.001899211  3.543709e-02  0.0162705943
## 26  0.089643793  0.0927797707  0.001345774 -1.508036e-02  0.0378442211
## 27  0.040052391 -0.0099943177  0.022285398 -1.554967e-02 -0.0082027779
## 28 -0.009118436 -0.0199261731 -0.021368480 -3.952900e-02 -0.0105730671
## 29  0.040851435  0.0623951432  0.019980568 -2.008480e-02 -0.0650959992
## 30 -0.052949311 -0.0424549125  0.045648049 -9.493119e-03  0.0553720766
## 31  0.037542690  0.0253192514 -0.080095758 -4.298341e-02  0.0139545317
## 32  0.028399050 -0.1060848908 -0.005870775 -1.389234e-02 -0.0866333488
## 33 -0.074139351  0.0448125834  0.008569644  4.951377e-02 -0.0517193218
## 34  0.020915910  0.0945652978 -0.005499474  8.139949e-02  0.0178538474
## 35  0.022411079  0.0109730354  0.006686024 -1.621954e-02  0.0001080057
## 36 -0.018579819 -0.0375102136 -0.010195062 -5.137855e-03  0.0235478842
## 37  0.027430097  0.0002985697 -0.002614678  2.555169e-02 -0.0318403253
## 38 -0.002451079 -0.0008081089 -0.062281465 -1.088238e-02  0.0497960066
## 39 -0.046126407  0.0580031658  0.003699657 -1.062487e-02 -0.0441447047
## 40 -0.044721886 -0.0537234326 -0.042939952  3.968057e-02  0.0290830125
## 41 -0.055219119 -0.0105275295  0.085446282 -8.896190e-02  0.0025693941
## 42  0.102911909 -0.0250612105  0.112952035  2.600353e-02  0.0522686075
##         Axis.26      Axis.27      Axis.28       Axis.29      Axis.30
## 1  -0.013735161  0.051507585 -0.041300585 -0.0118290240  0.023273788
## 2  -0.011956403  0.017266634 -0.072251116  0.0023073632  0.023514308
## 3  -0.006613766 -0.043830046  0.046871309 -0.0207699640  0.007375624
## 4  -0.046033848  0.001028177  0.033900342  0.0374609284 -0.016680805
## 5  -0.056189550 -0.075188820 -0.003152217 -0.0296360272  0.031192837
## 6  -0.052524301  0.015813999  0.047996063  0.0056020819  0.002665144
## 7  -0.034024199  0.011230514 -0.038691338  0.0357258158  0.003520665
## 8  -0.009325826  0.010820281  0.042302409 -0.0453953330  0.020377376
## 9   0.008769239  0.009639198  0.025408854 -0.0184373244  0.003159080
## 10  0.038385412  0.006152028  0.002891094 -0.0086424145  0.003586673
## 11  0.016053878  0.046086190  0.009395093 -0.0423278384  0.017964324
## 12 -0.015493214 -0.004759824 -0.005610562 -0.0076148443  0.045901358
## 13  0.012324231  0.034009086  0.002120227  0.0316181538 -0.001011061
## 14  0.052947468 -0.012345322  0.018940793 -0.0504524498 -0.035873204
## 15  0.050645942 -0.017111205  0.035038574 -0.0070061935 -0.011840620
## 16 -0.037835087 -0.019437554  0.021023550  0.0107629308 -0.024800932
## 17  0.018433234 -0.014860655  0.031821343 -0.0106928435  0.030098046
## 18 -0.031536652 -0.036667511 -0.060723017 -0.0296148798 -0.028947747
## 19  0.076028698  0.048534747  0.011999601  0.0053712164 -0.008276518
## 20  0.022883982 -0.022364045  0.010386463 -0.0237805564 -0.043421184
## 21  0.093368198 -0.003933634 -0.031666866  0.0098029980  0.028744420
## 22  0.044792303 -0.018269352 -0.016146319  0.0339053018 -0.013523917
## 23  0.011116515 -0.053054408 -0.019276853  0.0232236346  0.023750875
## 24 -0.044712165 -0.030207017  0.036088221  0.0061343375 -0.010733006
## 25  0.011045971 -0.057608146  0.012881215  0.0283865808 -0.012398229
## 26  0.001019108  0.008681707  0.038609754  0.0261413957 -0.010197356
## 27  0.021586587 -0.050112415 -0.034624477  0.0291472880 -0.020450093
## 28 -0.030513408 -0.004647620 -0.010960948  0.0745876855  0.039536246
## 29  0.033015120 -0.005541323  0.027507494  0.0618185110  0.006151913
## 30  0.001049106  0.021053703  0.037943614 -0.0020776145 -0.002516420
## 31 -0.003420580  0.063790081 -0.026132430  0.0159207468 -0.041543065
## 32  0.022201607  0.005803529  0.012558798  0.0119865678  0.015392659
## 33 -0.049742648  0.004259032 -0.010090623 -0.0129392953 -0.056891831
## 34 -0.011647544  0.027034780  0.014113247 -0.0473298826  0.057493070
## 35 -0.007700937 -0.016976601 -0.008708187  0.0009780183  0.003784125
## 36 -0.004793761 -0.053721557 -0.031727837 -0.0347467187 -0.004276484
## 37 -0.049855378  0.049080020 -0.006318845  0.0099112781  0.004864801
## 38 -0.014013122  0.003696216 -0.028890174 -0.0090589845  0.011151641
## 39  0.016554635  0.021612715 -0.014612061 -0.0016616146 -0.014529899
## 40  0.033582709  0.004437590 -0.029607907 -0.0132165258 -0.006795130
## 41 -0.038141414  0.064621754  0.020594426  0.0019381132 -0.020513671
## 42 -0.015994977  0.014477491 -0.049900121 -0.0355006184 -0.018277798
##         Axis.31       Axis.32       Axis.33       Axis.34       Axis.35
## 1   0.007059238 -0.0007670678  0.0195806506  0.0080775832  0.0081290996
## 2   0.008440087 -0.0195077968  0.0110975392 -0.0236593639 -0.0024646196
## 3   0.025390309 -0.0390045934 -0.0097693699 -0.0069693011  0.0043570655
## 4   0.014459311 -0.0280898481  0.0322033656 -0.0166440712  0.0009024419
## 5  -0.001720378  0.0149296218 -0.0260083261 -0.0047728587 -0.0010603263
## 6  -0.014296165  0.0156883844  0.0104191851  0.0002121988 -0.0107121541
## 7   0.045509962  0.0031206605 -0.0005696576  0.0300501300  0.0022337893
## 8  -0.001119220  0.0103908389  0.0164699962 -0.0195560500  0.0034013588
## 9  -0.010225433 -0.0131623474  0.0021752624  0.0190765737 -0.0012827415
## 10  0.018143397 -0.0074652988 -0.0047852612  0.0031818755  0.0002211096
## 11  0.001426710 -0.0117823493 -0.0133338783  0.0146200753 -0.0030678149
## 12  0.001736214 -0.0274019560 -0.0019639413 -0.0092075742 -0.0026416044
## 13 -0.022414931 -0.0033340383  0.0019938052 -0.0393811648  0.0016942444
## 14  0.030231437  0.0159758623 -0.0090562313 -0.0161059596  0.0001162016
## 15 -0.003567843 -0.0131455924 -0.0125259663 -0.0054672400 -0.0051551581
## 16 -0.008369656  0.0515838968  0.0073353911  0.0023615998  0.0025219665
## 17 -0.021843007  0.0274835839  0.0300012999  0.0172535100  0.0007568818
## 18 -0.028184923 -0.0004814388  0.0041950076 -0.0007197384  0.0036370278
## 19 -0.015480804 -0.0003693324  0.0263415402  0.0043114092  0.0010062559
## 20 -0.024885361 -0.0066925564  0.0001134196  0.0191419408  0.0024812819
## 21 -0.002497579  0.0185513489 -0.0232132933 -0.0016250524  0.0020801256
## 22 -0.004583220 -0.0280938395 -0.0273975523  0.0101192749  0.0014156446
## 23  0.036922000  0.0055920084  0.0068566916 -0.0100413393 -0.0000103342
## 24  0.001053063  0.0049789985 -0.0101555841 -0.0162881604  0.0015799872
## 25 -0.017703405  0.0074725893 -0.0106192254 -0.0072507501  0.0051548832
## 26  0.003378759 -0.0079557267  0.0099955114  0.0231753263  0.0009712160
## 27  0.009692024 -0.0164942748  0.0318266100  0.0011285905 -0.0046952235
## 28 -0.005274599  0.0118099877 -0.0116848775  0.0067520436  0.0008464087
## 29 -0.012842398  0.0152052807 -0.0091278179  0.0050326304 -0.0034247865
## 30 -0.004844648 -0.0182194172 -0.0101578416  0.0116664747  0.0030623452
## 31  0.005422924  0.0159014682 -0.0122147173 -0.0134859466 -0.0023207927
## 32  0.017576581  0.0080512883 -0.0031268899 -0.0020001541 -0.0005087597
## 33  0.015907185 -0.0060834974 -0.0230649330  0.0004092236 -0.0010367648
## 34  0.008079924  0.0049868712 -0.0070478402 -0.0025768135  0.0001778628
## 35 -0.003057084 -0.0030098910  0.0071964504  0.0092645072 -0.0005681676
## 36 -0.015137519 -0.0100335031  0.0329849029  0.0132974924 -0.0020387011
## 37 -0.076996787 -0.0165991970 -0.0164718591 -0.0019852329  0.0026680386
## 38  0.002011152  0.0078637682 -0.0164300720  0.0141075718 -0.0051654555
## 39 -0.008890028 -0.0108971537  0.0058370088 -0.0141421051 -0.0034380912
## 40  0.001548019  0.0312496619  0.0092974991 -0.0156552230  0.0007825317
## 41  0.056613396  0.0084395673 -0.0002171897  0.0053158582  0.0018250640
## 42 -0.006666701  0.0093150292 -0.0069788115  0.0089782095 -0.0024313363
## 
## $trace
## [1] 8.038491
## 
## $vectors.cor
##         Axis.1      Axis.2        Axis.3       Axis.4       Axis.5       Axis.6
## 1  -0.18632512  0.12036164  0.0570564444  0.116195465 -0.051680145 -0.022137535
## 2  -0.49511782  0.12253812 -0.1096724655  0.026752086  0.100493329 -0.166097051
## 3   0.17505960  0.05659738 -0.0435905723  0.147904657  0.049084361  0.124460042
## 4   0.12304159 -0.15966613 -0.1893391235  0.029661774 -0.015311660  0.055170355
## 5   0.28150628  0.30162381  0.0449269171 -0.042609840  0.014047654 -0.010559563
## 6   0.01820776 -0.35466255  0.0178714349 -0.044624097 -0.065939058 -0.012197167
## 7   0.01935986 -0.29188458 -0.0561994684 -0.097736742 -0.077189505 -0.023664762
## 8  -0.22818711 -0.15117655  0.2476485657 -0.125134323  0.195848185  0.043681080
## 9   0.18488894 -0.04586976  0.0247304025  0.013911961 -0.016935076 -0.147502162
## 10 -0.39685805  0.04512246 -0.1165703066 -0.079463344 -0.243163806  0.157571438
## 11  0.05604141 -0.24364845 -0.2540672203  0.096902217  0.184341504  0.005868806
## 12  0.17937604  0.14215611 -0.1743903822 -0.303693141 -0.193716779 -0.074081764
## 13  0.01099225 -0.16327902  0.0842417824 -0.073404941 -0.173516078 -0.075243041
## 14  0.06317118 -0.01516324  0.0043808012  0.050169801 -0.101453429  0.054020373
## 15 -0.22967044  0.08052048  0.1063711447  0.071491791  0.016297584 -0.176729844
## 16 -0.46848447  0.04411307 -0.1990183674 -0.056016254  0.088972331 -0.176959375
## 17  0.10208673  0.01955269  0.0417379028  0.212270235  0.021630931  0.034217873
## 18  0.08342342 -0.24644802 -0.1601256533 -0.026610920 -0.044247193 -0.004980469
## 19  0.24660065  0.29355179  0.0510843332 -0.035624841  0.017389150  0.051733296
## 20  0.03048449 -0.31980883 -0.0170712300 -0.067276896 -0.202579657 -0.154849010
## 21  0.02575058 -0.28339375 -0.0806065219 -0.016088233 -0.176363322  0.043008476
## 22 -0.23122626 -0.08885860  0.2966098791 -0.042632357  0.202269364  0.057639338
## 23  0.27390190 -0.02647359  0.1064826671  0.011792154  0.050559934 -0.193575997
## 24 -0.38797049  0.07827457 -0.0188508818  0.053495161 -0.186717856  0.245674037
## 25  0.15504663 -0.13675107 -0.1635260960  0.095778065  0.209087085 -0.056701839
## 26  0.22474707  0.35657937 -0.0810611578 -0.260504511  0.003859144 -0.045145118
## 27 -0.02545725 -0.04988962  0.2078464548  0.131901078 -0.014920776 -0.088930198
## 28  0.15390400 -0.00718366  0.0365106306  0.177745549  0.029853101  0.098803669
## 29 -0.15596169  0.21053032  0.0009026864  0.058141022 -0.087445739  0.064636943
## 30 -0.42893868  0.18809128 -0.1401358286 -0.012364120  0.140479166 -0.146251657
## 31  0.12564989 -0.10987799  0.1031371711  0.021732770  0.131318427  0.067832127
## 32  0.16501923 -0.04721296 -0.1252440299  0.036902525 -0.004167992 -0.002130438
## 33  0.17881796  0.18295641  0.1548541858 -0.002728433 -0.027461010 -0.105585998
## 34  0.05172757 -0.20422978  0.1800580350  0.069934995  0.003534031 -0.096460543
## 35 -0.04524192 -0.21308984  0.1367882688 -0.448677083  0.221266355  0.256345147
## 36 -0.18274308  0.11152686  0.1304870588  0.124751865 -0.088752504  0.149705799
## 37  0.16059159  0.09335648  0.1594946878  0.051596890 -0.097906371 -0.014314302
## 38 -0.36190577  0.14438761 -0.0282877870  0.007442450  0.019943674  0.043316563
## 39  0.19015249  0.03842307 -0.3218041736  0.127360410  0.191497174  0.140858276
## 40  0.24873998  0.31686147 -0.0054493010 -0.219215340  0.052210841 -0.020487611
## 41  0.08159120  0.05480715  0.1597989808  0.111602764 -0.079907088  0.008660051
## 42  0.21420783  0.15663585 -0.0680098677  0.108967731  0.005391721  0.111381754
##          Axis.7       Axis.8        Axis.9      Axis.10      Axis.11
## 1  -0.028799347 -0.027689322  0.1537707905  0.067201586  0.173791177
## 2  -0.061528931 -0.018885063 -0.0819790305  0.048826092 -0.041703869
## 3   0.098559699 -0.067623514  0.0928223290  0.056925814  0.048501730
## 4  -0.136851352 -0.069923093  0.0434561496  0.010270280 -0.110429587
## 5  -0.202776514 -0.046303459  0.0009332195 -0.027000822 -0.034166700
## 6   0.066094211  0.009689917  0.0849334601  0.141570225  0.018664406
## 7   0.063914794 -0.107509858 -0.0618546811 -0.092407511 -0.006528668
## 8   0.137622229 -0.015733059  0.0426568581 -0.146590127 -0.132705204
## 9   0.006047871  0.026851604 -0.1848239630 -0.084444040  0.046527158
## 10  0.006363386  0.119214910 -0.1155535774 -0.026288560 -0.013221972
## 11 -0.073293150  0.148789411  0.1047897811 -0.076054438 -0.044865841
## 12  0.144003964 -0.040965608  0.0712059854 -0.027896980 -0.072929364
## 13  0.031341311 -0.050933345 -0.0228986875 -0.179954888  0.063676307
## 14  0.096863729 -0.193096507 -0.1051957053 -0.036901316 -0.114013402
## 15 -0.020047571 -0.187956764  0.0848079136  0.021815760  0.152705919
## 16 -0.044639935 -0.043458023 -0.0321346349 -0.007141301 -0.052503224
## 17  0.044918805 -0.003925942 -0.0326404217  0.003533442  0.006886568
## 18 -0.001382145  0.021585573  0.2178302116  0.011445309 -0.013749426
## 19 -0.307101879  0.014696175  0.0233548071 -0.085937603 -0.115766882
## 20  0.003339768  0.065386247 -0.0435237416  0.069638057  0.028601776
## 21 -0.078586714 -0.064900969  0.0137930451  0.066988122 -0.042740815
## 22  0.090051491  0.115675579  0.0828137717  0.048004781 -0.097391756
## 23 -0.016206621  0.191828580 -0.2318565249  0.092247988  0.011031430
## 24 -0.116905655  0.265678901 -0.0378133868  0.043504271  0.034302830
## 25  0.045739832  0.056175531 -0.0159201136 -0.151339118  0.089910177
## 26  0.119779757  0.140034805  0.0371360958 -0.022333458 -0.055973320
## 27 -0.041186212  0.041807793  0.0986180450 -0.079614674  0.006206977
## 28  0.094599268 -0.125338210 -0.0040971079  0.009715683 -0.124926673
## 29  0.010480775 -0.053069381  0.1201250526  0.005373239  0.082699831
## 30  0.005963835 -0.118578740 -0.0729639004  0.172757979 -0.075108344
## 31  0.040773127  0.083624678 -0.0164147059  0.118040647 -0.132790677
## 32 -0.126833713 -0.011534435  0.0924601532  0.081927524 -0.006032726
## 33 -0.134893351 -0.006075287  0.0516486127 -0.039771315 -0.003541385
## 34 -0.078004908  0.108624746  0.0238334582  0.048460392  0.021133446
## 35 -0.178788604 -0.157743060 -0.1059336288  0.044071736  0.183840017
## 36  0.110102171 -0.035107880 -0.0724140463  0.057127559 -0.069145236
## 37  0.029033318 -0.018579373 -0.1510334142  0.022932132  0.011283047
## 38  0.048263389  0.068059296  0.0453451779 -0.258206034  0.038480925
## 39  0.101574690  0.032354243 -0.1559906647 -0.006077058  0.177763721
## 40  0.194928879  0.091131755  0.1186099199  0.126694408  0.095035646
## 41  0.046354714 -0.016085350 -0.0120691462 -0.027258245  0.127248274
## 42  0.011111589 -0.120193502 -0.0478337548  0.006144463 -0.058056290
##         Axis.12      Axis.13      Axis.14      Axis.15      Axis.16
## 1  -0.004010257  0.078200516 -0.041239205  0.170968340 -0.019461849
## 2  -0.052021535  0.020275230 -0.032138382 -0.055160124  0.054845236
## 3  -0.063245970  0.091816319  0.080493044 -0.118197846  0.068095163
## 4  -0.007110147 -0.042278881 -0.038370580  0.087488774 -0.024824871
## 5   0.129007244  0.143319685  0.011412282 -0.034025367  0.022122147
## 6   0.016706473  0.163499935  0.023849366  0.051522255  0.080264824
## 7   0.187578075 -0.005302721  0.026574218 -0.072660679 -0.016070330
## 8   0.098765699 -0.001227019  0.042568085  0.060526129  0.003662825
## 9  -0.108595465 -0.010014076  0.057463603  0.140564994  0.137939129
## 10 -0.031181902  0.012505043  0.024805886  0.001972389  0.133988473
## 11  0.036047021 -0.053169940 -0.232567346 -0.082632333  0.009213496
## 12 -0.054080964  0.013482268 -0.026804409  0.009858691 -0.094246436
## 13 -0.019569952  0.003442118  0.039744067 -0.086312539 -0.080856387
## 14 -0.069900465  0.001907870 -0.121743260  0.096456395  0.008146346
## 15  0.091313745 -0.167441158  0.036681467 -0.055589034  0.075666326
## 16 -0.030621146  0.066801495 -0.045756197 -0.047335430  0.033077823
## 17 -0.116628143 -0.080901973  0.035581255 -0.106626906 -0.032562177
## 18 -0.022369811 -0.050360908  0.142154970 -0.009399605  0.138700933
## 19  0.025671521  0.122549933  0.076983734 -0.081310123  0.017606602
## 20 -0.069225541  0.078728678  0.006027717 -0.088997777 -0.168051868
## 21  0.085929525  0.035962174 -0.023640511  0.020285403  0.060953675
## 22 -0.028064126  0.106202209 -0.007376584  0.043830448 -0.030675969
## 23  0.011465155 -0.020080585  0.040470322  0.047664070 -0.001068593
## 24 -0.022633352 -0.077809404 -0.027456530 -0.006346261 -0.022767750
## 25  0.046358247 -0.002193527 -0.047413917  0.084163582 -0.006402093
## 26  0.052695918 -0.062326735 -0.013537153  0.033489173  0.052506612
## 27 -0.046634480  0.036185488 -0.094250420  0.003261400  0.031996142
## 28 -0.174325611 -0.049138358 -0.036982148 -0.077709311  0.028163104
## 29  0.054837660  0.076973667 -0.029425946  0.093905684 -0.073712335
## 30  0.005782478  0.007697267  0.062134492 -0.005104115 -0.069625563
## 31  0.041775550 -0.047631456  0.109495402 -0.022429936 -0.002070745
## 32  0.037339431 -0.233671077  0.100124421  0.090005722 -0.068431073
## 33 -0.044584866 -0.062586440 -0.048679383  0.004086471 -0.059798188
## 34 -0.036015011  0.003974765  0.017753250  0.001496979 -0.092180995
## 35 -0.103204170 -0.057382585 -0.048540377 -0.013710191 -0.004464881
## 36  0.197491674 -0.077598775 -0.036837727 -0.027632527 -0.071043525
## 37  0.090276169 -0.065829166 -0.092463059  0.005212715  0.086176499
## 38 -0.078276286 -0.042478880  0.134782001  0.015157835 -0.055829039
## 39  0.088380469  0.108610371  0.055315067 -0.010076849 -0.073114475
## 40 -0.038432350 -0.043949093 -0.081453617 -0.070930298  0.025226258
## 41  0.021542054  0.044899075 -0.027207447 -0.089325981  0.054905279
## 42 -0.098232560  0.036338651  0.029469547  0.099595786 -0.055997750
##         Axis.17       Axis.18      Axis.19      Axis.20      Axis.21
## 1  -0.141214056  0.0240887701 -0.065942524  0.018933413  0.019451985
## 2   0.027027591 -0.0449754142  0.023129172  0.046323580  0.031039472
## 3  -0.037433154 -0.0031449751  0.104910437  0.033940019  0.128196754
## 4   0.047307433  0.0431723320  0.091154481 -0.060838945 -0.057525846
## 5   0.018608866 -0.0466875463 -0.016906411 -0.009151926 -0.024170273
## 6  -0.030216813  0.0492053188 -0.046314355  0.098613808 -0.019401372
## 7  -0.024481891 -0.0307614241 -0.007293546 -0.082676734  0.006518865
## 8  -0.016015214  0.0679919291  0.007096668 -0.044931438  0.015330467
## 9  -0.000182193 -0.0676889522  0.120748770 -0.108017772 -0.055781782
## 10  0.039508055 -0.0362073965 -0.065534278  0.068787144 -0.015519534
## 11 -0.082144126  0.0065635603  0.024615201 -0.008689243  0.037370484
## 12 -0.099478709 -0.1036461769 -0.041219620 -0.050903149 -0.077177367
## 13 -0.029491737 -0.0200250880  0.048858899  0.075846161  0.042850181
## 14  0.012628372  0.0272988854 -0.090858531  0.015902050 -0.001317494
## 15 -0.086768947  0.0327425758 -0.101992504 -0.114900715  0.010875916
## 16 -0.025329535  0.0225467522  0.081447324 -0.026356088  0.054617560
## 17 -0.119652106 -0.1058708030  0.037848957  0.070297302 -0.091551795
## 18  0.029957574  0.0149717491 -0.047831036 -0.009076589 -0.047214918
## 19 -0.014480725  0.0422226099 -0.070039506 -0.038620362 -0.022063523
## 20  0.027463216  0.0516917981 -0.033709527 -0.044250610  0.056944320
## 21 -0.008101370  0.0526024759  0.108275504  0.048943594 -0.031521158
## 22 -0.023073804  0.0206648140  0.052738055 -0.027215559 -0.085829475
## 23 -0.121309476  0.1098567756 -0.005187999  0.005398718  0.042671186
## 24 -0.054725705 -0.0129573776 -0.039795915 -0.115106888 -0.009478045
## 25  0.049115340 -0.1362840434 -0.103544138  0.076114433 -0.036329346
## 26  0.024947485  0.0292357689 -0.056263650  0.096111655  0.120833849
## 27  0.103600319 -0.0598741629 -0.032393450 -0.013274724  0.046066781
## 28  0.024543868  0.1196902043 -0.119456849 -0.032972274 -0.011221741
## 29  0.019182319 -0.0750265817  0.074592326 -0.036813666  0.050712447
## 30  0.076283863 -0.0256535759 -0.038123269  0.039901282 -0.070843301
## 31 -0.079055636 -0.1866370436 -0.024102239 -0.012511157  0.050260727
## 32  0.084418438  0.0204454523  0.046199564  0.055456029  0.031051874
## 33 -0.081304856  0.0667615139  0.043239537  0.130728477 -0.095158307
## 34  0.190118800 -0.0316165497 -0.056361828 -0.024494979  0.027934408
## 35 -0.001011463 -0.0261998280 -0.008661799  0.034669869  0.026288903
## 36  0.019263236 -0.0004668634  0.043738553  0.058250929 -0.022994195
## 37  0.043762625  0.0384516388  0.029101675  0.004651336  0.034199899
## 38  0.029767779  0.1084115230  0.043526562  0.032804037  0.002296615
## 39  0.018011753  0.1043796231 -0.035666745 -0.027044493 -0.061340201
## 40  0.095655766  0.0367266161  0.076360726 -0.081383143 -0.057060235
## 41  0.098005325 -0.0408017253  0.027563879  0.014719940 -0.068928824
## 42 -0.003706509 -0.0351971589  0.022053431 -0.057163322  0.126916037
##         Axis.22       Axis.23       Axis.24       Axis.25      Axis.26
## 1  -0.023978034 -0.0787342277 -0.0265438630 -0.0078934248  0.039414250
## 2   0.036640270 -0.0193246300  0.0046041246  0.0714013401  0.001776987
## 3  -0.021571247 -0.0286678016  0.0573332808  0.0316332930 -0.015322961
## 4   0.077473911 -0.0674090096 -0.0141220167 -0.0660059051  0.079677608
## 5  -0.023363805 -0.0691917434 -0.0879142069 -0.0031761736  0.074278127
## 6  -0.075243873 -0.0064360349  0.0612625384 -0.0041783660  0.068134982
## 7  -0.011350425 -0.0330052740  0.1331950873  0.0371480987  0.043317003
## 8   0.005749943  0.0589652017 -0.0573016543  0.0722287797 -0.005632044
## 9  -0.038926363 -0.0509379724 -0.0231814275  0.0090184422 -0.013983472
## 10 -0.027526561 -0.0194916971 -0.0078601608  0.0170127088 -0.062100646
## 11 -0.051201394  0.0164323960 -0.0456037188 -0.0297670313 -0.008542844
## 12 -0.005220044  0.0664420459 -0.0108193051  0.0458906298  0.009697878
## 13 -0.062315100  0.0113318578  0.0003376759 -0.0909768885  0.005558997
## 14  0.019571400 -0.0645685501  0.0286030700  0.0097296615 -0.074085762
## 15  0.035410953 -0.0027536919  0.0015011265 -0.0613980137 -0.058351966
## 16  0.003978602  0.0171894816  0.0326961893  0.0441556076  0.036497703
## 17  0.081056294  0.0016779567  0.0158631020 -0.0002316934 -0.035226886
## 18  0.052122191  0.0857371547 -0.0187248327  0.0236160246  0.034166753
## 19 -0.054503051  0.0036405547  0.0583221989 -0.0072932412 -0.099046130
## 20 -0.012316134 -0.0589501104 -0.1038765995  0.0406980163 -0.037121333
## 21  0.087679139  0.0212934561 -0.0277245842 -0.0896856489 -0.104585303
## 22 -0.018751391  0.0142435489  0.0290764600 -0.0182967111 -0.059563574
## 23 -0.010336013  0.0691347222 -0.0133982332 -0.0326345496 -0.014569515
## 24 -0.013760063  0.0413477682  0.0478544055 -0.0028465593  0.056564007
## 25 -0.055660951 -0.0049101331  0.0459752554 -0.0256327497 -0.020018462
## 26  0.118734832 -0.0008691848 -0.0204807862 -0.0458375325  0.006439503
## 27 -0.008519500  0.0319935260 -0.0194800162  0.0013432006 -0.036075577
## 28 -0.024329326 -0.0235706843 -0.0510732256  0.0257946666  0.042348770
## 29  0.073773203  0.0305986855 -0.0290294089  0.0697778381 -0.060334176
## 30 -0.051630764  0.0496327893 -0.0124517023 -0.0851635152  0.017149671
## 31  0.037825218 -0.1057697963 -0.0595334230 -0.0040428242  0.027107914
## 32 -0.139931056  0.0046879416 -0.0218631559  0.1025857581 -0.055138221
## 33  0.052867292  0.0176930475  0.0716756443  0.0812901319  0.043860814
## 34  0.117548208 -0.0103614533  0.1056296388 -0.0118888311  0.017225600
## 35  0.013243311  0.0101821399 -0.0207447853  0.0005442504  0.007898898
## 36 -0.047516678 -0.0143052582 -0.0074585999 -0.0304487980  0.005415632
## 37 -0.002059604  0.0043969310  0.0285844992  0.0613933468  0.061358460
## 38  0.001896168 -0.0873720368 -0.0142297382 -0.0550225269  0.044258375
## 39  0.076698793  0.0131327360 -0.0158456461  0.0540997123 -0.028577436
## 40 -0.067652387 -0.0709852585  0.0522391453 -0.0429173653 -0.031148803
## 41 -0.010400961  0.1105211849 -0.1109417060 -0.0048199238  0.060603718
## 42 -0.034205002  0.1373394219  0.0454493542 -0.0792032338  0.036673458
##         Axis.27       Axis.28       Axis.29       Axis.30       Axis.31
## 1  -0.066774065  0.0518124663 -2.134720e-02 -0.0427263034 -0.0078495361
## 2  -0.021484361  0.0923651930 -6.489545e-03 -0.0370875914 -0.0053966618
## 3   0.068438324 -0.0714421254 -1.898258e-02 -0.0164547623 -0.0428787114
## 4   0.011971001 -0.0483804147  5.833635e-02  0.0230084525 -0.0244275994
## 5   0.117139347  0.0005275781 -3.844002e-02 -0.0430941222 -0.0013523141
## 6  -0.014093742 -0.0711242838  9.211353e-03  0.0003565161  0.0279986462
## 7  -0.018721216  0.0548553324  5.581278e-02 -0.0182477610 -0.0627497138
## 8  -0.008629166 -0.0672065061 -5.688755e-02 -0.0279201498 -0.0053660784
## 9  -0.009353048 -0.0416793064 -2.798331e-02 -0.0020908065  0.0232845097
## 10 -0.015203217 -0.0024900270 -1.282610e-02 -0.0140801873 -0.0346535133
## 11 -0.058418383 -0.0218669545 -6.384617e-02 -0.0319372315 -0.0007861201
## 12  0.009222317  0.0039458682 -1.217327e-02 -0.0750239125  0.0052027435
## 13 -0.047134205 -0.0024193772  4.352921e-02  0.0119496611  0.0319710635
## 14  0.010874974 -0.0238123882 -6.331485e-02  0.0482349651 -0.0654828117
## 15  0.020288046 -0.0483407560 -9.929399e-03  0.0221303426  0.0019409598
## 16  0.027260351 -0.0174933554  2.130301e-02  0.0394325113  0.0078090284
## 17  0.020454903 -0.0414222369 -1.184429e-02 -0.0412737456  0.0439562109
## 18  0.047528081  0.0861314085 -5.314909e-02  0.0497056476  0.0373164869
## 19 -0.080833530 -0.0120683275  8.679868e-03  0.0125511788  0.0296145946
## 20  0.031750904 -0.0150492106 -3.806087e-02  0.0757703013  0.0311268932
## 21 -0.005976588  0.0474444006  1.182968e-02 -0.0419213885  0.0077589057
## 22  0.013948096  0.0264511973  4.613161e-02  0.0249541949  0.0100671605
## 23  0.067486684  0.0389947035  4.297500e-02 -0.0464855030 -0.0550156395
## 24  0.044066434 -0.0508371666  1.948484e-02  0.0263467116 -0.0047613908
## 25  0.076209224 -0.0083530235  4.334809e-02  0.0296984856  0.0277818359
## 26 -0.008084193 -0.0546071473  4.136085e-02  0.0178363003  0.0029745885
## 27  0.056386802  0.0592046027  4.232352e-02  0.0263642659 -0.0180215264
## 28  0.005531467  0.0245983894  1.082165e-01 -0.0562295900  0.0262725190
## 29  0.001951736 -0.0241897039  8.960254e-02 -0.0032629948  0.0320238969
## 30 -0.027583524 -0.0581185997  1.588026e-03  0.0053236409  0.0044902719
## 31 -0.088876551  0.0401075191  1.391653e-02  0.0601336006 -0.0208104569
## 32 -0.016139467 -0.0144861656  2.417663e-02 -0.0280777396 -0.0250092560
## 33 -0.004232634  0.0081244029 -2.351318e-02  0.0845925002 -0.0415863928
## 34 -0.026297157 -0.0317787089 -6.785056e-02 -0.0954552576 -0.0053209978
## 35  0.023791246  0.0144808920 -5.833584e-05 -0.0069436702  0.0088384633
## 36  0.079077678  0.0441094508 -5.637162e-02  0.0040138525  0.0287890737
## 37 -0.062236710  0.0017187452 -3.703620e-03  0.0081166508  0.1250986154
## 38 -0.001086998  0.0378065489 -1.965990e-02 -0.0223802626  0.0003855954
## 39 -0.037726477  0.0184169233 -7.743912e-03  0.0226342742  0.0071901158
## 40 -0.011847470  0.0446319174 -1.889481e-02  0.0115080138 -0.0095516361
## 41 -0.081924432 -0.0297437442  1.315165e-02  0.0144239113 -0.0962105666
## 42 -0.020720483  0.0611819900 -6.190786e-02  0.0316070008  0.0053387444
##          Axis.32      Axis.33       Axis.34       Axis.35       Axis.36
## 1   0.0046684337  0.044365766  0.0028402155  0.0711507445  0.0009201103
## 2   0.0287703601  0.007625514  0.0535390717 -0.0140492419 -0.0084270032
## 3   0.0761408634 -0.017108013  0.0182905744  0.0346123919  0.0003651605
## 4   0.0467815862  0.055871115  0.0568897861 -0.0003820493  0.0348611038
## 5  -0.0276733030 -0.059120286 -0.0027727641 -0.0025887205 -0.0143701615
## 6  -0.0349606419  0.018614666 -0.0036693261 -0.0898176100 -0.0150445884
## 7   0.0046214914  0.020278770 -0.0732788733  0.0275711038 -0.0239415684
## 8  -0.0376962443  0.019246211  0.0513492025  0.0339972508 -0.0221883109
## 9   0.0268806155  0.021707408 -0.0388952912 -0.0057106847 -0.0210662635
## 10  0.0215640825 -0.008177408 -0.0052094458 -0.0043948232  0.0409364688
## 11  0.0242927624 -0.015795637 -0.0394686881 -0.0224429406  0.0016978535
## 12  0.0514538050 -0.009385392  0.0262181240 -0.0314864644  0.0106305479
## 13  0.0005978566 -0.020694056  0.0937904521  0.0135873618 -0.0039280186
## 14 -0.0346153670 -0.023277254  0.0194186548  0.0013109920 -0.0052450418
## 15  0.0230885796 -0.028630301  0.0067661039 -0.0466949860  0.0205538101
## 16 -0.0902607086  0.014706666 -0.0007291587  0.0053271622  0.0367149620
## 17 -0.0608332260  0.060934635 -0.0245414951  0.0126803539 -0.0151816373
## 18  0.0001265568  0.010561344  0.0018095387  0.0324440949  0.0132436175
## 19 -0.0033068742  0.058173450  0.0024973802  0.0056164935  0.0168938317
## 20  0.0112347840  0.012415455 -0.0406509734  0.0271592079  0.0066236134
## 21 -0.0336425378 -0.054424617 -0.0064364754  0.0225681619 -0.0363374839
## 22  0.0633919302 -0.046655770 -0.0310146240  0.0108223068  0.0302587687
## 23 -0.0138825840  0.008214247  0.0172318976 -0.0063837810  0.0266694385
## 24 -0.0179721105 -0.027097463  0.0278891534  0.0209238400 -0.0452618123
## 25 -0.0182978801 -0.025721078  0.0112244097  0.0413779256  0.0293238316
## 26  0.0177092267  0.035775142 -0.0418124118  0.0155701701 -0.0182542693
## 27  0.0345595659  0.060172154  0.0191545582 -0.0419121074 -0.0706333352
## 28 -0.0152040400 -0.020066725 -0.0198519781  0.0075776100  0.0022447471
## 29 -0.0327184785 -0.018402065 -0.0298363036 -0.0293076878  0.0197082513
## 30  0.0352261760 -0.011688904 -0.0285519883  0.0352285201 -0.0453210280
## 31 -0.0222066780 -0.032511239  0.0212904827 -0.0268027710  0.0005751021
## 32 -0.0140953093 -0.008874345  0.0017562183 -0.0065151683 -0.0061273061
## 33  0.0183093181 -0.039702638 -0.0144776745 -0.0073917735 -0.0114037180
## 34 -0.0069873698 -0.016227206  0.0053205138 -0.0020171712  0.0262042024
## 35  0.0071341105  0.019560139 -0.0157685112 -0.0059279079  0.0023870768
## 36  0.0191884508  0.078448752 -0.0084214610 -0.0239431737  0.0307267756
## 37  0.0353116347 -0.041001307  0.0079187771  0.0211118502  0.0063085021
## 38 -0.0077729357 -0.026950978 -0.0450648382 -0.0440999331 -0.0017039040
## 39  0.0208147369  0.001931888  0.0386577879 -0.0310183546 -0.0247273329
## 40 -0.0647658604  0.005102935  0.0317268485  0.0081566365 -0.0055294307
## 41 -0.0170586359  0.008524005 -0.0204936877  0.0104923370  0.0309819368
## 42 -0.0179161420 -0.010717579 -0.0246337814 -0.0163991653  0.0058625016
##          Axis.37       Axis.38       Axis.39       Axis.40
## 1  -0.0165418634 -0.0011633264 -0.0079495912 -1.508493e-03
## 2   0.0747427526 -0.0284400411  0.0016503723 -3.123105e-03
## 3  -0.0098122591  0.0100855415  0.0078151277 -2.967051e-03
## 4   0.0147155622  0.0089986744 -0.0061313429  1.418417e-02
## 5   0.0078153014 -0.0035071788 -0.0134675889  4.721251e-03
## 6   0.0236578203 -0.0058256729 -0.0006039849  6.952300e-04
## 7   0.0134481884  0.0028220762  0.0005765507  5.862358e-03
## 8   0.0033713785 -0.0146855743  0.0094778591  1.544214e-02
## 9  -0.0107179571 -0.0332228997  0.0177093744 -1.256005e-02
## 10 -0.0315854114 -0.0092650239  0.0001509837  2.838282e-02
## 11  0.0003942231  0.0071237868  0.0192924513  3.475814e-05
## 12 -0.0183643713  0.0119247952 -0.0136005222 -6.964030e-03
## 13 -0.0030654809 -0.0129293166  0.0114484240 -7.043164e-03
## 14  0.0243560058  0.0400444536  0.0021502146 -1.696555e-02
## 15  0.0043744301 -0.0160119919 -0.0137945861  4.911225e-03
## 16 -0.0599534466  0.0041056856 -0.0278861118 -1.121054e-02
## 17  0.0212981904  0.0178561227 -0.0252599483  1.200479e-02
## 18  0.0065665671  0.0228970547  0.0235676724 -8.930219e-03
## 19  0.0076298839  0.0073916472  0.0088175685 -7.025603e-03
## 20  0.0210352897 -0.0105232210 -0.0055358935  8.621440e-03
## 21 -0.0144749765 -0.0169343976 -0.0105644772 -3.183339e-03
## 22  0.0161861836 -0.0024934340 -0.0373454965 -6.435636e-03
## 23  0.0045508044  0.0345390123  0.0221152021  3.256172e-03
## 24  0.0174292164 -0.0077631410 -0.0008108611 -1.155519e-02
## 25  0.0107279411 -0.0138279546  0.0015227231  2.609175e-03
## 26  0.0127004860 -0.0232768109 -0.0167800690 -9.432141e-03
## 27 -0.0392026988  0.0250145819 -0.0143495948  7.234475e-03
## 28 -0.0186219545 -0.0358737351  0.0163462273 -2.617257e-03
## 29  0.0166817323  0.0141305107  0.0517109904  3.217337e-03
## 30 -0.0156870123  0.0265761631  0.0272363850  4.258857e-03
## 31 -0.0258758356  0.0070926837  0.0068530385 -1.947760e-03
## 32  0.0037376577 -0.0001315819 -0.0309324422 -4.778946e-03
## 33 -0.0231998702 -0.0310832984  0.0218343172  8.932097e-03
## 34 -0.0242603249 -0.0105477416  0.0050499779 -6.523822e-03
## 35 -0.0042122958  0.0085726201  0.0054178707 -3.591728e-03
## 36 -0.0169147191 -0.0246390269  0.0166954635 -1.505971e-02
## 37  0.0003364824  0.0476306188 -0.0166089194  6.826141e-03
## 38  0.0099174070  0.0376228074 -0.0027731783 -1.888538e-03
## 39 -0.0224853549 -0.0086246589 -0.0138163979 -2.557417e-03
## 40  0.0058070140 -0.0013389767  0.0120674183  1.123718e-02
## 41  0.0196213662  0.0042802660 -0.0148266968 -9.942125e-03
## 42  0.0138739479 -0.0266000974 -0.0164685097  1.537980e-02
## 
## $trace.cor
## [1] 10.89444
## 
## attr(,"class")
## [1] "pcoa"

Visualize the PCoA

# extract the site scores and merge with metadata
lizard.scores <- as.data.frame(lizard.pcoa$vectors) %>%
  bind_cols(lizard.meta)

# create convex hulls grouped by site exposure based on site scores
lizard.hulls <- lizard.scores %>%
  group_by(Exposure) %>%
  slice(chull(Axis.1, Axis.2))

# plot PCoA with color and convex hulls as exposure
# you cannot add loadings to a PCoA because it only works as a distance matrix
lizard.plot.pcoa <- ggplot() +
  geom_point(data = lizard.scores, aes(x = Axis.1, y = Axis.2, color = Exposure), size = 2) +
  geom_polygon(data = lizard.hulls, aes(x = Axis.1, Axis.2, fill = Exposure), alpha = 0.5) +
  scale_fill_fish_d(option = "Stegastes_nigricans", end = 0.8) +
  scale_color_fish_d(option = "Stegastes_nigricans", end = 0.8) +
  theme_bw() +
  xlab("PCo1") +
  ylab("PCo2") +
  ggtitle("PCoA")
lizard.plot.pcoa

3.2 Non-metric multidimensional scaling (nMDS)

nMDS is the most versatile and flexible ordination tool. It works with ranks, rather than differences based on abundances.

Run an nMDS with a Bray-Curtis dissimilarity metric

# use metaMDS() to run the nMDS
# specify the data, the dimensions, the number of tries to give the nMDS to find a solution, and the distance metric
lizard.mds <- metaMDS(comm = lizard.raw, k = 2, trymax = 1000, distance = "bray")
## Square root transformation
## Wisconsin double standardization
## Run 0 stress 0.1771763 
## Run 1 stress 0.1810028 
## Run 2 stress 0.1764021 
## ... New best solution
## ... Procrustes: rmse 0.03620235  max resid 0.2122573 
## Run 3 stress 0.1976006 
## Run 4 stress 0.2318404 
## Run 5 stress 0.2293186 
## Run 6 stress 0.1771763 
## Run 7 stress 0.1766939 
## ... Procrustes: rmse 0.03657731  max resid 0.2148505 
## Run 8 stress 0.1771763 
## Run 9 stress 0.1808915 
## Run 10 stress 0.180915 
## Run 11 stress 0.1764591 
## ... Procrustes: rmse 0.002669919  max resid 0.01224844 
## Run 12 stress 0.1763359 
## ... New best solution
## ... Procrustes: rmse 0.008458588  max resid 0.04425986 
## Run 13 stress 0.1810182 
## Run 14 stress 0.1764021 
## ... Procrustes: rmse 0.008456673  max resid 0.04424405 
## Run 15 stress 0.2243582 
## Run 16 stress 0.1808914 
## Run 17 stress 0.2207692 
## Run 18 stress 0.1764021 
## ... Procrustes: rmse 0.008459417  max resid 0.04427232 
## Run 19 stress 0.1763359 
## ... Procrustes: rmse 1.776154e-05  max resid 9.620321e-05 
## ... Similar to previous best
## Run 20 stress 0.1825523 
## *** Best solution repeated 1 times
# view results of nMDS
lizard.mds
## 
## Call:
## metaMDS(comm = lizard.raw, distance = "bray", k = 2, trymax = 1000) 
## 
## global Multidimensional Scaling using monoMDS
## 
## Data:     wisconsin(sqrt(lizard.raw)) 
## Distance: bray 
## 
## Dimensions: 2 
## Stress:     0.1763359 
## Stress type 1, weak ties
## Best solution was repeated 1 time in 20 tries
## The best solution was from try 12 (random start)
## Scaling: centring, PC rotation, halfchange scaling 
## Species: expanded scores based on 'wisconsin(sqrt(lizard.raw))'
# view stressplot
stressplot(lizard.mds)

Interpretation of the results:

  • The MDS tells you what kind of data transformation it performed under “Data.” Here, it used a Wisconsin transformation of the square root of the raw data.
  • The stress needs to be below 0.25. Here, the stress is low (0.17).
  • The stressplot shows the goodness of fit. When there is a good fit, the dots are snug along the line. This data has a good fit.
  • The R2 indicates whether the nMDS is better than a metric (linear) solution. In this case, it does.

Visualize the nMDS

# extract the site scores and merge with metadata
lizard.scores <- as.data.frame(lizard.mds$points) %>%
  bind_cols(lizard.meta)

# create convex hulls grouped by site exposure based on site scores
lizard.hulls <- lizard.scores %>%
  group_by(Exposure) %>%
  slice(chull(MDS1, MDS2))

# plot nMDS with color and convex hulls as exposure
lizard.plot.mds <- ggplot() +
  geom_point(data = lizard.scores, aes(x = MDS1, y = MDS2, color = Exposure), size = 2) +
  geom_polygon(data = lizard.hulls, aes(x = MDS1, MDS2, fill = Exposure), alpha = 0.5) +
  scale_fill_fish_d(option = "Stegastes_nigricans", end = 0.8) +
  scale_color_fish_d(option = "Stegastes_nigricans", end = 0.8) +
  theme_bw() +
  xlab("MDS1") +
  ylab("MDS2") +
  ggtitle("nMDS")
lizard.plot.mds

# view PcOA and nMDS together for comparison
# despite using the same distance metric (Bray-Curtis), the nMDS produces a cleaner, better separation among the transects than the PCoA.
pcoamds <- lizard.plot.pcoa / lizard.plot.mds
pcoamds