# GLM on non-integer data

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,
-21L))


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

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



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:

• Did you Try a Box-Cox transform? Anova with bootstrap? Can you share a link to the data? – kjetil b halvorsen Feb 21 at 12:13
• @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 :/ – Karolina Zarzyczny Feb 21 at 13:55
• 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? – kjetil b halvorsen Feb 21 at 14:59
• I do... I have 2 repeats (from different sites) where the pressure = 0. I will update the question now with the code – Karolina Zarzyczny Feb 21 at 15:12
• 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$. – kjetil b halvorsen Feb 21 at 15:13