I've been grappling with my dataset for what seems like a very long time now. Hope someone can point me in the right direction.

I would like to know how to account for the differing sampling effort in my GLMM Poisson regression using glmer().

We collected count data from our plots sometimes for 3 nights, sometimes for 2 nights.

I'm not sure whether I should:

  1. Create mean abundance per plot, round the means (integers for Poisson), then run my models - this removes overdispersion found in my full dataset;
  2. Add an offset of sampling effort (binary 2 or 3) to the full dataset - offset(log(Sampling_effort)) - overdispersed
  3. Use zero inflated neg binomial/poisson, gaussian or gamma (log) distribution
  4. Switch package to glmmADMB or glmmPQL;
  5. All or some of the above

Any help would be greatly appreciated. I have a full dataset with species richness, diversity, and specific abundances as well to examine but that just involves replicating the models, more or less. Cheers!

Example below. Just run the code.

# obtain data

dl_from_dropbox <- function(x, key) {
  bin <- getBinaryURL(paste0("https://dl.dropboxusercontent.com/s/", key, "/", x),
                      ssl.verifypeer = FALSE)
  con <- file(x, open = "wb")
  writeBin(bin, con)
  message(noquote(paste(x, "read into", getwd())))                        

dl_from_dropbox("Reproducible_example.csv", "4z97tlkfedmutqr")

# read data


# run models


glmer_offset_no_date<- glmer(Total_abundance ~ Habitat + (1|Loc/Plot) + offset(log(Sampling_effort)), data = data, family = poisson(link = "log"))

glmer_no_offset_no_date<- glmer(Total_abundance ~ Habitat + (1|Loc/Plot) , data = data, family = poisson(link = "log"))

glmer_offset_date<- glmer(Total_abundance ~ Habitat + (1|Loc/Plot) + (1|Date) + offset(log(Sampling_effort)), data = data, family = poisson(link = "log"))

glmer_no_offset_date<- glmer(Total_abundance ~ Habitat + (1|Loc/Plot) + (1|Date), data = data, family = poisson(link = "log"))


# or take mean abundance per plot and run the model with/without an offset #

# tidy data
Mean_abundance_per_plot<-ddply(data, c("Plot", "Loc", "Habitat", "latitude", "longitude"), colwise(mean))
Mean_abundance_per_plot_rounded<-Mean_abundance_per_plot %>% mutate_each(funs(round(.,0)), -c(Loc, Plot, Habitat,latitude, longitude)) 

# run models 

glmer_avg_offset<- glmer(Total_abundance ~ Habitat + (1|Loc/Plot) + offset(log(Sampling_effort)), data = Mean_abundance_per_plot_rounded, family = poisson(link = "log"))

glmer_avg_no_offset<- glmer(Total_abundance ~ Habitat + (1|Loc/Plot), data = Mean_abundance_per_plot_rounded, family = poisson(link = "log")) # fails to converge

# view results

AICvalues<-AIC(glmer_avg_offset,glmer_avg_no_offset,glmer_no_offset_date,glmer_offset_date,glmer_no_offset_no_date,glmer_offset_no_date) AICvalues


sjt.glmer(glmer_avg_offset,glmer_avg_no_offset,glmer_no_offset_date,glmer_offset_date,glmer_no_offset_no_date,glmer_offset_no_date, depvar.labels = c("glmer_avg_offset","glmer_avg_no_offset","glmer_no_offset_date","glmer_offset_date","glmer_no_offset_no_date","glmer_offset_no_date"))
  • $\begingroup$ I've seen this done where fixed effects are used to account for the effort variable. Will provide link to paper in a few min. $\endgroup$ – RTbecard Jun 16 '17 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.