Dear Thiery,

Thanks for the fast reply.

With "rethinking my model" you mean that I shoud re-think the necessity of
including the random factors or the nature of the entire model, that is of
my question (suggested by a reviewer)?

Many thanks,

Julia




2014-07-15 10:57 GMT+02:00 ONKELINX, Thierry <Thierry.ONKELINX@inbo.be>:

> Dear Julia,
>
> It looks like a problem of (quasi-)complete separation. The random effect
> structure is rather complicated given your data. You have only a few
> bird:year combinations with multiple observations. Furthermore year has
> only 3 levels, which very low to fit as a random effect.
>
> So you'll need to rethink your model.
>
> Best regards,
>
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
> Forest
> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
> Kliniekstraat 25
> 1070 Anderlecht
> Belgium
> + 32 2 525 02 51
> + 32 54 43 61 85
> Thierry.Onkelinx@inbo.be
> www.inbo.be
>
> To call in the statistician after the experiment is done may be no more
> than asking him to perform a post-mortem examination: he may be able to say
> what the experiment died of.
> ~ Sir Ronald Aylmer Fisher
>
> The plural of anecdote is not data.
> ~ Roger Brinner
>
> The combination of some data and an aching desire for an answer does not
> ensure that a reasonable answer can be extracted from a given body of data.
> ~ John Tukey
>
>
> -----Oorspronkelijk bericht-----
> Van: r-sig-mixed-models-bounces@r-project.org [mailto:
> r-sig-mixed-models-bounces@r-project.org] Namens Julia Sommerfeld
> Verzonden: dinsdag 15 juli 2014 10:35
> Aan: r-sig-mixed-models@r-project.org
> Onderwerp: [R-sig-ME] How to deal with Hessian error if the model only
> contains binomial (0, 1) fixed factors?
>
> Hi list,
>
> I have the following model:
>
> *mod <-  glmer(samemate ~ success + type + (1|year/bird), family=binomial,
> data=dat)*
>
> All variables are binomial:
>
> "samemate" = 0 or 1
> "success" = 0 or 1
> "type" = first or replacement
>
> The data look like this:
>
> bird     year   samemate  success    type
> A         2        0                 0               first
> A         2        1                 1               replacement
> B         1        1                 0               first
> C         1        0                 1               first
>
> and so on....
>
> When I run the model I get following error message:
>
> 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
>   unable to evaluate scaled gradient
> 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
>    Hessian is numerically singular: parameters are not uniquely determined
> Warning messages:
> 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
>   unable to evaluate scaled gradient
> 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
>    Hessian is numerically singular: parameters are not uniquely determined
>
> One solution to this seems to standardize the model:
>
> *> st.mod <- standardize(mod, standardize.y=FALSE)*
>
>
> But this gives the following error message:
>
> Warning message:
> In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
>   Model is nearly unidentifiable: large eigenvalue ratio
>  - Rescale variables?
> Warning message:
> In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
>   Model is nearly unidentifiable: large eigenvalue ratio
>  - Rescale variables?
>
> The model output of the standardized model is:
>
> *summary(st.mod)*
> Generalized linear mixed model fit by maximum likelihood (Laplace
> Approximation) ['glmerMod']
>  Family: binomial  ( logit )
> Formula: samemate ~ c.success + c.type + (1 | year/bird)
>    Data: dat
>
>      AIC      BIC   logLik deviance df.resid
>     56.0     66.9    -23.0     46.0       61
>
> Scaled residuals:
>     Min      1Q  Median      3Q     Max
> -2.7386  0.0000  0.0000  0.3651  0.8165
>
> Random effects:
>  Groups     Name        Variance  Std.Dev.
>  bird:year (Intercept)  2.672e-08 0.0001635
>  year      (Intercept) 0.000e+00 0.0000000
> Number of obs: 66, groups:  bird:year, 59; year, 3
>
> Fixed effects:
>                    Estimate Std. Error    z value   Pr(>|z|)
> (Intercept)  12.6988   165.3971   0.077      0.9388
> c.success    1.6094     0.8572      1.878      0.0605 .
> c.type         32.6667   454.8498   0.072       0.9427
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> Correlation of Fixed Effects:
>            (Intr)  c.fld1
> c.success    -0.006
> c.type          1.000 -0.006
> Generalized linear mixed model fit by maximum likelihood (Laplace
> Approximation) ['glmerMod']
>  Family: binomial  ( logit )
> Formula: samemate ~ c.success + c.type + (1 | year/bird)
>    Data: dat
>
>      AIC      BIC   logLik deviance df.resid
>     56.0     66.9    -23.0     46.0       61
>
> Scaled residuals:
>     Min      1Q  Median      3Q     Max
> -2.7386  0.0000  0.0000  0.3651  0.8165
>
> Random effects:
>  Groups     Name        Variance     Std.Dev.
>  bird:year (Intercept)   2.672e-08   0.0001635
>  year      (Intercept)     0.000e+00  0.0000000
> Number of obs: 66, groups:  bird:year, 59; year, 3
>
> Fixed effects:
>                     Estimate    Std. Error   z value  Pr(>|z|)
> (Intercept)    12.6988    165.3971   0.077     0.9388
> c.success    1.6094      0.8572       1.878     0.0605 .
> c.type          32.6667    454.8498   0.072     0.9427
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> Correlation of Fixed Effects:
>            (Intr) c.fld1
> c.success -0.006
> c.type   1.000 -0.006
> >
>
>
> *Do I need to worry about the error message? Does it even make sense to
> standardize a model that only contains binomial variables? How could I
> possibly rescale 0,1 variables? *
>
> When I run a glm, I don't get the error message:
>
> *mod <-  glm(samemate ~ success + type, family=binomial, data=dat)*
>
>
> > summary(mod)
>
> Call:
> glm(formula = samemate ~ fledged1 + clutch2, family = binomial,
>     data = dat)
>
> Deviance Residuals:
>      Min        1Q    Median        3Q       Max
> -2.06885   0.00008   0.00008   0.50033   1.01077
>
> Coefficients:
>
> Call:
> glm(formula = samemate ~ fledged1 + clutch2, family = binomial,
>     data = dat)
>
> Deviance Residuals:
>      Min        1Q    Median        3Q       Max
> -2.06885   0.00008   0.00008   0.50033   1.01077
>
> Coefficients:
>                           Estimate Std. Error z value Pr(>|z|)
> (Intercept)           0.4055     0.4082   0.993   0.3206
> success              1.6094     0.8563   1.879   0.0602 .
> typereplacement   19.1606  2195.1537   0.009   0.9930
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> (Dispersion parameter for binomial family taken to be 1)
>
>     Null deviance: 62.586  on 65  degrees of freedom Residual deviance:
> 45.966  on 63  degrees of freedom
> AIC: 51.966
>
> Number of Fisher Scoring iterations: 18
>
> *Could the glmer fail, because I only have 66 observation for 59 birds and
> only 3 years? Considering this and the very small variance explained by
> bird and year, shall I stick to the glm?*
>
> Any suggestion or thoughts on this would be highly appreciated.
>
> Cheers
>
> Julia
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> * * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
> Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver
> weer en binden het INBO onder geen enkel beding, zolang dit bericht niet
> bevestigd is door een geldig ondertekend document.
> The views expressed in this message and any annex are purely those of the
> writer and may not be regarded as stating an official position of INBO, as
> long as the message is not confirmed by a duly signed document.
>

	[[alternative HTML version deleted]]

