First we can create a simple boxplot visual showing difference in Month, Species, and Standard Length with a cutoff line for Size Class:
After log transforming our Standard Length values to normalize them, we can create various linear models based on Species and Month w/ interactions, either predicting standard length or size class and also including a random effect of the “Master Jar” indicating which collection lot each fish came from. Additionally, we can compute AIC values for each model to help determine selection.
This leads us to our main linear model predicting log(Standard Length) with Species and Month, including interactions and random effect of master jars.
## Family: gaussian ( identity )
## Formula: log(SL) ~ Species + Month + Species:Month + (1 | MJar)
## Data: fish_data_wide
##
## AIC BIC logLik -2*log(L) df.resid
## 5.8 24.6 3.1 -6.2 164
##
## Random effects:
##
## Conditional model:
## Groups Name Variance Std.Dev.
## MJar (Intercept) 0.01047 0.1023
## Residual 0.05232 0.2287
## Number of obs: 170, groups: MJar, 10
##
## Dispersion estimate for gaussian family (sigma^2): 0.0523
##
## Conditional model:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 3.79998 0.08021 47.37 < 2e-16 ***
## SpeciesAcropoma japonicum 0.43370 0.13370 3.24 0.001179 **
## MonthMay 0.33399 0.09970 3.35 0.000808 ***
## SpeciesAcropoma japonicum:MonthMay -0.06038 0.17259 -0.35 0.726466
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
We can see that fish in May are predicted to be significantly larger (p = 0.000808) than fish in February. Additionally, A. Japonicum are also significantly larger than A. Hanedai (p = 0.001179).
We now can look at whether or not size, species, month and their interactions had an effect on if a fish had any stomach contents at all, fit as a logistic regression model for a binomial response.
#(1) For a generalized linear model predicting Content with Standard Length, Species and Month including interactions:
ContVarglmModel <- glmmTMB(Content ~ SL + Species + Month + SL:Species + SL:Month + Species:Month + SL:Species:Month + (1|MJar), data = fish_data_wide, family = binomial(link = 'logit'))
#summary(ContVarglmModel)
AIC(ContVarglmModel)
## [1] 241.0212
#(2) For a generalized linear model predicting Content based on only intercept
ContglmModel <- glm(Content ~ 1, data = fish_data_wide, family = binomial(link = 'logit'))
AIC(ContglmModel)
## [1] 234.2705
After running several models to predict the presence of any stomach content in a fish based on size, species, and month, we find that there is no significant effect of any variable.
General linear hypothesis tests of log(SL) of each combination of species and month as predicted from our model:
##
## Simultaneous Tests for General Linear Hypotheses
##
## Fit: glmmTMB(formula = log(SL) ~ Species + Month + Species:Month +
## (1 | MJar), data = fish_data_wide, family = gaussian(link = "identity"),
## ziformula = ~0, dispformula = ~1)
##
## Linear Hypotheses:
## Estimate Std. Error z value Pr(>|z|)
## hanfeb == 0 3.79998 0.08021 47.37 <2e-16 ***
## hanmay == 0 4.13397 0.05940 69.59 <2e-16 ***
## japfeb == 0 4.23369 0.10697 39.58 <2e-16 ***
## japmay == 0 4.50730 0.09162 49.19 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- none method)
Here are the exponentiated 95% CIs for Standard Length of each combination of species and month as predicted from our model.
## Estimate lwr upr
## hanfeb 44.70046 38.19749 52.31052
## hanmay 62.42555 55.56468 70.13357
## japfeb 68.97101 55.92616 85.05857
## japmay 90.67669 75.77149 108.51393
We can first convert out data into Bray-Curtis dissimilarity matrices either by total biovolume or occurance (coded as 0 or 1), then perform a PERMANOVA to see which covariates have a significant effect on the matrix.
First, predicting stomach composition by biovolume:
## Permutation test for adonis under reduced model
## Terms added sequentially (first to last)
## Permutation: free
## Number of permutations: 999
##
## adonis2(formula = BCmat ~ Species + Month + SClass + Species:Month + SClass:Species + SClass:Month + SClass:Species:Month, data = fishBCdat, by = "terms")
## Df SumOfSqs R2 F Pr(>F)
## Species 1 1.3817 0.05753 5.5605 0.003 **
## Month 1 0.2637 0.01098 1.0612 0.342
## SClass 1 2.3486 0.09779 9.4521 0.001 ***
## Species:Month 1 3.1162 0.12975 12.5414 0.001 ***
## Species:SClass 1 0.4372 0.01820 1.7595 0.149
## Month:SClass 1 0.1778 0.00740 0.7156 0.558
## Species:Month:SClass 1 0.1420 0.00591 0.5713 0.696
## Residual 65 16.1510 0.67245
## Total 72 24.0182 1.00000
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Second, predicting stomach composition by frequency of occurrence (whether or not that type of content was present represented as either 0 or 1):
## Permutation test for adonis under reduced model
## Terms added sequentially (first to last)
## Permutation: free
## Number of permutations: 999
##
## adonis2(formula = BCmat2 ~ Species + Month + SClass + Species:Month + SClass:Species + SClass:Month + SClass:Species:Month, data = fishBCdat, by = "terms")
## Df SumOfSqs R2 F Pr(>F)
## Species 1 1.1705 0.05595 5.8462 0.010 **
## Month 1 0.2074 0.00991 1.0360 0.351
## SClass 1 2.8073 0.13418 14.0216 0.001 ***
## Species:Month 1 3.4138 0.16317 17.0510 0.001 ***
## Species:SClass 1 0.1294 0.00618 0.6462 0.522
## Month:SClass 1 0.0978 0.00467 0.4883 0.606
## Species:Month:SClass 1 0.0816 0.00390 0.4077 0.688
## Residual 65 13.0136 0.62203
## Total 72 20.9212 1.00000
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
From these calculated PermANOVAs, we can see that after predicting stomach composition by biovolume, ~18% of the variation is accounted for by species and interaction with month, even after accounting for the variation in size classes. For the PermANOVA predicting stomach composition by frequency of occurrence, this variation by species and interaction with month jumps up to ~22% after accounting for variation in size classes.
We can also visually display these differences for each combinations of species and month for both total biovolume and frequency of occurrence with stacked barcharts.
For the model predicting presence of crustaceans (using A. japonicum and May as basis):
## Family: binomial ( logit )
## Formula: crustaceancount ~ Species + Month + Species:Month + SClass
## Data: fish_data_wide
##
## AIC BIC logLik -2*log(L) df.resid
## 155.8 171.5 -72.9 145.8 165
##
##
## Conditional model:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.6699 0.3286 -2.038 0.041502 *
## SpeciesAcropoma japonicum -0.3559 0.5956 -0.598 0.550131
## MonthMay -1.5430 0.6895 -2.238 0.025229 *
## SClass -1.3813 0.6052 -2.282 0.022464 *
## SpeciesAcropoma japonicum:MonthMay 3.1348 0.9317 3.364 0.000767 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
We can see that this specific combination has a significant positive interaction (estimate = 3.1348) with odds of crustaceans (p = 0.000767).
## Family: binomial ( logit )
## Formula: crustaceancount ~ Species + Month + Species:Month + SClass
## Data: fish_data_widea
##
## AIC BIC logLik -2*log(L) df.resid
## 155.8 171.5 -72.9 145.8 165
##
##
## Conditional model:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.0258 0.5250 -1.954 0.050727 .
## SpeciesAcropoma hanedai 0.3559 0.5956 0.598 0.550128
## MonthMay 1.5918 0.6549 2.431 0.015074 *
## SClass -1.3813 0.6052 -2.282 0.022464 *
## SpeciesAcropoma hanedai:MonthMay -3.1347 0.9317 -3.364 0.000767 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
On the other hand for A.hanedai and May predicting crustaceans, the significance does not change (p = 0.000767), but the direction of the interaction does (estimate = -3.1347).
For the model predicting presence of fish (using A. japonicum and May as basis):
## Family: binomial ( logit )
## Formula: fishcount ~ Species + Month + Species:Month + SClass
## Data: fish_data_wide
##
## AIC BIC logLik -2*log(L) df.resid
## 147.6 163.3 -68.8 137.6 165
##
##
## Conditional model:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -4.243 1.047 -4.051 5.09e-05 ***
## SpeciesAcropoma japonicum 2.648 1.082 2.446 0.01444 *
## MonthMay 1.825 1.106 1.651 0.09884 .
## SClass 1.559 0.558 2.794 0.00521 **
## SpeciesAcropoma japonicum:MonthMay -3.411 1.260 -2.706 0.00681 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
We can see that this specific combination has a significant negative interaction (estimate = -3.411) with odds of fish (p = 0.00681). Still predicting the presence of fish (using A. hanedai and May as basis instead):
## Family: binomial ( logit )
## Formula: fishcount ~ Species + Month + Species:Month + SClass
## Data: fish_data_widea
##
## AIC BIC logLik -2*log(L) df.resid
## 147.6 163.3 -68.8 137.6 165
##
##
## Conditional model:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.5951 0.5488 -2.907 0.00365 **
## SpeciesAcropoma hanedai -2.6476 1.0824 -2.446 0.01444 *
## MonthMay -1.5853 0.6244 -2.539 0.01111 *
## SClass 1.5590 0.5580 2.794 0.00521 **
## SpeciesAcropoma hanedai:MonthMay 3.4107 1.2604 2.706 0.00681 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
For A.hanedai and May predicting fish, the significance does not change (p = 0.00681), but the direction of the interaction does (estimate = 3.4107). We can see similar results if we switched months instead of species as well.
These models indicate that the interaction between species and month has a significant impact on the probability of whether or not a fish will have crustaceans or fish, and in specific with opposite effects.
Table of confidence intervals for both frequency (prop test) and biovolume (t-test)
For Frequency:
| Proportion of Prescence Confidence Intervals | ||||||
| Analysis for Crustaceans and Fish | ||||||
| Species and Month |
Crustacean Count
|
Fish Count
|
||||
|---|---|---|---|---|---|---|
| Estimate | CI Lower | CI Upper | Estimate | CI Lower | CI Upper | |
| Acropoma hanedai_Feb | 0.30435 | 0.18198 | 0.45923 | 0.02174 | 0.00114 | 0.12970 |
| Acropoma hanedai_May | 0.06667 | 0.01738 | 0.19311 | 0.17778 | 0.08513 | 0.32583 |
| Acropoma japonicum_Feb | 0.12963 | 0.05802 | 0.25517 | 0.40741 | 0.27858 | 0.54937 |
| Acropoma japonicum_May | 0.32000 | 0.15729 | 0.53550 | 0.16000 | 0.05254 | 0.36917 |
For Biovolume:
| Biovolume Confidence Intervals | ||||||
| Analysis for Crustaceans and Fish | ||||||
| Species and Month |
Crustacean Volume
|
Fish Volume
|
||||
|---|---|---|---|---|---|---|
| Estimate | CI Lower | CI Upper | Estimate | CI Lower | CI Upper | |
| Acropoma hanedai_Feb | 4.53261 | 1.10666 | 7.95856 | 12.26087 | −12.43379 | 36.95553 |
| Acropoma hanedai_May | 0.51111 | −0.13776 | 1.15998 | 77.90000 | 2.49763 | 153.30237 |
| Acropoma japonicum_Feb | 3.38896 | −0.14741 | 6.92534 | 62.38889 | 33.77480 | 91.00298 |
| Acropoma japonicum_May | 6.88000 | 0.72589 | 13.03411 | 3.60000 | −0.81372 | 8.01372 |
IRI Tables
## # A tibble: 17 × 5
## Measure `Hanedai May` `Hanedai Feb` `Japonicum Feb` `Japonicum May`
## <chr> <chr> <chr> <chr> <chr>
## 1 Total Individuals 45 46 54 25
## 2 Mean SL 66.37 45.13 69.95 88.85
## 3 W/Content 14 16 29 14
## 4 Animal Content 3 1 4 3
## 5 Crustacean Conte… 3 14 7 8
## 6 Teleost Content 8 1 22 4
## 7 Mollusk Content 0 0 0 1
## 8 Total Items 18 17 33 16
## 9 Animal Items 3 1 4 3
## 10 Crustacean Items 3 15 7 8
## 11 Teleost Items 12 1 22 4
## 12 Mollusk Items 0 0 0 1
## 13 Total Volume 3546.5 778.5 3575.0 286.0
## 14 Animal Volume 18.0 6.0 23.0 12.0
## 15 Crustacean Volume 23.0 208.5 183.0 172.0
## 16 Teleost Volume 3505.5 564.0 3369.0 90.0
## 17 Mollusk Volume 0.0 0.0 0.0 12.0
Niche Breadth and Overlap