[R-sig-ME] discrepancy between contrast and pooled levels
espesser
robert.espesser at lpl-aix.fr
Fri Mar 6 18:17:57 CET 2009
Dear list members,
I am confused with the following results,
so I greatly appreciate any suggestions or remarks.
The structure of the data:
> str(eglob_new)
'data.frame': 1200 obs. of 8 variables:
$ subject : Factor w/ 40 levels "letl01","letl03",..: 1 1 1 1 1 1 1 1 1
1 ...
$ dlmscentre : num -2 -2 -2 -2 -1 -1 -1 -1 0 0 ...
$ nfcompo : num 2 1 3 2 2 1 3 2 2 1 ...
$ conditionbis : Factor w/ 3 levels "e2b","e2a","e2c": 2 2 2 2 2 2 2 2 2
2 ...
$ rlet : num 9 7 7 5 8 10 5 6 5 8 ...
$ rnlet : num 8 10 10 12 9 7 12 11 12 9 ...
$ conditionBLOCKVOY : Factor w/ 2 levels "e2ab","e2c": 1 1 1 1 1 1 1 1 1
1 ...
$ conditionFEEDBACK : Factor w/ 2 levels "e2a","e2bc": 1 1 1 1 1 1 1 1 1
1 ...
- a first group of 20 subjects experiments the both condition e2b and e2c
- an other group of 20 subjects only experiments the condition e2a
I think the subject labels are correct, ie there is no implicit nesting.
I fit probability of the "let" response with a logit mixed model .
the "best" model I obtained was :
glmer(cbind(rlet, rnlet) ~ dlmscentre*conditionbis + nfcompo +
(dlmscentre | subject),family=binomial, data=eglob_new)
# model A
> summary(eglob_new_conditionbis_leger.glmer)
Generalized linear mixed model fit by the Laplace approximation
Formula: cbind(rlet, rnlet) ~ (dlmscentre + conditionbis)^2 + nfcompo
+ (dlmscentre | subject)
Data: eglob_new
AIC BIC logLik deviance
2083 2134 -1032 2063
Random effects:
Groups Name Variance Std.Dev. Corr
subject (Intercept) 0.22676 0.47619
dlmscentre 0.32139 0.56691 0.338
Number of obs: 1200, groups: subject, 40
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.01225 0.11792 -0.104 0.917
dlmscentre -0.85908 0.12867 -6.677 2.44e-11 ***
conditionbise2a 0.02483 0.15577 0.159 0.873
conditionbise2c -0.03907 0.03666 -1.066 0.286
nfcompo 0.13241 0.02155 6.144 8.03e-10 ***
dlmscentre:conditionbise2a 0.26804 0.18213 1.472 0.141
dlmscentre:conditionbise2c 0.17383 0.02828 6.146 7.94e-10 ***
the results are plausible;
there is a decreasing slope (dlmscentre); slope for e2c differs from the
slope of e2b.
More specifically, I'm interested to test the hypothesis:
Is there a slope difference between e2c vs (e2a pooled with e2b) ?
I first recoded conditionbis into a new factor: conditionBLOCKVOY
#model BLOCKVOY
glmer( cbind(rlet, rnlet) ~ dlmscentre * conditionBLOCKVOY +
nfcompo+(dlmscentre | subject),family=binomial, data=eglob_new)
summary(eglob_new_conditionBLOCKVOY_leger.glmer)
Generalized linear mixed model fit by the Laplace approximation
Formula: cbind(rlet, rnlet) ~ dlmscentre * conditionBLOCKVOY + nfcompo
+ (dlmscentre | subject)
Data: eglob_new
AIC BIC logLik deviance
2082 2122 -1033 2066
Random effects:
Groups Name Variance Std.Dev. Corr
subject (Intercept) 0.22843 0.47795
dlmscentre 0.34013 0.58321 0.336
Number of obs: 1200, groups: subject, 40
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.0001614 0.0891725 0.002 0.999
dlmscentre -0.7257465 0.0936049 -7.753 8.95e-15 ***
conditionBLOCKVOYe2c -0.0371947 0.0363233 -1.024 0.306
nfcompo 0.1324147 0.0215497 6.145 8.02e-10 ***
dlmscentre:conditionBLOCKVOYe2c 0.1702476 0.0281450 6.049 1.46e-09 ***
The interaction is significant: slope for e2c is different from the
slope for pooled (e2a ,e2b)
b)
I test the hypothesis by setting a specific contrast for conditionbis .
eglob_new$conditionbis -> eglob_new$conditionBLOCKVOYcontr
ginv( cbind(1,1,-2)) -> contrasts(eglob_new$conditionBLOCKVOYcontr)
> contrasts(eglob_new$conditionBLOCKVOYcontr)
[,1] [,2]
e2b 0.1666667 -7.071068e-01
e2a 0.1666667 7.071068e-01
e2c -0.3333333 -9.877082e-17
# model BLOCKVOYcontr
> summary(eglob_new_conditionBLOCKVOYcontr_leger.glmer)
Generalized linear mixed model fit by the Laplace approximation
Formula: cbind(rlet, rnlet) ~ dlmscentre * conditionBLOCKVOYcontr +
nfcompo + (dlmscentre | subject)
Data: eglob_new
AIC BIC logLik deviance
2083 2134 -1032 2063
Random effects:
Groups Name Variance Std.Dev. Corr
subject (Intercept) 0.22676 0.47619
dlmscentre 0.32138 0.56691 0.338
Number of obs: 1200, groups: subject, 40
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.01699 0.09165 -0.185 0.853
dlmscentre -0.71179 0.09540 -7.461 8.60e-14 ***
conditionBLOCKVOYcontr1 0.10297 0.16385 0.628 0.530
conditionBLOCKVOYcontr2 0.01756 0.11014 0.159 0.873
nfcompo 0.13241 0.02155 6.144 8.03e-10 ***
dlmscentre:conditionBLOCKVOYcontr1 -0.07966 0.18615 -0.428 0.669
dlmscentre:conditionBLOCKVOYcontr2 0.18949 0.12878 1.471 0.141
---
Correlation of Fixed Effects:
(Intr) dlmscn cBLOCKVOY1 cBLOCKVOY2 nfcomp d:BLOCKVOY1
dlmscentre 0.291
cnBLOCKVOY1 -0.247 -0.097
cnBLOCKVOY2 -0.262 -0.101 0.896
nfcompo -0.469 -0.004 0.000 0.000
d:BLOCKVOY1 -0.089 -0.299 0.294 0.316 0.000
d:BLOCKVOY2 -0.091 -0.308 0.307 0.320 0.001 0.953
dlmscentre:conditionBLOCKVOYcontr1, the interest interaction is not
significant.
the slope for (e2a+e2b) cannot be distinguished from the slope for e2c
I did'nt expect the same results for the model BLOCKVOY and the model
BLOCKVOYcontr,
but not such an opposite result .
There is a high correlation (0.953) between the two interaction
coefficients,
which means this last model is badly specified ?
Do I misunderstand something about contrasts ?
> sessionInfo()
R version 2.8.1 (2008-12-22)
i386-pc-mingw32
......
other attached packages:
[1] lme4_0.999375-28 Matrix_0.999375-21 lattice_0.17-17
Sorry for this long email, and thank you in advance
Regards
R. Espesser
Laboratoire Parole et Langage,CNRS et Université de Provence
13100 Aix-en-provence, France
More information about the R-sig-mixed-models
mailing list