I am trying to perform a glmer in R using the Gamma error family. I get the error message: "Error: (maxstephalfit) PIRLS step-halvings failed to reduce deviance in pwrssUpdate"
my response variable is flower mass. My fixed effects are base mass, F1 treatment, and fertilisation method. My random effects are line and maternal ID nested within line.
When I perform the same analysis using an integer as the response (ie. flower number) This error does not occur.
Here is a sample of my data:
LINE MATERNAL_ID F1TREAT SO FLWR_MASS BASE_MASS
17 81 stress s 2.7514 9.488
5 41 control o 0.3042 1.809
37 89 control o 2.3749 6.694
5 41 stress s 3.6140 9.729
9 5 control s 0.5020 7.929
13 7 stress s 0.4914 0.969
35 88 stress s 0.4418 1.840
1 57 control o 2.1531 6.673
13 7 stress s 3.0191 7.131
Here is the code I am using:
library(lme4)
m <- glmer(data=mydata,
FLWR_MASS~BASE_MASS*F1TREAT*SO+(1 |LINE/MATERNAL_ID),family=Gamma)
(I am using r 3.0.3 for windows)
@HongOoi answered this question in the comments, but I will repeat it here for anyone else having this issue. He suggested changing
family=Gamma
to
family=Gamma(link=log)