[R-sig-ME] poisson GLMER with identity link
Tim Carnus
tim.carnus at gmail.com
Tue Apr 6 16:34:17 CEST 2010
Thanks for response and simulation example.
The problem was in all cases very simply solved by following the error
instructions to provide starting values... those from the canonical
poisson family did the trick nicely.
On Fri, 2010-04-02 at 11:39 -0400, Ben Bolker wrote:
> I don't think there is a way to do this without hacking.
> I don't know what glm.fit does, internally, to address this situation
> -- certainly one gets a lot of warnings, but it does come up with a
> reasonably sensible answer (once reasonable starting values have been
> specified).
> If I were going to hack this I would go into lmer.c , find the
> location where the warning occurred, and change the code to set the
> offending value to a feasible (non-negative) value instead (giving a
> warning). Slightly more conservatively you could set a threshold below
> which the value was adjusted with a warning and above which an error
> occurred.
>
> > x = runif(100)
> > y = rpois(100,4*x)
> > glm(y~x,family=poisson(link="identity"))
> Error: no valid set of coefficients has been found: please supply
> starting values
> In addition: Warning message:
> In log(ifelse(y == 0, 1, y/mu)) : NaNs produced
> > glm(y~x,family=poisson(link="identity"),start=c(0.1,4))
>
> Call: glm(formula = y ~ x, family = poisson(link = "identity"), start =
> c(0.1, 4))
>
> Coefficients:
> (Intercept) x
> -0.01669 4.28255
>
> Degrees of Freedom: 99 Total (i.e. Null); 98 Residual
> Null Deviance: 176.8
> Residual Deviance: 87.02 AIC: 295
> There were 15 warnings (use warnings() to see them)
> > warnings()
> Warning messages:
> 1: step size truncated: out of bounds
> 2: step size truncated: out of bounds
> 3: step size truncated: out of bounds
> 4: step size truncated: out of bounds
> 5: step size truncated: out of bounds
> 6: step size truncated: out of bounds
> 7: step size truncated: out of bounds
> 8: step size truncated: out of bounds
> 9: step size truncated: out of bounds
> 10: step size truncated: out of bounds
> 11: step size truncated: out of bounds
> 12: step size truncated: out of bounds
> 13: step size truncated: out of bounds
> 14: In glm.fit(x = X, y = Y, weights = weights, start = start, ... :
> algorithm stopped at boundary value
> 15: In glm.fit(x = X, y = Y, weights = weights, start = start, ... :
> fitted rates numerically 0 occurred
>
>
> Tim Carnus wrote:
> > Dear list,
> >
> > Just adding an example of the model I am fitting, and session info.
> >
> > model<-glmer(count~-1+X1+X2+X3+X4+(1|plot),poisson(link='identity'),
> > REML=TRUE)
> >
> > where I am interested in the additive effects of X1-X4 on the count per
> > plot response. The random effect is simply there to account for the
> > repeated measures taken over time on each plot.
> >
> > R version 2.10.1 (2009-12-14)
> > i486-pc-linux-gnu
> >
> >
> >
> > On Mon, 2010-03-29 at 17:45 +0100, Tim Carnus wrote:
> >> Dear list,
> >>
> >> I am trying to fit a number of GLMERs to count data with an additive
> >> model (in the predictors) that requires the use of the identity link
> >> function. For about half of my response variables this causes no
> >> problems. However in a number of cases the model fitting runs into
> >> problems with regards estimation of negative mean (for e.g. the error
> >> message in mer_finalize: mu[i] must be positive: mu = 1.76267e-312, i =
> >> 13075456). As far as I understand this is well known and documented, and
> >> guarding against that possibility is necessary, and built in to say the
> >> glm() function.
> >>
> >> My question then is, how can I do this with lmer? (ie how can I specify
> >> the constraints necessary to fit these types of models, if at all
> >> possible)
> >>
> >> Best regards,
> >>
> >> Tim Carnus
> >>
> >> _______________________________________________
> >> R-sig-mixed-models at r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> >
> > _______________________________________________
> > R-sig-mixed-models at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
More information about the R-sig-mixed-models
mailing list