I'm using a binomial glmer mixed effects model. One variable that I have, 'stimulus' has 12 levels. The levels were not randomly selected but were rather chosen as per the study design, so I have used the variable ?stimulus? as a fixed variable in the basic model but R seems not to like it (at least this is my interpretation) given the way the output looks and the amount of time R takes to process it. m0.1 <- glmer(match ~ Listgp + stimulus + (1|Listener), data = PATdata, family = "binomial") summary(m0.1) Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) [ glmerMod] Family: binomial ( logit ) Formula: match ~ Listgp + stimulus + (1 | Listener) Data: PATdata AIC BIC logLik deviance df.resid 5154.3 5259.5 -2562.2 5124.3 8193 Scaled residuals: Min 1Q Median 3Q Max -25.0764 -0.2706 -0.1939 0.2472 10.5131 Random effects: Groups Name Variance Std.Dev. Listener (Intercept) 1.743 1.32 Number of obs: 8208, groups: Listener, 228 Fixed effects: Estimate Std. Error z value Pr(>|z|) (Intercept) 2.7561 0.2657 10.371 < 2e-16 * ListgpTA 0.1741 0.3147 0.553 0.580128 ListgpTQ 0.0810 0.2575 0.315 0.753094 stimulushaaDD -5.4415 0.2071 -26.272 < 2e-16 stimulushad -4.2953 0.1822 -23.569 < 2e-16 stimulushaDD -5.4946 0.2086 -26.337 < 2e-16 stimulushid -5.1519 0.1994 -25.832 < 2e-16 stimulushiDD -0.6708 0.1801 -3.724 0.000196 stimulushiid -5.8124 0.2186 -26.593 < 2e-16 stimulushiiDD -5.5101 0.2091 -26.353 < 2e-16 stimulushud -0.2016 0.1915 -1.053 0.292345 stimulushuDD -5.6188 0.2123 -26.462 < 2e-16 stimulushuud -5.6107 0.2121 -26.450 < 2e-16 * stimulushuuDD -5.3207 0.2038 -26.109 < 2e-16 *** Signif. codes: 0 ?? 0.001 ?? 0.01 ?? 0.05 ?.? 0.1 ? ? 1 Correlation of Fixed Effects: (Intr) LstgTA LstgTQ stimulushaaDD stimulushad stimulushaDD ListgpTA -0.613 ListgpTQ -0.755 0.636 stimulushaaDD -0.394 -0.007 0.004 stimulushad -0.440 -0.006 0.005 0.605 stimulushaDD -0.392 -0.007 0.003 0.555 0.601 stimulushid -0.407 -0.007 0.004 0.572 0.624 0.569 stimulushiDD -0.414 0.000 0.001 0.534 0.606 0.530 stimulushiid -0.376 -0.006 0.003 0.536 0.578 0.533 stimulushiiDD -0.391 -0.007 0.003 0.554 0.600 0.551 stimulushud -0.386 0.000 0.000 0.497 0.564 0.493 stimulushuDD -0.385 -0.007 0.003 0.548 0.592 0.545 stimulushuud -0.386 -0.007 0.003 0.548 0.593 0.545 stimulushuuDD -0.400 -0.007 0.004 0.564 0.613 0.561 stimulushid stimulushiDD stimulushiid stimulushiiDD stimulushud ListgpTA ListgpTQ stimulushaaDD stimulushad stimulushaDD stimulushid stimulushiDD 0.554 stimulushiid 0.549 0.506 stimulushiiDD 0.568 0.529 0.533 stimulushud 0.516 0.569 0.471 0.492 stimulushuDD 0.562 0.521 0.527 0.544 0.484 stimulushuud 0.562 0.522 0.528 0.545 0.485 stimulushuuDD 0.579 0.543 0.542 0.560 0.505 stimulushuDD stimulushuud ListgpTA ListgpTQ stimulushaaDD stimulushad stimulushaDD stimulushid stimulushiDD stimulushiid stimulushiiDD stimulushud stimulushuDD stimulushuud 0.539 stimulushuuDD 0.554 0.554 So, my question is, can I consider 'stimulus' as a random effect instead since the model become more sensible from a programming point of view? m0.1 <- glmer(match ~ Listgp + (1|stimulus) + (1|Listener), data = PATdata, family = "binomial") summary(m0.1) Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) [ glmerMod] Family: binomial ( logit ) Formula: match ~ Listgp + (1 | stimulus) + (1 | Listener) Data: PATdata AIC BIC logLik deviance df.resid 5218.3 5253.4 -2604.2 5208.3 8203 Scaled residuals: Min 1Q Median 3Q Max -21.9276 -0.2804 -0.2059 0.2740 9.4275 Random effects: Groups Name Variance Std.Dev. Listener (Intercept) 1.676 1.294 stimulus (Intercept) 4.949 2.225 Number of obs: 8208, groups: Listener, 228; stimulus, 12 Fixed effects: Estimate Std. Error z value Pr(>|z|) (Intercept) -1.3754 0.6792 -2.025 0.0429 * ListgpTA 0.2284 0.3073 0.743 0.4572 ListgpTQ 0.1432 0.2513 0.570 0.5687 Signif. codes: 0 ?? 0.001 ?? 0.01 ?? 0.05 ?.? 0.1 ? ? 1 Correlation of Fixed Effects: (Intr) LstgTA ListgpTA -0.235 ListgpTQ -0.288 0.636 Thank you, Shad
Random vs. fixed effects
4 messages · Shadiya Al Hashmi, Thierry Onkelinx
Dear Shad, Please don't post in HTML since it makes the model output unreadable. You need to be more clear on "R seems not to like it". 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 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 2015-10-26 10:37 GMT+01:00 Shadiya Al Hashmi <saah500 at york.ac.uk>:
I'm using a binomial glmer mixed effects model.
One variable that I have, 'stimulus' has 12 levels. The levels were not
randomly selected but were rather chosen as per the study design, so I have
used the variable ?stimulus? as a fixed variable in the basic model but R
seems not to like it (at least this is my interpretation) given the way the
output looks and the amount of time R takes to process it.
m0.1 <- glmer(match ~ Listgp + stimulus + (1|Listener), data = PATdata,
family = "binomial")
summary(m0.1) Generalized linear mixed model fit by maximum likelihood
(Laplace Approximation) [ glmerMod] Family: binomial ( logit ) Formula:
match ~ Listgp + stimulus + (1 | Listener) Data: PATdata
AIC BIC logLik deviance df.resid
5154.3 5259.5 -2562.2 5124.3 8193
Scaled residuals: Min 1Q Median 3Q Max -25.0764 -0.2706 -0.1939 0.2472
10.5131
Random effects: Groups Name Variance Std.Dev. Listener (Intercept) 1.743
1.32
Number of obs: 8208, groups: Listener, 228
Fixed effects: Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.7561 0.2657 10.371 < 2e-16 * ListgpTA 0.1741 0.3147 0.553
0.580128
ListgpTQ 0.0810 0.2575 0.315 0.753094
stimulushaaDD -5.4415 0.2071 -26.272 < 2e-16 stimulushad -4.2953 0.1822
-23.569 < 2e-16 stimulushaDD -5.4946 0.2086 -26.337 < 2e-16 stimulushid
-5.1519 0.1994 -25.832 < 2e-16 stimulushiDD -0.6708 0.1801 -3.724 0.000196
stimulushiid -5.8124 0.2186 -26.593 < 2e-16 stimulushiiDD -5.5101 0.2091
-26.353 < 2e-16 stimulushud -0.2016 0.1915 -1.053 0.292345
stimulushuDD -5.6188 0.2123 -26.462 < 2e-16 stimulushuud -5.6107 0.2121
-26.450 < 2e-16 *
stimulushuuDD -5.3207 0.2038 -26.109 < 2e-16 ***
Signif. codes: 0 ?? 0.001 ?? 0.01 ?? 0.05 ?.? 0.1 ? ? 1
Correlation of Fixed Effects: (Intr) LstgTA LstgTQ stimulushaaDD
stimulushad stimulushaDD ListgpTA -0.613
ListgpTQ -0.755 0.636
stimulushaaDD -0.394 -0.007 0.004
stimulushad -0.440 -0.006 0.005 0.605
stimulushaDD -0.392 -0.007 0.003 0.555 0.601
stimulushid -0.407 -0.007 0.004 0.572 0.624 0.569
stimulushiDD -0.414 0.000 0.001 0.534 0.606 0.530
stimulushiid -0.376 -0.006 0.003 0.536 0.578 0.533
stimulushiiDD -0.391 -0.007 0.003 0.554 0.600 0.551
stimulushud -0.386 0.000 0.000 0.497 0.564 0.493
stimulushuDD -0.385 -0.007 0.003 0.548 0.592 0.545
stimulushuud -0.386 -0.007 0.003 0.548 0.593 0.545
stimulushuuDD -0.400 -0.007 0.004 0.564 0.613 0.561
stimulushid stimulushiDD stimulushiid stimulushiiDD stimulushud ListgpTA
ListgpTQ
stimulushaaDD
stimulushad
stimulushaDD
stimulushid
stimulushiDD 0.554
stimulushiid 0.549 0.506
stimulushiiDD 0.568 0.529 0.533
stimulushud 0.516 0.569 0.471 0.492
stimulushuDD 0.562 0.521 0.527 0.544 0.484
stimulushuud 0.562 0.522 0.528 0.545 0.485
stimulushuuDD 0.579 0.543 0.542 0.560 0.505
stimulushuDD stimulushuud ListgpTA
ListgpTQ
stimulushaaDD
stimulushad
stimulushaDD
stimulushid
stimulushiDD
stimulushiid
stimulushiiDD
stimulushud
stimulushuDD
stimulushuud 0.539
stimulushuuDD 0.554 0.554
So, my question is, can I consider 'stimulus' as a random effect instead
since the model become more sensible from a programming point of view?
m0.1 <- glmer(match ~ Listgp + (1|stimulus) + (1|Listener), data = PATdata,
family = "binomial") summary(m0.1) Generalized linear mixed model fit by
maximum likelihood (Laplace Approximation) [ glmerMod] Family: binomial (
logit ) Formula: match ~ Listgp + (1 | stimulus) + (1 | Listener) Data:
PATdata
AIC BIC logLik deviance df.resid
5218.3 5253.4 -2604.2 5208.3 8203
Scaled residuals: Min 1Q Median 3Q Max -21.9276 -0.2804 -0.2059 0.2740
9.4275
Random effects: Groups Name Variance Std.Dev. Listener (Intercept) 1.676
1.294
stimulus (Intercept) 4.949 2.225
Number of obs: 8208, groups: Listener, 228; stimulus, 12
Fixed effects: Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.3754 0.6792 -2.025 0.0429 * ListgpTA 0.2284 0.3073 0.743
0.4572
ListgpTQ 0.1432 0.2513 0.570 0.5687
Signif. codes: 0 ?? 0.001 ?? 0.01 ?? 0.05 ?.? 0.1 ? ? 1
Correlation of Fixed Effects: (Intr) LstgTA ListgpTA -0.235
ListgpTQ -0.288 0.636
Thank you,
Shad
[[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Dear Thierry, Thanks for your response. I meant that the way the levels of stimulus are shown in the output does not look right. In addition, when I use stimulus as a fixed effect, R takes such a long time to produce the output compared to when I use it as a random effect. Besides, I'm warned as follows. In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge with max|grad| = 0.063422 (tol = 0.001, component 4) Here is how the output looks when stimulus is used as a fixed effect.
summary(m0.1)
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [
glmerMod]
Family: binomial ( logit )
Formula: match ~ Listgp + stimulus + (1 | Listener)
Data: PATdata
AIC BIC logLik deviance df.resid
5154.3 5259.5 -2562.2 5124.3 8193
Scaled residuals:
Min 1Q Median 3Q Max
-25.0764 -0.2706 -0.1939 0.2472 10.5131
Random effects:
Groups Name Variance Std.Dev.
Listener (Intercept) 1.743 1.32
Number of obs: 8208, groups: Listener, 228
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.7561 0.2657 10.371 < 2e-16 ***
ListgpTA 0.1741 0.3147 0.553 0.580128
ListgpTQ 0.0810 0.2575 0.315 0.753094
stimulushaaDD -5.4415 0.2071 -26.272 < 2e-16 ***
stimulushad -4.2953 0.1822 -23.569 < 2e-16 ***
stimulushaDD -5.4946 0.2086 -26.337 < 2e-16 ***
stimulushid -5.1519 0.1994 -25.832 < 2e-16 ***
stimulushiDD -0.6708 0.1801 -3.724 0.000196 ***
stimulushiid -5.8124 0.2186 -26.593 < 2e-16 ***
stimulushiiDD -5.5101 0.2091 -26.353 < 2e-16 ***
stimulushud -0.2016 0.1915 -1.053 0.292345
stimulushuDD -5.6188 0.2123 -26.462 < 2e-16 ***
stimulushuud -5.6107 0.2121 -26.450 < 2e-16 ***
stimulushuuDD -5.3207 0.2038 -26.109 < 2e-16 ***
---
Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
Correlation of Fixed Effects:
(Intr) LstgTA LstgTQ stimulushaaDD stimulushad stimulushaDD
ListgpTA -0.613
ListgpTQ -0.755 0.636
stimulushaaDD -0.394 -0.007 0.004
stimulushad -0.440 -0.006 0.005 0.605
stimulushaDD -0.392 -0.007 0.003 0.555 0.601
stimulushid -0.407 -0.007 0.004 0.572 0.624 0.569
stimulushiDD -0.414 0.000 0.001 0.534 0.606 0.530
stimulushiid -0.376 -0.006 0.003 0.536 0.578 0.533
stimulushiiDD -0.391 -0.007 0.003 0.554 0.600 0.551
stimulushud -0.386 0.000 0.000 0.497 0.564 0.493
stimulushuDD -0.385 -0.007 0.003 0.548 0.592 0.545
stimulushuud -0.386 -0.007 0.003 0.548 0.593 0.545
stimulushuuDD -0.400 -0.007 0.004 0.564 0.613 0.561
stimulushid stimulushiDD stimulushiid stimulushiiDD
stimulushud
ListgpTA
ListgpTQ
stimulushaaDD
stimulushad
stimulushaDD
stimulushid
stimulushiDD 0.554
stimulushiid 0.549 0.506
stimulushiiDD 0.568 0.529 0.533
stimulushud 0.516 0.569 0.471 0.492
stimulushuDD 0.562 0.521 0.527 0.544 0.484
stimulushuud 0.562 0.522 0.528 0.545 0.485
stimulushuuDD 0.579 0.543 0.542 0.560 0.505
stimulushuDD stimulushuud
ListgpTA
ListgpTQ
stimulushaaDD
stimulushad
stimulushaDD
stimulushid
stimulushiDD
stimulushiid
stimulushiiDD
stimulushud
stimulushuDD
stimulushuud 0.539
stimulushuuDD 0.554 0.554
Compared to when it is used as a random effect.
m0.1 <- glmer(match ~ Listgp + (1|stimulus) + (1|Listener), data = PATdata,
family = "binomial")
summary(m0.1)
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [
glmerMod]
Family: binomial ( logit )
Formula: match ~ Listgp + (1 | stimulus) + (1 | Listener)
Data: PATdata
AIC BIC logLik deviance df.resid
5218.3 5253.4 -2604.2 5208.3 8203
Scaled residuals:
Min 1Q Median 3Q Max
-21.9276 -0.2804 -0.2059 0.2740 9.4275
Random effects:
Groups Name Variance Std.Dev.
Listener (Intercept) 1.676 1.294
stimulus (Intercept) 4.949 2.225
Number of obs: 8208, groups: Listener, 228; stimulus, 12
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.3754 0.6792 -2.025 0.0429 *
ListgpTA 0.2284 0.3073 0.743 0.4572
ListgpTQ 0.1432 0.2513 0.570 0.5687
---
Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
Correlation of Fixed Effects:
(Intr) LstgTA
ListgpTA -0.235
ListgpTQ -0.288 0.636
Thanks,
Shad
On 26 October 2015 at 12:47, Thierry Onkelinx <thierry.onkelinx at inbo.be>
wrote:
Dear Shad, Please don't post in HTML since it makes the model output unreadable. You need to be more clear on "R seems not to like it". 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 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 2015-10-26 10:37 GMT+01:00 Shadiya Al Hashmi <saah500 at york.ac.uk>:
I'm using a binomial glmer mixed effects model.
One variable that I have, 'stimulus' has 12 levels. The levels were not
randomly selected but were rather chosen as per the study design, so I
have
used the variable ?stimulus? as a fixed variable in the basic model but R
seems not to like it (at least this is my interpretation) given the way
the
output looks and the amount of time R takes to process it.
m0.1 <- glmer(match ~ Listgp + stimulus + (1|Listener), data = PATdata,
family = "binomial")
summary(m0.1) Generalized linear mixed model fit by maximum likelihood
(Laplace Approximation) [ glmerMod] Family: binomial ( logit ) Formula:
match ~ Listgp + stimulus + (1 | Listener) Data: PATdata
AIC BIC logLik deviance df.resid
5154.3 5259.5 -2562.2 5124.3 8193
Scaled residuals: Min 1Q Median 3Q Max -25.0764 -0.2706 -0.1939 0.2472
10.5131
Random effects: Groups Name Variance Std.Dev. Listener (Intercept) 1.743
1.32
Number of obs: 8208, groups: Listener, 228
Fixed effects: Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.7561 0.2657 10.371 < 2e-16 * ListgpTA 0.1741 0.3147 0.553
0.580128
ListgpTQ 0.0810 0.2575 0.315 0.753094
stimulushaaDD -5.4415 0.2071 -26.272 < 2e-16 stimulushad -4.2953 0.1822
-23.569 < 2e-16 stimulushaDD -5.4946 0.2086 -26.337 < 2e-16 stimulushid
-5.1519 0.1994 -25.832 < 2e-16 stimulushiDD -0.6708 0.1801 -3.724 0.000196
stimulushiid -5.8124 0.2186 -26.593 < 2e-16 stimulushiiDD -5.5101 0.2091
-26.353 < 2e-16 stimulushud -0.2016 0.1915 -1.053 0.292345
stimulushuDD -5.6188 0.2123 -26.462 < 2e-16 stimulushuud -5.6107 0.2121
-26.450 < 2e-16 *
stimulushuuDD -5.3207 0.2038 -26.109 < 2e-16 ***
Signif. codes: 0 ?? 0.001 ?? 0.01 ?? 0.05 ?.? 0.1 ? ? 1
Correlation of Fixed Effects: (Intr) LstgTA LstgTQ stimulushaaDD
stimulushad stimulushaDD ListgpTA -0.613
ListgpTQ -0.755 0.636
stimulushaaDD -0.394 -0.007 0.004
stimulushad -0.440 -0.006 0.005 0.605
stimulushaDD -0.392 -0.007 0.003 0.555 0.601
stimulushid -0.407 -0.007 0.004 0.572 0.624 0.569
stimulushiDD -0.414 0.000 0.001 0.534 0.606 0.530
stimulushiid -0.376 -0.006 0.003 0.536 0.578 0.533
stimulushiiDD -0.391 -0.007 0.003 0.554 0.600 0.551
stimulushud -0.386 0.000 0.000 0.497 0.564 0.493
stimulushuDD -0.385 -0.007 0.003 0.548 0.592 0.545
stimulushuud -0.386 -0.007 0.003 0.548 0.593 0.545
stimulushuuDD -0.400 -0.007 0.004 0.564 0.613 0.561
stimulushid stimulushiDD stimulushiid stimulushiiDD stimulushud ListgpTA
ListgpTQ
stimulushaaDD
stimulushad
stimulushaDD
stimulushid
stimulushiDD 0.554
stimulushiid 0.549 0.506
stimulushiiDD 0.568 0.529 0.533
stimulushud 0.516 0.569 0.471 0.492
stimulushuDD 0.562 0.521 0.527 0.544 0.484
stimulushuud 0.562 0.522 0.528 0.545 0.485
stimulushuuDD 0.579 0.543 0.542 0.560 0.505
stimulushuDD stimulushuud ListgpTA
ListgpTQ
stimulushaaDD
stimulushad
stimulushaDD
stimulushid
stimulushiDD
stimulushiid
stimulushiiDD
stimulushud
stimulushuDD
stimulushuud 0.539
stimulushuuDD 0.554 0.554
So, my question is, can I consider 'stimulus' as a random effect instead
since the model become more sensible from a programming point of view?
m0.1 <- glmer(match ~ Listgp + (1|stimulus) + (1|Listener), data =
PATdata,
family = "binomial") summary(m0.1) Generalized linear mixed model fit by
maximum likelihood (Laplace Approximation) [ glmerMod] Family: binomial (
logit ) Formula: match ~ Listgp + (1 | stimulus) + (1 | Listener) Data:
PATdata
AIC BIC logLik deviance df.resid
5218.3 5253.4 -2604.2 5208.3 8203
Scaled residuals: Min 1Q Median 3Q Max -21.9276 -0.2804 -0.2059 0.2740
9.4275
Random effects: Groups Name Variance Std.Dev. Listener (Intercept) 1.676
1.294
stimulus (Intercept) 4.949 2.225
Number of obs: 8208, groups: Listener, 228; stimulus, 12
Fixed effects: Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.3754 0.6792 -2.025 0.0429 * ListgpTA 0.2284 0.3073 0.743
0.4572
ListgpTQ 0.1432 0.2513 0.570 0.5687
Signif. codes: 0 ?? 0.001 ?? 0.01 ?? 0.05 ?.? 0.1 ? ? 1
Correlation of Fixed Effects: (Intr) LstgTA ListgpTA -0.235
ListgpTQ -0.288 0.636
Thank you,
Shad
[[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Dear Shad, It looks like you have complete separation in your dataset. Random effect are slightly better at coping with that. But still the very high variance of the random effect indicate that there is complete separation. Best regards, Thierry 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 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 2015-10-26 11:10 GMT+01:00 Shadiya Al Hashmi <saah500 at york.ac.uk>:
Dear Thierry, Thanks for your response. I meant that the way the levels of stimulus are shown in the output does not look right. In addition, when I use stimulus as a fixed effect, R takes such a long time to produce the output compared to when I use it as a random effect. Besides, I'm warned as follows. In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge with max|grad| = 0.063422 (tol = 0.001, component 4) Here is how the output looks when stimulus is used as a fixed effect.
summary(m0.1)
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [
glmerMod]
Family: binomial ( logit )
Formula: match ~ Listgp + stimulus + (1 | Listener)
Data: PATdata
AIC BIC logLik deviance df.resid
5154.3 5259.5 -2562.2 5124.3 8193
Scaled residuals:
Min 1Q Median 3Q Max
-25.0764 -0.2706 -0.1939 0.2472 10.5131
Random effects:
Groups Name Variance Std.Dev.
Listener (Intercept) 1.743 1.32
Number of obs: 8208, groups: Listener, 228
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.7561 0.2657 10.371 < 2e-16 ***
ListgpTA 0.1741 0.3147 0.553 0.580128
ListgpTQ 0.0810 0.2575 0.315 0.753094
stimulushaaDD -5.4415 0.2071 -26.272 < 2e-16 ***
stimulushad -4.2953 0.1822 -23.569 < 2e-16 ***
stimulushaDD -5.4946 0.2086 -26.337 < 2e-16 ***
stimulushid -5.1519 0.1994 -25.832 < 2e-16 ***
stimulushiDD -0.6708 0.1801 -3.724 0.000196 ***
stimulushiid -5.8124 0.2186 -26.593 < 2e-16 ***
stimulushiiDD -5.5101 0.2091 -26.353 < 2e-16 ***
stimulushud -0.2016 0.1915 -1.053 0.292345
stimulushuDD -5.6188 0.2123 -26.462 < 2e-16 ***
stimulushuud -5.6107 0.2121 -26.450 < 2e-16 ***
stimulushuuDD -5.3207 0.2038 -26.109 < 2e-16 ***
---
Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
Correlation of Fixed Effects:
(Intr) LstgTA LstgTQ stimulushaaDD stimulushad stimulushaDD
ListgpTA -0.613
ListgpTQ -0.755 0.636
stimulushaaDD -0.394 -0.007 0.004
stimulushad -0.440 -0.006 0.005 0.605
stimulushaDD -0.392 -0.007 0.003 0.555 0.601
stimulushid -0.407 -0.007 0.004 0.572 0.624 0.569
stimulushiDD -0.414 0.000 0.001 0.534 0.606 0.530
stimulushiid -0.376 -0.006 0.003 0.536 0.578 0.533
stimulushiiDD -0.391 -0.007 0.003 0.554 0.600 0.551
stimulushud -0.386 0.000 0.000 0.497 0.564 0.493
stimulushuDD -0.385 -0.007 0.003 0.548 0.592 0.545
stimulushuud -0.386 -0.007 0.003 0.548 0.593 0.545
stimulushuuDD -0.400 -0.007 0.004 0.564 0.613 0.561
stimulushid stimulushiDD stimulushiid stimulushiiDD
stimulushud
ListgpTA
ListgpTQ
stimulushaaDD
stimulushad
stimulushaDD
stimulushid
stimulushiDD 0.554
stimulushiid 0.549 0.506
stimulushiiDD 0.568 0.529 0.533
stimulushud 0.516 0.569 0.471 0.492
stimulushuDD 0.562 0.521 0.527 0.544 0.484
stimulushuud 0.562 0.522 0.528 0.545 0.485
stimulushuuDD 0.579 0.543 0.542 0.560 0.505
stimulushuDD stimulushuud
ListgpTA
ListgpTQ
stimulushaaDD
stimulushad
stimulushaDD
stimulushid
stimulushiDD
stimulushiid
stimulushiiDD
stimulushud
stimulushuDD
stimulushuud 0.539
stimulushuuDD 0.554 0.554
Compared to when it is used as a random effect.
m0.1 <- glmer(match ~ Listgp + (1|stimulus) + (1|Listener), data =
PATdata, family = "binomial")
summary(m0.1)
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [
glmerMod]
Family: binomial ( logit )
Formula: match ~ Listgp + (1 | stimulus) + (1 | Listener)
Data: PATdata
AIC BIC logLik deviance df.resid
5218.3 5253.4 -2604.2 5208.3 8203
Scaled residuals:
Min 1Q Median 3Q Max
-21.9276 -0.2804 -0.2059 0.2740 9.4275
Random effects:
Groups Name Variance Std.Dev.
Listener (Intercept) 1.676 1.294
stimulus (Intercept) 4.949 2.225
Number of obs: 8208, groups: Listener, 228; stimulus, 12
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.3754 0.6792 -2.025 0.0429 *
ListgpTA 0.2284 0.3073 0.743 0.4572
ListgpTQ 0.1432 0.2513 0.570 0.5687
---
Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
Correlation of Fixed Effects:
(Intr) LstgTA
ListgpTA -0.235
ListgpTQ -0.288 0.636
Thanks,
Shad
On 26 October 2015 at 12:47, Thierry Onkelinx <thierry.onkelinx at inbo.be>
wrote:
Dear Shad, Please don't post in HTML since it makes the model output unreadable. You need to be more clear on "R seems not to like it". 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 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 2015-10-26 10:37 GMT+01:00 Shadiya Al Hashmi <saah500 at york.ac.uk>:
I'm using a binomial glmer mixed effects model.
One variable that I have, 'stimulus' has 12 levels. The levels were not
randomly selected but were rather chosen as per the study design, so I
have
used the variable ?stimulus? as a fixed variable in the basic model but R
seems not to like it (at least this is my interpretation) given the way
the
output looks and the amount of time R takes to process it.
m0.1 <- glmer(match ~ Listgp + stimulus + (1|Listener), data = PATdata,
family = "binomial")
summary(m0.1) Generalized linear mixed model fit by maximum likelihood
(Laplace Approximation) [ glmerMod] Family: binomial ( logit ) Formula:
match ~ Listgp + stimulus + (1 | Listener) Data: PATdata
AIC BIC logLik deviance df.resid
5154.3 5259.5 -2562.2 5124.3 8193
Scaled residuals: Min 1Q Median 3Q Max -25.0764 -0.2706 -0.1939 0.2472
10.5131
Random effects: Groups Name Variance Std.Dev. Listener (Intercept) 1.743
1.32
Number of obs: 8208, groups: Listener, 228
Fixed effects: Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.7561 0.2657 10.371 < 2e-16 * ListgpTA 0.1741 0.3147 0.553
0.580128
ListgpTQ 0.0810 0.2575 0.315 0.753094
stimulushaaDD -5.4415 0.2071 -26.272 < 2e-16 stimulushad -4.2953 0.1822
-23.569 < 2e-16 stimulushaDD -5.4946 0.2086 -26.337 < 2e-16 stimulushid
-5.1519 0.1994 -25.832 < 2e-16 stimulushiDD -0.6708 0.1801 -3.724
0.000196
stimulushiid -5.8124 0.2186 -26.593 < 2e-16 stimulushiiDD -5.5101 0.2091
-26.353 < 2e-16 stimulushud -0.2016 0.1915 -1.053 0.292345
stimulushuDD -5.6188 0.2123 -26.462 < 2e-16 stimulushuud -5.6107 0.2121
-26.450 < 2e-16 *
stimulushuuDD -5.3207 0.2038 -26.109 < 2e-16 ***
Signif. codes: 0 ?? 0.001 ?? 0.01 ?? 0.05 ?.? 0.1 ? ? 1
Correlation of Fixed Effects: (Intr) LstgTA LstgTQ stimulushaaDD
stimulushad stimulushaDD ListgpTA -0.613
ListgpTQ -0.755 0.636
stimulushaaDD -0.394 -0.007 0.004
stimulushad -0.440 -0.006 0.005 0.605
stimulushaDD -0.392 -0.007 0.003 0.555 0.601
stimulushid -0.407 -0.007 0.004 0.572 0.624 0.569
stimulushiDD -0.414 0.000 0.001 0.534 0.606 0.530
stimulushiid -0.376 -0.006 0.003 0.536 0.578 0.533
stimulushiiDD -0.391 -0.007 0.003 0.554 0.600 0.551
stimulushud -0.386 0.000 0.000 0.497 0.564 0.493
stimulushuDD -0.385 -0.007 0.003 0.548 0.592 0.545
stimulushuud -0.386 -0.007 0.003 0.548 0.593 0.545
stimulushuuDD -0.400 -0.007 0.004 0.564 0.613 0.561
stimulushid stimulushiDD stimulushiid stimulushiiDD stimulushud ListgpTA
ListgpTQ
stimulushaaDD
stimulushad
stimulushaDD
stimulushid
stimulushiDD 0.554
stimulushiid 0.549 0.506
stimulushiiDD 0.568 0.529 0.533
stimulushud 0.516 0.569 0.471 0.492
stimulushuDD 0.562 0.521 0.527 0.544 0.484
stimulushuud 0.562 0.522 0.528 0.545 0.485
stimulushuuDD 0.579 0.543 0.542 0.560 0.505
stimulushuDD stimulushuud ListgpTA
ListgpTQ
stimulushaaDD
stimulushad
stimulushaDD
stimulushid
stimulushiDD
stimulushiid
stimulushiiDD
stimulushud
stimulushuDD
stimulushuud 0.539
stimulushuuDD 0.554 0.554
So, my question is, can I consider 'stimulus' as a random effect instead
since the model become more sensible from a programming point of view?
m0.1 <- glmer(match ~ Listgp + (1|stimulus) + (1|Listener), data =
PATdata,
family = "binomial") summary(m0.1) Generalized linear mixed model fit by
maximum likelihood (Laplace Approximation) [ glmerMod] Family: binomial (
logit ) Formula: match ~ Listgp + (1 | stimulus) + (1 | Listener) Data:
PATdata
AIC BIC logLik deviance df.resid
5218.3 5253.4 -2604.2 5208.3 8203
Scaled residuals: Min 1Q Median 3Q Max -21.9276 -0.2804 -0.2059 0.2740
9.4275
Random effects: Groups Name Variance Std.Dev. Listener (Intercept) 1.676
1.294
stimulus (Intercept) 4.949 2.225
Number of obs: 8208, groups: Listener, 228; stimulus, 12
Fixed effects: Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.3754 0.6792 -2.025 0.0429 * ListgpTA 0.2284 0.3073 0.743
0.4572
ListgpTQ 0.1432 0.2513 0.570 0.5687
Signif. codes: 0 ?? 0.001 ?? 0.01 ?? 0.05 ?.? 0.1 ? ? 1
Correlation of Fixed Effects: (Intr) LstgTA ListgpTA -0.235
ListgpTQ -0.288 0.636
Thank you,
Shad
[[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models