3

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)

thelatemail
  • 91,185
  • 12
  • 128
  • 188
Shannon Hodges
  • 163
  • 1
  • 6
  • Note that the default link for the Gamma family is the inverse link, which I'm betting is _not_ what you want if your response is a mass. Change it to `family=Gamma(link=log)` and see if that works. – Hong Ooi Aug 18 '14 at 05:07
  • Thank you, this resolves the issue I am having – Shannon Hodges Aug 18 '14 at 07:17
  • @HongOoi, post as answer? *In principle* the inverse link also ought to work, but it is far more fragile. – Ben Bolker Aug 25 '14 at 03:48

1 Answers1

1

@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)
Shannon Hodges
  • 163
  • 1
  • 6
  • if you are willing to post this issue and a link to your data at https://github.com/lme4/lme4/issues , we can have a look at some point and see how it can be made to work with the inverse link ... – Ben Bolker Aug 27 '14 at 03:09