OCN 683 - Homework 14

Sarah Pennington

The attached file contains 28 samples of zooplankton community composition, collected from 20 locations within 10 sites. 7 of the sites were fishponds, while 3 of the sites were open coast. Within each site one sample was taken within a mangrove-dominated portion of the coast, while a paired sample was taken from a non-mangrove location. A few of the 20 locations were sampled twice, leading to 28 total samples. In this assignment we will use the zooplankton sampled using light traps.

The authors compiled a variety of measurements of the environmental context at each of the ten sites. These are stored in columns 37:49 in the attached file, and include the length of mangrovedominated shoreline, the length of non-mangrove shoreline, the percent mangrove shoreline, the area of the fishpond (this corresponds to the neighboring fishpond for the open coast sites), four measurements of mangrove leaves at the site (d13C, C content, d15N, and N content), and anumber of variables characterizing the surrounding watershed (relief in feet, percent mature tree cover, mean annual precipitation, percent impervious substrate, and percent of the land that is developed).

Columns 8:35 contain counts of different taxa of zooplankton, including holoplankton and meroplankton. The column names are largely self-explanatory, but noted that crab larvae are divided into multiple stages (three forms of megalopae, zoea, and postlarval), and para.cope = parasitic copepods.

zoo <- read_csv("mangrove_fishpond_zooplankton_edit.csv")
## Rows: 28 Columns: 49
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (5): Site, Date, Location, Fishpond, Mangrove
## dbl (44): Latitude, Longitude, polychaete, barnacle, copepod, monstrillidae,...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
1. Start by characterizing how the environmental variables (columns 37:49) are correlated with each other across the ten sites, using a principal components analysis. Provide an appropriate plot and summary of the PCA results. What are the major patterns of variation across these sites?
enviro = subset(zoo, select = c(37:49)) 
enviro = na.omit(enviro) 
 
pca = princomp(enviro, cor = TRUE) 
summary(pca)
## Importance of components:
##                           Comp.1    Comp.2    Comp.3     Comp.4     Comp.5
## Standard deviation     2.4591664 1.5418092 1.3316315 1.09389399 0.90423622
## Proportion of Variance 0.4651923 0.1828597 0.1364033 0.09204647 0.06289563
## Cumulative Proportion  0.4651923 0.6480519 0.7844552 0.87650164 0.93939726
##                            Comp.6     Comp.7      Comp.8      Comp.9
## Standard deviation     0.69506314 0.49771057 0.198369951 0.132877250
## Proportion of Variance 0.03716252 0.01905506 0.003026972 0.001358182
## Cumulative Proportion  0.97655978 0.99561485 0.998641818 1.000000000
##                             Comp.10      Comp.11 Comp.12 Comp.13
## Standard deviation     1.768825e-08 1.740191e-08       0       0
## Proportion of Variance 2.406723e-17 2.329434e-17       0       0
## Cumulative Proportion  1.000000e+00 1.000000e+00       1       1
loadings(pca) 
## 
## Loadings:
##                            Comp.1 Comp.2 Comp.3 Comp.4 Comp.5 Comp.6 Comp.7
## mangrove.shoreline          0.329         0.352  0.270         0.122  0.205
## non.mangrove.shoreline      0.197 -0.517  0.163  0.192 -0.155  0.150       
## percent.mangrove.shoreline  0.238  0.420  0.266         0.316  0.226       
## pond.area                   0.351         0.235  0.219         0.289  0.376
## d13C                       -0.112 -0.465        -0.193  0.498  0.509 -0.352
## C                          -0.213  0.315  0.236  0.478         0.133 -0.629
## d15N                        0.141  0.300  0.281 -0.581 -0.344  0.181 -0.173
## N                                         0.574 -0.142  0.471 -0.578       
## relief                     -0.354  0.121  0.151 -0.228         0.381  0.290
## percent.trees              -0.340  0.231 -0.179         0.269  0.194  0.382
## precip                     -0.357                0.399                0.143
## percent.impervious          0.330  0.179 -0.314         0.312              
## percent.developed           0.334  0.167 -0.304         0.313              
##                            Comp.8 Comp.9 Comp.10 Comp.11 Comp.12 Comp.13
## mangrove.shoreline                 0.406          0.637           0.242 
## non.mangrove.shoreline     -0.415         0.196  -0.303   0.501   0.162 
## percent.mangrove.shoreline  0.362 -0.176  0.496  -0.292   0.227         
## pond.area                         -0.351 -0.428  -0.262  -0.336  -0.212 
## d13C                        0.206  0.103 -0.159   0.102                 
## C                          -0.224 -0.195 -0.177                   0.149 
## d15N                               0.309 -0.329  -0.117   0.210  -0.146 
## N                          -0.213        -0.157                         
## relief                     -0.552 -0.135  0.367   0.152  -0.261         
## percent.trees                            -0.444           0.428   0.390 
## precip                             0.536         -0.231          -0.569 
## percent.impervious         -0.338  0.429         -0.379  -0.397   0.240 
## percent.developed          -0.347 -0.197 -0.102   0.300   0.337  -0.531 
## 
##                Comp.1 Comp.2 Comp.3 Comp.4 Comp.5 Comp.6 Comp.7 Comp.8 Comp.9
## SS loadings     1.000  1.000  1.000  1.000  1.000  1.000  1.000  1.000  1.000
## Proportion Var  0.077  0.077  0.077  0.077  0.077  0.077  0.077  0.077  0.077
## Cumulative Var  0.077  0.154  0.231  0.308  0.385  0.462  0.538  0.615  0.692
##                Comp.10 Comp.11 Comp.12 Comp.13
## SS loadings      1.000   1.000   1.000   1.000
## Proportion Var   0.077   0.077   0.077   0.077
## Cumulative Var   0.769   0.846   0.923   1.000
biplot(pca, pch = 21, col = c('grey', 'blue'), scale = 0)

##What are the major patterns of variation across the sites? 
  ###It seems on the positive end associated with PCA1 are the mangrove shoreline and pond area while on the negative end of PCA1 are the amount of trees and precipitation.  For PCA2 youve got higher nitrogen (N) and d13C associated with percent nonmangrove shoreline on the negative end. On the positive end of PCA2 theres d15N, carbon, and percent trees associated with mangrove shoreline. 
2. Next, characterize the major axes of variation in zooplankton community composition (i.e., an unconstrained ordination). Consider how to transform and standardize the community data before the analysis. Provide an appropriate plot and interpret what it means. Finally, use envfit() to assess which environmental variables are correlated with the major axes of community composition.
community <- zoo[, 8:35]
head(community)
## # A tibble: 6 × 28
##   polychaete barnacle copepod monstrillidae para.cope amphipod cumacean Lucifer
##        <dbl>    <dbl>   <dbl>         <dbl>     <dbl>    <dbl>    <dbl>   <dbl>
## 1         76        0   63808            58         1       59        1      67
## 2          8        0    5664            64         0      608       16      56
## 3          0        0    3752             9         0        0        4       0
## 4          0        0  221184             1         0       42        6      12
## 5          0        0    9264            17         0       85        5       4
## 6          2        1      92            38         0       23      110       0
## # ℹ 20 more variables: shrimp <dbl>, megalopa1 <dbl>, megalopa2 <dbl>,
## #   megalopa.oth <dbl>, zoea <dbl>, postlarval.crab <dbl>, lobster <dbl>,
## #   isopod <dbl>, mysid <dbl>, mantis.shrimp <dbl>, ostracod <dbl>,
## #   cephalopod <dbl>, fish <dbl>, hydropoids <dbl>, jellyfish <dbl>,
## #   bivalve <dbl>, gastropod <dbl>, nematode <dbl>, leech <dbl>, nauplius <dbl>
ord = metaMDS(community, distance = "bray", k = 2, trymax = 100)
## Square root transformation
## Wisconsin double standardization
## Run 0 stress 0.2638881 
## Run 1 stress 0.2636711 
## ... New best solution
## ... Procrustes: rmse 0.1275688  max resid 0.3734881 
## Run 2 stress 0.2851228 
## Run 3 stress 0.26967 
## Run 4 stress 0.2696208 
## Run 5 stress 0.2848894 
## Run 6 stress 0.2863909 
## Run 7 stress 0.264623 
## Run 8 stress 0.2683324 
## Run 9 stress 0.2716648 
## Run 10 stress 0.2585781 
## ... New best solution
## ... Procrustes: rmse 0.1485295  max resid 0.4143242 
## Run 11 stress 0.3101093 
## Run 12 stress 0.2702674 
## Run 13 stress 0.2832424 
## Run 14 stress 0.2696047 
## Run 15 stress 0.2744982 
## Run 16 stress 0.2610527 
## Run 17 stress 0.2648923 
## Run 18 stress 0.267905 
## Run 19 stress 0.2611276 
## Run 20 stress 0.2836657 
## Run 21 stress 0.2646739 
## Run 22 stress 0.2709487 
## Run 23 stress 0.2639279 
## Run 24 stress 0.2836508 
## Run 25 stress 0.2940722 
## Run 26 stress 0.2730882 
## Run 27 stress 0.2815924 
## Run 28 stress 0.270988 
## Run 29 stress 0.294092 
## Run 30 stress 0.2722645 
## Run 31 stress 0.3871705 
## Run 32 stress 0.260297 
## Run 33 stress 0.2691637 
## Run 34 stress 0.2791235 
## Run 35 stress 0.2799847 
## Run 36 stress 0.2735954 
## Run 37 stress 0.3012611 
## Run 38 stress 0.2836528 
## Run 39 stress 0.2610049 
## Run 40 stress 0.2739341 
## Run 41 stress 0.2791842 
## Run 42 stress 0.2880567 
## Run 43 stress 0.2637295 
## Run 44 stress 0.2736642 
## Run 45 stress 0.2720347 
## Run 46 stress 0.259165 
## Run 47 stress 0.2603333 
## Run 48 stress 0.2941782 
## Run 49 stress 0.2867157 
## Run 50 stress 0.2697085 
## Run 51 stress 0.2696767 
## Run 52 stress 0.2721582 
## Run 53 stress 0.2681693 
## Run 54 stress 0.2700578 
## Run 55 stress 0.2784155 
## Run 56 stress 0.2732868 
## Run 57 stress 0.2778779 
## Run 58 stress 0.2766756 
## Run 59 stress 0.3012215 
## Run 60 stress 0.2767987 
## Run 61 stress 0.2676446 
## Run 62 stress 0.2728057 
## Run 63 stress 0.2687763 
## Run 64 stress 0.2672588 
## Run 65 stress 0.2689849 
## Run 66 stress 0.286006 
## Run 67 stress 0.2749058 
## Run 68 stress 0.2670612 
## Run 69 stress 0.2693318 
## Run 70 stress 0.2805853 
## Run 71 stress 0.2738366 
## Run 72 stress 0.2730658 
## Run 73 stress 0.2755578 
## Run 74 stress 0.2718786 
## Run 75 stress 0.2736308 
## Run 76 stress 0.2951772 
## Run 77 stress 0.2689116 
## Run 78 stress 0.2829481 
## Run 79 stress 0.2688996 
## Run 80 stress 0.3064837 
## Run 81 stress 0.2615302 
## Run 82 stress 0.2583432 
## ... New best solution
## ... Procrustes: rmse 0.01191726  max resid 0.05241095 
## Run 83 stress 0.2610166 
## Run 84 stress 0.27632 
## Run 85 stress 0.2713658 
## Run 86 stress 0.2685345 
## Run 87 stress 0.2802666 
## Run 88 stress 0.2847746 
## Run 89 stress 0.2617098 
## Run 90 stress 0.2920597 
## Run 91 stress 0.2753417 
## Run 92 stress 0.2744722 
## Run 93 stress 0.2640539 
## Run 94 stress 0.2583432 
## ... New best solution
## ... Procrustes: rmse 3.713541e-05  max resid 0.0001171317 
## ... Similar to previous best
## *** Best solution repeated 1 times
ord #stress= 0.258 
## 
## Call:
## metaMDS(comm = community, distance = "bray", k = 2, trymax = 100) 
## 
## global Multidimensional Scaling using monoMDS
## 
## Data:     wisconsin(sqrt(community)) 
## Distance: bray 
## 
## Dimensions: 2 
## Stress:     0.2583432 
## Stress type 1, weak ties
## Best solution was repeated 1 time in 94 tries
## The best solution was from try 94 (random start)
## Scaling: centring, PC rotation, halfchange scaling 
## Species: expanded scores based on 'wisconsin(sqrt(community))'
ord2 = metaMDS(community, distance = "bray", k = 3, trymax = 100)
## Square root transformation
## Wisconsin double standardization
## Run 0 stress 0.1807743 
## Run 1 stress 0.1908232 
## Run 2 stress 0.179379 
## ... New best solution
## ... Procrustes: rmse 0.1105625  max resid 0.3666202 
## Run 3 stress 0.1744731 
## ... New best solution
## ... Procrustes: rmse 0.1334569  max resid 0.3865734 
## Run 4 stress 0.1744735 
## ... Procrustes: rmse 0.0004276429  max resid 0.000969595 
## ... Similar to previous best
## Run 5 stress 0.1807969 
## Run 6 stress 0.1793787 
## Run 7 stress 0.1803508 
## Run 8 stress 0.180342 
## Run 9 stress 0.1744735 
## ... Procrustes: rmse 0.0003994165  max resid 0.0008764394 
## ... Similar to previous best
## Run 10 stress 0.1811765 
## Run 11 stress 0.1744737 
## ... Procrustes: rmse 0.0004953536  max resid 0.001123504 
## ... Similar to previous best
## Run 12 stress 0.1744732 
## ... Procrustes: rmse 0.0001447249  max resid 0.0003569769 
## ... Similar to previous best
## Run 13 stress 0.1828215 
## Run 14 stress 0.1913162 
## Run 15 stress 0.1846184 
## Run 16 stress 0.1781758 
## Run 17 stress 0.1807977 
## Run 18 stress 0.1744731 
## ... New best solution
## ... Procrustes: rmse 0.0001276725  max resid 0.0002982066 
## ... Similar to previous best
## Run 19 stress 0.1744731 
## ... Procrustes: rmse 0.0001329735  max resid 0.0003186751 
## ... Similar to previous best
## Run 20 stress 0.1744737 
## ... Procrustes: rmse 0.0006118092  max resid 0.001849967 
## ... Similar to previous best
## *** Best solution repeated 3 times
ord2 #stress = 0.17 
## 
## Call:
## metaMDS(comm = community, distance = "bray", k = 3, trymax = 100) 
## 
## global Multidimensional Scaling using monoMDS
## 
## Data:     wisconsin(sqrt(community)) 
## Distance: bray 
## 
## Dimensions: 3 
## Stress:     0.1744731 
## Stress type 1, weak ties
## Best solution was repeated 3 times in 20 tries
## The best solution was from try 18 (random start)
## Scaling: centring, PC rotation, halfchange scaling 
## Species: expanded scores based on 'wisconsin(sqrt(community))'
ord3 = metaMDS(community, distance = "bray", k = 4, trymax = 100)
## Square root transformation
## Wisconsin double standardization
## Run 0 stress 0.1248328 
## Run 1 stress 0.1342465 
## Run 2 stress 0.1251285 
## ... Procrustes: rmse 0.01483588  max resid 0.05353956 
## Run 3 stress 0.1288287 
## Run 4 stress 0.1248326 
## ... New best solution
## ... Procrustes: rmse 0.0003057005  max resid 0.001042467 
## ... Similar to previous best
## Run 5 stress 0.1248322 
## ... New best solution
## ... Procrustes: rmse 0.001308637  max resid 0.004313022 
## ... Similar to previous best
## Run 6 stress 0.1248317 
## ... New best solution
## ... Procrustes: rmse 0.0005651589  max resid 0.002219175 
## ... Similar to previous best
## Run 7 stress 0.1248322 
## ... Procrustes: rmse 0.0007275402  max resid 0.002013593 
## ... Similar to previous best
## Run 8 stress 0.1257518 
## Run 9 stress 0.1248324 
## ... Procrustes: rmse 0.0006797172  max resid 0.002027031 
## ... Similar to previous best
## Run 10 stress 0.1248321 
## ... Procrustes: rmse 0.0006724015  max resid 0.001968427 
## ... Similar to previous best
## Run 11 stress 0.1248319 
## ... Procrustes: rmse 0.0004719972  max resid 0.00144295 
## ... Similar to previous best
## Run 12 stress 0.1248323 
## ... Procrustes: rmse 0.0008148393  max resid 0.002464482 
## ... Similar to previous best
## Run 13 stress 0.1248317 
## ... Procrustes: rmse 0.0002042329  max resid 0.0006156107 
## ... Similar to previous best
## Run 14 stress 0.1276562 
## Run 15 stress 0.1357096 
## Run 16 stress 0.1346737 
## Run 17 stress 0.1248319 
## ... Procrustes: rmse 0.0003607873  max resid 0.001127069 
## ... Similar to previous best
## Run 18 stress 0.1277211 
## Run 19 stress 0.124832 
## ... Procrustes: rmse 0.0004915967  max resid 0.001497645 
## ... Similar to previous best
## Run 20 stress 0.127959 
## *** Best solution repeated 9 times
ord3  #stress = 0.13 
## 
## Call:
## metaMDS(comm = community, distance = "bray", k = 4, trymax = 100) 
## 
## global Multidimensional Scaling using monoMDS
## 
## Data:     wisconsin(sqrt(community)) 
## Distance: bray 
## 
## Dimensions: 4 
## Stress:     0.1248317 
## Stress type 1, weak ties
## Best solution was repeated 9 times in 20 tries
## The best solution was from try 6 (random start)
## Scaling: centring, PC rotation, halfchange scaling 
## Species: expanded scores based on 'wisconsin(sqrt(community))'
par(mfrow= c(1,3))
plot(ord, type = "text", main = "k=2") 
plot(ord2, type = "text", main = "k=3")
plot(ord3, type = "text", main = "k=4")

plot(ord3, type = "text", main = "k=4")
  ###There are some apparent groupings: paracope, bivalve and leech are a grouping. I would also say hydropoids, Lucifer, and barnacle are a grouping. Out by itself is jellyfish, not close to anything. 


fit = envfit(ord3 ~ percent.mangrove.shoreline + pond.area + C + N + relief + percent.trees, data = zoo, na.rm = T) 
ordiplot(ord3, display = "sites", type = 'n', main = 'nmds 4D') 
points(ord3, col = 'grey') 
plot(fit, col = 'red', arrow.mul = 0.7) 

fit
## 
## ***VECTORS
## 
##                               NMDS1    NMDS2     r2 Pr(>r)    
## percent.mangrove.shoreline  0.90686 -0.42143 0.2134  0.049 *  
## pond.area                   0.68700 -0.72666 0.4517  0.001 ***
## C                          -0.99934 -0.03628 0.1705  0.089 .  
## N                           0.83576  0.54909 0.0962  0.321    
## relief                     -0.71105  0.70314 0.4080  0.002 ** 
## percent.trees              -0.71284  0.70133 0.4256  0.003 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Permutation: free
## Number of permutations: 999
ordisurf(ord3, enviro$percent.mangrove.shoreline, bubble = TRUE, labcex = 1.5, col = 'blue', lwd
 = 2) 

## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
## 
## Estimated degrees of freedom:
## 2.93  total = 3.93 
## 
## REML score: -18.35879
ordisurf(ord3, enviro$C, bubble = TRUE, labcex = 1.5, col = 'blue', lwd 
= 2) 
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
## 
## Estimated degrees of freedom:
## 4.92  total = 5.92 
## 
## REML score: 153.1621
ordisurf(ord3, enviro$N, bubble = TRUE, labcex = 1.5, col = 'blue', lwd 
= 2) 
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
## 
## Estimated degrees of freedom:
## 4.85  total = 5.85 
## 
## REML score: 79.67959
ordisurf(ord3, enviro$percent.trees, bubble = TRUE, labcex = 1.5, col = 'blue', 
lwd = 2)

## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
## 
## Estimated degrees of freedom:
## 4.73  total = 5.73 
## 
## REML score: 105.796
##There are some species associated with higher percent mangroves and the conditions brought on by having mangroves, and some species associated with more natural areas. 
3. Although envfit() is a useful tool, it does not directly ask how well community composition can be explained by a set of environmental variables. Use a constrained ordination to ask this question. How much of variation in community composition can be explained by the set of environmental variables? How much can be explained by the first two axes? What do those axes represent (visualizing with a triplot will help)?
str(enviro)
## tibble [28 × 13] (S3: tbl_df/tbl/data.frame)
##  $ mangrove.shoreline        : num [1:28] 289 289 749 749 478 ...
##  $ non.mangrove.shoreline    : num [1:28] 711 711 402 402 551 ...
##  $ percent.mangrove.shoreline: num [1:28] 0.289 0.289 0.65 0.65 0.464 ...
##  $ pond.area                 : num [1:28] 78422 78422 127773 127773 99417 ...
##  $ d13C                      : num [1:28] -26.5 -26.5 -29.9 -29.9 -28.5 ...
##  $ C                         : num [1:28] 1366 1366 1332 1332 1318 ...
##  $ d15N                      : num [1:28] 1.02 1.02 2.9 2.9 3.08 ...
##  $ N                         : num [1:28] 28.8 28.8 29.3 29.3 36.3 ...
##  $ relief                    : num [1:28] 2230 2230 437 437 2270 2270 1580 1580 689 689 ...
##  $ percent.trees             : num [1:28] 16 16 4 4 3 3 6 6 2 2 ...
##  $ precip                    : num [1:28] 55.1 55.1 19.2 19.2 30.9 30.9 40.5 40.5 40.8 40.8 ...
##  $ percent.impervious        : num [1:28] 1.11 1.11 7.25 7.25 0.67 ...
##  $ percent.developed         : num [1:28] 5.49 5.49 36.6 36.6 4.67 ...
dbrda = dbrda(community ~ mangrove.shoreline + non.mangrove.shoreline+ percent.mangrove.shoreline + pond.area+ d13C + C + d15N + N + relief + percent.trees + precip + percent.impervious + percent.developed, data= enviro, dist = "bray", add = TRUE) 
## 
## Some constraints or conditions were aliased because they were redundant. This
## can happen if terms are linearly dependent (collinear): 'percent.trees',
## 'precip', 'percent.impervious', 'percent.developed'
plot(dbrda) 

summary(dbrda)
## 
## Call:
## dbrda(formula = community ~ mangrove.shoreline + non.mangrove.shoreline +      percent.mangrove.shoreline + pond.area + d13C + C + d15N +      N + relief + percent.trees + precip + percent.impervious +      percent.developed, data = enviro, distance = "bray", add = TRUE) 
## 
## Partitioning of Lingoes adjusted squared Bray distance:
##               Inertia Proportion
## Total          11.349     1.0000
## Constrained     4.772     0.4205
## Unconstrained   6.577     0.5795
## 
## Eigenvalues, and their contribution to the Lingoes adjusted squared Bray distance 
## 
## Importance of components:
##                       dbRDA1 dbRDA2  dbRDA3  dbRDA4  dbRDA5  dbRDA6  dbRDA7
## Eigenvalue            1.5111 1.2914 0.68982 0.35917 0.29814 0.23740 0.16768
## Proportion Explained  0.1332 0.1138 0.06078 0.03165 0.02627 0.02092 0.01477
## Cumulative Proportion 0.1332 0.2469 0.30773 0.33937 0.36564 0.38656 0.40134
##                        dbRDA8  dbRDA9   MDS1    MDS2    MDS3    MDS4    MDS5
## Eigenvalue            0.13871 0.07887 1.7542 1.01386 0.75745 0.63976 0.44302
## Proportion Explained  0.01222 0.00695 0.1546 0.08934 0.06674 0.05637 0.03904
## Cumulative Proportion 0.41356 0.42051 0.5751 0.66442 0.73116 0.78753 0.82657
##                          MDS6    MDS7    MDS8    MDS9  MDS10   MDS11    MDS12
## Eigenvalue            0.31284 0.30991 0.23777 0.20666 0.1385 0.13074 0.106575
## Proportion Explained  0.02757 0.02731 0.02095 0.01821 0.0122 0.01152 0.009391
## Cumulative Proportion 0.85413 0.88144 0.90239 0.92060 0.9328 0.94432 0.953710
##                          MDS13    MDS14    MDS15    MDS16    MDS17    MDS18
## Eigenvalue            0.098673 0.097053 0.094495 0.092006 0.081334 0.061782
## Proportion Explained  0.008694 0.008552 0.008326 0.008107 0.007167 0.005444
## Cumulative Proportion 0.962405 0.970956 0.979283 0.987390 0.994556 1.000000
## 
## Accumulated constrained eigenvalues
## Importance of components:
##                       dbRDA1 dbRDA2 dbRDA3  dbRDA4  dbRDA5  dbRDA6  dbRDA7
## Eigenvalue            1.5111 1.2914 0.6898 0.35917 0.29814 0.23740 0.16768
## Proportion Explained  0.3166 0.2706 0.1445 0.07526 0.06247 0.04974 0.03514
## Cumulative Proportion 0.3166 0.5872 0.7318 0.80705 0.86953 0.91927 0.95441
##                        dbRDA8  dbRDA9
## Eigenvalue            0.13871 0.07887
## Proportion Explained  0.02907 0.01653
## Cumulative Proportion 0.98347 1.00000
### Environmental variation explains 42% of the variation. The first axis explains 13% of the variation and the second axis explains 11% of the variation. The first axis shows that species compostion differs based on if shoreline is not mangrove, the carbon content, and pond area. the second axis shows that percent mangrove shoreline, d15N, d13C, and relief are drivers of species compostion differences.  
4. The authors were interested in whether zooplankton composition is affected by the presence of mangroves, and whether composition is affected by the presence of a fishpond. Use a PERMANOVA to test these questions. Considering all the results together, what have you learned about this system?
transectsum = zoo %>%
  group_by(Site, Mangrove, Fishpond) %>%
  summarise(across(8:35, mean)) %>%
  ungroup() 
## `summarise()` has grouped output by 'Site', 'Mangrove'. You can override using
## the `.groups` argument.
community_counts = transectsum[, 4:ncol(transectsum)]
community_transformed = wisconsin(sqrt(community_counts))

permanova = adonis2(community_transformed ~ Mangrove * Fishpond,data = transectsum,  by = 'margin')
permanova
## Permutation test for adonis under reduced model
## Marginal effects of terms
## Permutation: free
## Number of permutations: 999
## 
## adonis2(formula = community_transformed ~ Mangrove * Fishpond, data = transectsum, by = "margin")
##                   Df SumOfSqs      R2      F Pr(>F)
## Mangrove:Fishpond  1  0.13631 0.05124 1.1021  0.359
## Residual          16  1.97886 0.74382              
## Total             19  2.66041 1.00000
no.interaction = adonis2(community_transformed ~ Mangrove +Fishpond, data = transectsum,  by = 'margin')
no.interaction
## Permutation test for adonis under reduced model
## Marginal effects of terms
## Permutation: free
## Number of permutations: 999
## 
## adonis2(formula = community_transformed ~ Mangrove + Fishpond, data = transectsum, by = "margin")
##          Df SumOfSqs      R2      F Pr(>F)   
## Mangrove  1  0.14321 0.05383 1.1510  0.326   
## Fishpond  1  0.40202 0.15111 3.2311  0.002 **
## Residual 17  2.11517 0.79506                 
## Total    19  2.66041 1.00000                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#The compostion was effected by the prescence of a fishpond, and by the mangrove:fishpond interaction. Based on these results I would say the zooplankton community does differ based on environmental conditions, including mangrove or fishpond presence.