I have a set of fish data from a lake. I am trying to see whether the local fish community differs depending on the location within the lake (North, East, West), the presence of an island at the sampling location (Yes/No), or via an interaction effect between the two. Sampling within the lake was uneven.
I'm running a multivariate ANOVA with the mvabund
package in R. Initially I was converting the catch data to catch per unit effort (number of individuals of each species/number of sampling events). This seemed to be working fine and I was getting results that made sense, but the model would generate a warning saying "non-integer data are fitted to the negative.binomial model". I read that this was an issue that stemmed from converting the count data to catch per unit effort, and the more appropriate approach is to just use the straight count data and apply an offset to the model equal to the number of samples collected at each location. When I do this though my model takes forever to run and I get many versions of the message: l=nan, theta=1000000.0000, yi=0.0000, mu=nan
. This happens even when I decrease the number of iterations from 9,999 to 2. Any idea what's going on here/how to fix it?
library(mvabund) #for multivariate GLMs
# Load .csv file with species as columns and sampling location/year
# as rows. Values are number of individuals captured.
Community <- read.csv(file = "Island Group By Year.csv",
header = TRUE)
# Take the subset of the data so it's just species abundances
# (other columns identify the location, presence of an island,
# year and number of samples taken)
Community_spp <- mvabund(Community[,7:42])
# Establish your factors
Year <- as.numeric(Community$Year)
Location <- Community$Location
Island <- Community$Has.Island
Offset <- Community$Number.of.samples
# Build the model:
mod1 <- manyglm(Community_spp ~ Island*Location, block = Year,
family="negative_binomial", offset = Offset)
# Run the ANOVA
anova(mod1, p.uni="unadjusted", nBoot = 999)
This works and produces a result that makes sense if I use catch per unit effort data instead of using the offset approach.
mvabund
have many functions, and you did'nt tell us what you tried! $\endgroup$