I am fitting a linear model for de
CO2 dataset in r, I want to predict plant uptake (always positive) using Type, conc, and treatment, a quick look at the data gives me this relationship:
which is a saturation curve, it is clear that there is an effect by plant type, and that there is an interaction with treatment, also this are repeated measures from plants at different concentrations, so I thought random effects from plants make sense.
So I set up my linear models with and without random effects:
data(CO2) library(lme4) mod1 <- lm(uptake ~ Type*Treatment + I(log(conc)) + conc, data = CO2) mod2 <- lmer(uptake ~ Type*Treatment + I(log(conc)) + conc + (1|Plant), data = CO2)
Now when I see the residuals of mod1
I am not at all happy with the structure of the residuals, they seem to have heteroscedastic. which made me think I should go to
glmm, I am very familiar with the poisson glm and binomial glm, but in this case, since it is a continuous positive I though gamma family should be better. But when I read about it and see that the identity is inverse, I thought that it didn't make any sense to me to model the inverse of CO2 uptake.
I fitted these models anyway
mod3 <- glm(uptake ~ Type*Treatment + I(log(conc)) + conc, data = CO2, family = Gamma) mod4 <- glmer(uptake ~ Type*Treatment + I(log(conc)) + conc + (1|Plant), data = CO2, family = Gamma)
mod4 failed altogether, and even when mod3 improved the residuals
I am not sure that I am using the family for the right reason.
any orientation would be welcome