0

I'm trying to fit a mixed-effects model with a gamma distribution. The most basic model has one fixed predictor and 1 random effect. No matter which link I specify (I've tried log, identity and inverse), I obtain the following error. My real data has zeros in Y, but even when I apply simulated data with only positive Y as below, it throws the same error.

mockdf = data.frame(y =  rnorm(100,77,6.5), x1 = sample(letters,100,replace = T), x2 = seq(1900,1999,1))
mod = lmer(y ~ (1|x1) + x2, family = gamma(link = 'identity'), na.action = na.exclude, data = mockdf)

Error in gamma(link = "identity") : 
  supplied argument name 'link' does not match 'x'

I searched through SO and couldn't find another person who ran into this error. Is my syntax incorrect?

Thanks for your help.

Roman Luštrik
  • 69,533
  • 24
  • 154
  • 197
makai
  • 31
  • 1
  • 8

0 Answers0