I'm looking for a recommendation on what GLM I could do with non-integer data.

Brief background of what I am doing:

I'm wanting to combine calculated herbivory rates with abundance data, to compare total herbivory pressure across different sites. For my herbivory rates, I did a GLM where I used the bite counts, with sites as a factor and the length of observation (i.e. how long each individual was observed for when the bites were counted) as an offset. This was to compare bite rates between different species.

  • This worked perfectly fine as I used a quasipoisson model and count data.

Next, I want to quantify the herbivory pressure on each site, but there are a couple of caveats. Firstly, different species have a different mass. So, instead of looking at just abundance of each species, I calculated their total biomass per repeat of each site (3 repeats, 7 sites). Next, I multiplied the total biomass of each species by its mean herbivory rate to get a value for herbivory pressure. Finally, I summed all of the herbivory pressure values for each repeat so that I get a total herbivory (exerted by all species combined).

Now, I have the total herbivory values, 3 repeats for 7 sites (total 21 values). The initial plan was to do an ANOVA, however my data violates the assumptions of homogeneity of residuals and normal distribution. I have tried transforming the data, SQRT makes it a little bit better (not much) and log+1 (I have 2 x 0 values) skews the data to the right.

With this data consisting of non-integers, my understanding is I can't do a Poisson/quasi-Poisson GLM... I have been looking at different families of GLMs and I considered Gamma but I'm reading conflicting things.

What statistical analysis (GLM?) would you recommend for this? I could do a Kruskall Wallis but I was hoping there may be something more appropriate.

Many thanks!

EDIT: Here is an example data set (slightly different values to my data)

Example<- structure(list(Example_Site = c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 
3L, 4L, 4L, 4L, 5L, 5L, 5L, 6L, 6L, 6L, 7L, 7L, 7L), TotalPressure = c(90000L, 
80000L, 35000L, 0L, 5000L, 42500L, 0L, 600L, 1900L, 10600L, 18966L, 
200000L, 77000L, 12342L, 50000L, 3000L, 2000L, 2000L, 70L, 100L, 
0L), Transect = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 
10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 21L, 20L), .Label = c("H1", 
"H2", "H3", "HP1", "HP2", "HP3", "K1", "K2", "K3", "KB1", "KB2", 
"KB3", "MC1", "MC2", "MC3", "N1.1", "N1.2", "N1.3", "N2.1", "N2.2", 
"N2.3"), class = "factor"), Region = structure(c(1L, 1L, 1L, 
1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 
2L, 2L), .Label = c("A", "B"), class = "factor")), class = "data.frame", row.names = c(NA, 

this is the code that I used to generate the basic lm

model<-lm(TotalPressure~Site, data = example)

when I try to apply the boxcox transformation to the lm this is what I get

> boxcox_lm<-boxcox(model)
Error in boxcox.default(model) : response variable must be positive
> boxcox_lm1<-boxcox(1+(model))
Error in 1 + (model) : non-numeric argument to binary operator

This is the autoplot of SQRT data: enter image description here

  • 1
    $\begingroup$ Did you Try a Box-Cox transform? Anova with bootstrap? Can you share a link to the data? $\endgroup$ – kjetil b halvorsen Feb 21 at 12:13
  • $\begingroup$ @kjetilbhalvorsen thanks for your reply! I've just tried the Box-Cox transform in R but I'm getting an error when I apply it to the lm: "Error in boxcox.default(model_fp) : response variable must be positive" - All of my data points are positive, so I don't know if that is referring to the residuals? Unfortunately, as some of the data in this analysis isn't mine, I'm not able to share it :/ $\endgroup$ – Karolina Zarzyczny Feb 21 at 13:55
  • $\begingroup$ Do you have zero's in the data? The error from Box-Cox in R is about the data, not residuals. See stats.stackexchange.com/questions/1444/…. Can you show the exact code you used in R? $\endgroup$ – kjetil b halvorsen Feb 21 at 14:59
  • $\begingroup$ I do... I have 2 repeats (from different sites) where the pressure = 0. I will update the question now with the code $\endgroup$ – Karolina Zarzyczny Feb 21 at 15:12
  • 1
    $\begingroup$ So, maybe you can try Box-Cox on $Y+c$ for some positive $c$? Show us the results, and see if the estimated transform parameter depends much on $c$. $\endgroup$ – kjetil b halvorsen Feb 21 at 15:13

Because you likely have correlation among the observations (i.e., values within sites are more similar than values between sites), you may want to consider a generalized linear mixed model. Instead of modeling site as a factor, model it as a random effect. This will save you degrees of freedom. An excellent reference is Zuur et al. (2009).

Zuur, A.F., E.N. Ieno, N.J. Walker, A.A. Saveliev, and G.M. Smith. 2009. Mixed effects models and extension in ecology with R. Springer.

| cite | improve this answer | |
  • $\begingroup$ With only 7 sites, I would hesitate recommending to fit a random effect for it and keep it as a fixed effect. See the GLMM FAQ by Ben Bolker and also this post. $\endgroup$ – COOLSerdash Feb 21 at 14:24
  • $\begingroup$ Great reference. Thanks for sharing! Makes sense. $\endgroup$ – Laura Lee Feb 21 at 14:42
  • $\begingroup$ Thanks both! @COOLSerdash … what kind of GLM would you recommend for this? I've only done GLMS with fixed effects with integer data before so I'm not sure what to do with non-integers... $\endgroup$ – Karolina Zarzyczny Feb 21 at 15:14

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.