Discussion:
[R-sig-ME] Errors in GLMER
Michiel Kiggen
2018-06-24 21:41:58 UTC
Permalink
Dear Reader,

I'm trying to run a GLMER model for the following data:
*2x scaled continous predictor* (sum score of 2 questionairres)
*1x predictor being 10 trials* on a ultimatum game of which each trial is 1
out of 10 possible options. (offer of a split of $20: e.g. you 1 and 19
me). Inserted this a non ordered factor (10-levels) with sum-to-zero coding
(contrast.sum).
*1x dependent binary variable *being the response to the 10 trials valued
at accepted (1) or reject (2). Entered as a factor.

After the following model without correlations terms (I ran this model
after failing to converge on a model without optimizers and the all_fit of
that) I get the following errors:

glmer(AoR ~ Trials * (sPredictor1*sPredictor2) + (1 | ID )+ (0 + Trials
|ID),family = binomial, data = data, control = glmerControl(optCtrl =
list(maxfun = 1e+9, optimizer = "bobyqa")))


*fixed-effect model matrix is rank deficient so dropping 10 columns /
coefficients*
*Warning messages:*
*1: In (function (npt = min(n + 2L, 2L * n), rhobeg = NA, rhoend = NA, :*
* unused control arguments ignored*
*2: In (function (iprint = 0L, maxfun = 10000L, FtolAbs = 0.00001, FtolRel
= 1e-15, :*
* unused control arguments ignored*
3: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
unable to evaluate scaled gradient
4: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge: degenerate Hessian with 11 negative eigenvalues

I'm afraid I might be doing something wrong in handeling the DV or
10-factor level IV, which in turn, is causing the 3 errors in bold. Does
anyone have suggestions. Or can some one tell me what the source of these
errors are?

Much obliged in advance,

Kindest regards,

Michiel Kiggen

[[alternative HTML version deleted]]
Thierry Onkelinx
2018-06-25 07:08:52 UTC
Permalink
Dear Michiel,

Does it run with the random slope for trial. If I understand the
design correctly, you have only one observation per trial and per ID.
In that case a random slope for trial as an (ordered) factor won't
work.

Consider using trial as a continuous variable and use some polynomials
to model it.

Best regards,

ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE
AND FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
***@inbo.be
Havenlaan 88 bus 73, 1000 Brussel
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
///////////////////////////////////////////////////////////////////////////////////////////
Post by Michiel Kiggen
Dear Reader,
*2x scaled continous predictor* (sum score of 2 questionairres)
*1x predictor being 10 trials* on a ultimatum game of which each trial is 1
out of 10 possible options. (offer of a split of $20: e.g. you 1 and 19
me). Inserted this a non ordered factor (10-levels) with sum-to-zero coding
(contrast.sum).
*1x dependent binary variable *being the response to the 10 trials valued
at accepted (1) or reject (2). Entered as a factor.
After the following model without correlations terms (I ran this model
after failing to converge on a model without optimizers and the all_fit of
glmer(AoR ~ Trials * (sPredictor1*sPredictor2) + (1 | ID )+ (0 + Trials
|ID),family = binomial, data = data, control = glmerControl(optCtrl =
list(maxfun = 1e+9, optimizer = "bobyqa")))
*fixed-effect model matrix is rank deficient so dropping 10 columns /
coefficients*
*Warning messages:*
*1: In (function (npt = min(n + 2L, 2L * n), rhobeg = NA, rhoend = NA, :*
* unused control arguments ignored*
*2: In (function (iprint = 0L, maxfun = 10000L, FtolAbs = 0.00001, FtolRel
= 1e-15, :*
* unused control arguments ignored*
unable to evaluate scaled gradient
Model failed to converge: degenerate Hessian with 11 negative eigenvalues
I'm afraid I might be doing something wrong in handeling the DV or
10-factor level IV, which in turn, is causing the 3 errors in bold. Does
anyone have suggestions. Or can some one tell me what the source of these
errors are?
Much obliged in advance,
Kindest regards,
Michiel Kiggen
[[alternative HTML version deleted]]
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Michiel Kiggen
2018-06-25 16:33:02 UTC
Permalink
Dear Thierry

Thanks so much for comments, I really appreciate it.

Based on your feedback, I'm running the following model now:

model_poly_nc <- glmer(AoR ~ Offers_lin*(sFW*sMF)+ Offers_quad *(sFW*sMF) +
(1 |ID)+ (0 + Offers_lin| ID)+(0 + Offers_quad| ID),family = binomial, data
= data, control = glmerControl(optCtrl = list(maxfun = 1e+9)))

*Offers_lin* & *Offers_quad* are the trial variables (polynomials for
linear and quadratic patterns). Both of them are centered. Metric is from 1
till 10. (1 being trial in which people get lowest offer and 10 being the
highest offer in an ultimatum game)
*sFW* & *sMF *are the continous questionairre sumscores, standardized &
centered.
*DV* (2 level factor accept or reject)
*n = 103*

I ran the model with covariance terms for the random effects. It didn't
converge, neither with optimizers bobyqa & Nelder_Mead.
However, the function *allFit,* strangely returned *[OK] for bobyqa,
Nelder_Mead, nloptwrap.NLOPT_LN_NELDERMEAD & nloptwrap.NLOPT_LN_BOBYQA*.
The model above is without covariance terms for the random effects. After
running this I get the same convergence issue and the same output on
allFit: [OK] for bobyqa, Nelder_Mead, nloptwrap.NLOPT_LN_NELDERMEAD
& nloptwrap.NLOPT_LN_BOBYQA.

Using the *getME *function to look at the different *Fixed Effects*
generated by *allFit* (no covariance term model, as described above), it
reveals that the numbers are similar for bobyqa, loptwrap.NLOPT_LN_NELDERMEAD
& nloptwrap.NLOPT_LN_BOBYQA. While for the Nelder_mead numbers are just
slightly different. Like a 0.02 difference.

For the seperate Models with optimizers Bobyqa & Nelder_Mead (both with
convergence issues), the fixed effects were exactly the same.

I'm not sure how to interpret these allFit function results. For what
patterns should I look incase I want to conclude these warnings are
false-positives?
Else, what options do I have? I've already stripped the model of it random
covariances (Removing the random slope will make the purpose of using Mixed
Models dispensable).

My apologies if I'm asking any obvious questions. First time i'm running
this kind of analysis.

Any help is much appreciated!

Kind regards,

Michiel





Op ma 25 jun. 2018 om 09:08 schreef Thierry Onkelinx <
Post by Thierry Onkelinx
Dear Michiel,
Does it run with the random slope for trial. If I understand the
design correctly, you have only one observation per trial and per ID.
In that case a random slope for trial as an (ordered) factor won't
work.
Consider using trial as a continuous variable and use some polynomials
to model it.
Best regards,
ir. Thierry Onkelinx
Statisticus / Statistician
Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE
AND FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
Havenlaan 88 bus 73, 1000 Brussel
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
///////////////////////////////////////////////////////////////////////////////////////////
Post by Michiel Kiggen
Dear Reader,
*2x scaled continous predictor* (sum score of 2 questionairres)
*1x predictor being 10 trials* on a ultimatum game of which each trial
is 1
Post by Michiel Kiggen
out of 10 possible options. (offer of a split of $20: e.g. you 1 and 19
me). Inserted this a non ordered factor (10-levels) with sum-to-zero
coding
Post by Michiel Kiggen
(contrast.sum).
*1x dependent binary variable *being the response to the 10 trials valued
at accepted (1) or reject (2). Entered as a factor.
After the following model without correlations terms (I ran this model
after failing to converge on a model without optimizers and the all_fit
of
Post by Michiel Kiggen
glmer(AoR ~ Trials * (sPredictor1*sPredictor2) + (1 | ID )+ (0 + Trials
|ID),family = binomial, data = data, control = glmerControl(optCtrl =
list(maxfun = 1e+9, optimizer = "bobyqa")))
*fixed-effect model matrix is rank deficient so dropping 10 columns /
coefficients*
*Warning messages:*
*1: In (function (npt = min(n + 2L, 2L * n), rhobeg = NA, rhoend = NA,
:*
Post by Michiel Kiggen
* unused control arguments ignored*
*2: In (function (iprint = 0L, maxfun = 10000L, FtolAbs = 0.00001,
FtolRel
Post by Michiel Kiggen
= 1e-15, :*
* unused control arguments ignored*
3: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,
unable to evaluate scaled gradient
4: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,
Model failed to converge: degenerate Hessian with 11 negative
eigenvalues
Post by Michiel Kiggen
I'm afraid I might be doing something wrong in handeling the DV or
10-factor level IV, which in turn, is causing the 3 errors in bold. Does
anyone have suggestions. Or can some one tell me what the source of these
errors are?
Much obliged in advance,
Kindest regards,
Michiel Kiggen
[[alternative HTML version deleted]]
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
[[alternative HTML version deleted]]
Thierry Onkelinx
2018-06-26 08:31:16 UTC
Permalink
Dear Michiel,

I think you need to take a step back. Your model is most likely too
complex for your data. You have about 16 parameters in your model and
only 103 observations... I tend to use as a rule of thumb: at least 10
effective observations per parameter. In case of a binomial
distribution I count the number of success and the number of failures
and use the lowest of the two as number of effective observations. In
ideal circumstances, a near 50%-50% split, you have 50 effective
observations so you can use only 5 parameters... Fisher's quote in my
signature might be applicable.

A side note: although you can code a binomial response as a factor, it
is IMHO more clear to code it as a logical value. If you do want to
code it as a factor, make sure that you read the details of ?family.

Best regards,

ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE
AND FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
***@inbo.be
Havenlaan 88 bus 73, 1000 Brussel
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
///////////////////////////////////////////////////////////////////////////////////////////
Post by Michiel Kiggen
Dear Thierry
Thanks so much for comments, I really appreciate it.
model_poly_nc <- glmer(AoR ~ Offers_lin*(sFW*sMF)+ Offers_quad *(sFW*sMF) +
(1 |ID)+ (0 + Offers_lin| ID)+(0 + Offers_quad| ID),family = binomial, data
= data, control = glmerControl(optCtrl = list(maxfun = 1e+9)))
Offers_lin & Offers_quad are the trial variables (polynomials for linear and
quadratic patterns). Both of them are centered. Metric is from 1 till 10. (1
being trial in which people get lowest offer and 10 being the highest offer
in an ultimatum game)
sFW & sMF are the continous questionairre sumscores, standardized &
centered.
DV (2 level factor accept or reject)
n = 103
I ran the model with covariance terms for the random effects. It didn't
converge, neither with optimizers bobyqa & Nelder_Mead.
However, the function allFit, strangely returned [OK] for bobyqa,
Nelder_Mead, nloptwrap.NLOPT_LN_NELDERMEAD & nloptwrap.NLOPT_LN_BOBYQA.
The model above is without covariance terms for the random effects. After
[OK] for bobyqa, Nelder_Mead, nloptwrap.NLOPT_LN_NELDERMEAD &
nloptwrap.NLOPT_LN_BOBYQA.
Using the getME function to look at the different Fixed Effects generated by
allFit (no covariance term model, as described above), it reveals that the
numbers are similar for bobyqa, loptwrap.NLOPT_LN_NELDERMEAD &
nloptwrap.NLOPT_LN_BOBYQA. While for the Nelder_mead numbers are just
slightly different. Like a 0.02 difference.
For the seperate Models with optimizers Bobyqa & Nelder_Mead (both with
convergence issues), the fixed effects were exactly the same.
I'm not sure how to interpret these allFit function results. For what
patterns should I look incase I want to conclude these warnings are
false-positives?
Else, what options do I have? I've already stripped the model of it random
covariances (Removing the random slope will make the purpose of using Mixed
Models dispensable).
My apologies if I'm asking any obvious questions. First time i'm running
this kind of analysis.
Any help is much appreciated!
Kind regards,
Michiel
Op ma 25 jun. 2018 om 09:08 schreef Thierry Onkelinx
Post by Thierry Onkelinx
Dear Michiel,
Does it run with the random slope for trial. If I understand the
design correctly, you have only one observation per trial and per ID.
In that case a random slope for trial as an (ordered) factor won't
work.
Consider using trial as a continuous variable and use some polynomials
to model it.
Best regards,
ir. Thierry Onkelinx
Statisticus / Statistician
Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE
AND FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
Havenlaan 88 bus 73, 1000 Brussel
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
///////////////////////////////////////////////////////////////////////////////////////////
Post by Michiel Kiggen
Dear Reader,
*2x scaled continous predictor* (sum score of 2 questionairres)
*1x predictor being 10 trials* on a ultimatum game of which each trial is 1
out of 10 possible options. (offer of a split of $20: e.g. you 1 and 19
me). Inserted this a non ordered factor (10-levels) with sum-to-zero coding
(contrast.sum).
*1x dependent binary variable *being the response to the 10 trials valued
at accepted (1) or reject (2). Entered as a factor.
After the following model without correlations terms (I ran this model
after failing to converge on a model without optimizers and the all_fit of
glmer(AoR ~ Trials * (sPredictor1*sPredictor2) + (1 | ID )+ (0 + Trials
|ID),family = binomial, data = data, control = glmerControl(optCtrl =
list(maxfun = 1e+9, optimizer = "bobyqa")))
*fixed-effect model matrix is rank deficient so dropping 10 columns /
coefficients*
*Warning messages:*
*1: In (function (npt = min(n + 2L, 2L * n), rhobeg = NA, rhoend = NA,
:*
* unused control arguments ignored*
*2: In (function (iprint = 0L, maxfun = 10000L, FtolAbs = 0.00001, FtolRel
= 1e-15, :*
* unused control arguments ignored*
3: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,
unable to evaluate scaled gradient
4: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,
Model failed to converge: degenerate Hessian with 11 negative eigenvalues
I'm afraid I might be doing something wrong in handeling the DV or
10-factor level IV, which in turn, is causing the 3 errors in bold. Does
anyone have suggestions. Or can some one tell me what the source of these
errors are?
Much obliged in advance,
Kindest regards,
Michiel Kiggen
[[alternative HTML version deleted]]
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Loading...