[R-sig-ME] using lmer instead of 2-way repeated measure ANOVA for categorical response data
Robert Kushler
kushler at oakland.edu
Tue Jul 5 07:07:37 CEST 2011
Stefano,
In my opinion, a bar chart with error bars is not a good way to summarize the inferences.
Even when all of the required conditions are met (normality, proper standard error, uncontroversial
degrees of freedom calculation, ...) this display invites misuse. First of all, the usual practice
is to use an inappropriate individual 95% confidence level instead of simultaneous CIs with an
overall 95% level of confidence. Even when this is corrected (which is relatively easy to do),
the display is still invariably misinterpreted by readers who "test" for differences by comparing
the endpoints of the error bars to see if they overlap, which is not a proper way to make these
inferences. In general I recommend using the "multcomp" package to obtain CIs and/or p-values
for a set of meaningful comparisons (e.g. two main effects and an interaction contrast, or "simple
effects" for each factor holding the other fixed). Unfortunately there are several issues when
trying to do this for a mixed effects glm, so this is not an ideal solution in your case.
My second suggestion is that you try some models with separate random effects for the factors rather
than allowing them all to be correlated. I'm not sure what "(1 t|subject)" means, but I suggest
you try some or all of the following:
(1|subject) + (0+phase|subject)
(1|subject) + (0+contrast|subject)
(1|subject) + (0+phase|subject) + (0+contrast|subject)
There are several other options that allow some subset of the random effects to be correlated. All
of them are less complex than your "full" model, and some of them may work better for your data.
Regards, Rob Kushler
On 7/4/2011 3:54 PM, Stefano Guidi wrote:
> Hi to all,
>
> I am trying to analyze with lmer some data I collected in a fully factorial
> 2x2 experiment, with only within-subject factors and a categorical response
> variable (binomial).
>
> The structure of my dataset is the following:
>
>> str(ck1bis)
> 'data.frame': 1200 obs. of 8 variables:
> $ subject : Factor w/ 15 levels "s_01","s_02",..: 1 1 1 1 1 1 1 1 2 2 ...
> $ age : int 57 57 57 57 57 57 57 57 53 53 ...
> $ ori : Factor w/ 2 levels "l","r": 1 1 1 1 2 2 2 2 1 1 ...
> $ phase : Factor w/ 2 levels "different CP",..: 1 1 2 2 1 1 2 2 1 1 ...
> $ contrast: Factor w/ 2 levels "alto","basso": 1 2 1 2 1 2 1 2 1 2 ...
> $ variable: Factor w/ 10 levels "rep1","rep2",..: 1 1 1 1 1 1 1 1 1 1 ...
> $ value : Factor w/ 2 levels "left","right": 2 2 1 1 2 1 2 2 2 2 ...
> $ scelta : Factor w/ 2 levels "antizolner","zolner": 2 2 1 1 1 2 1 1 2 2
> ...
>
> The response variable is $scelta and the factors are $phase and $contrast.
> For each condition there are 10 repetitions, which become 20 given that I
> don't care about the factor %ori. I (think I have) succeeded in analyzing
> the data with glmer, using the following code:
>
> model<- lmer(scelta =="antizolner" ~ phase * contrast + (1 +
> phase*contrast| subject), data=ck1bis, family="binomial")
>
> The output reveals two significant main effects and no interaction (I have
> used treatment coding for the 2 factors). I have tried to simplify the
> random effect structure, fitting a model with only a random intercept
> [model2<- lmer(scelta =="antizolner" ~ phase * contrast + (1 t|
> subject)...], and then comparing the models with anova(model, model1) but it
> looks like all the random terms are necessary because the likelihood ratio
> test is significant.
>
> At this point I would like to be able to plot a barchart of the
> probabilities for the 4 conditions with error bar representing 95% CI, just
> I would do with the marginal means after an ANOVA, but I don't know how to
> do it. Can anyone help me with that? Thank you in advance.
>
> Stefano Guidi
> Post-doctoral fellow
> Communication Science Department
> University of Siena
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> 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