[R-lang] Re: comparisons in lmer

Marina Sherkina-Lieber marina.cherkina@utoronto.ca
Mon Jan 17 08:46:07 PST 2011


Thank you, Andy!
What is the difference between lmer and glmer?
And it would help if you decipher parts of the command for the Tukey test.
Marina

Quoting Andy Fugard <andyfugard@gmail.com>:

> On Wed, Jan 12, 2011 at 6:06 PM, Maureen Gillespie <
> gillespie.maureen@gmail.com> wrote:
>
>> What if you DO want to do a bunch of paired tests and your coding scheme
>> isn't going to get at them all in one go? What is the best way of doing
>> this? Run multiple models on subsets of the data, then adjust/correct for
>> multiple comparisons?
>
>
>
> You could use Tukey's all-pairwise comparisons via glht in the multcomp
> package.  For instance:
>
>>
>> require(languageR)
>> require(multcomp)
>>
>>
>> M1 = glmer(CaseMarking ~ WordOrder * AgeGroup +
> +   AnimacyOfSubject + Text + (1|Speaker),
> +   family = "binomial", data = warlpiri)
>> M1
> Generalized linear mixed model fit by the Laplace approximation
> Formula: CaseMarking ~ WordOrder * AgeGroup + AnimacyOfSubject + Text +
> (1 | Speaker)
>    Data: warlpiri
>    AIC BIC logLik deviance
>  296.2 327 -140.1    280.2
> Random effects:
>  Groups  Name        Variance Std.Dev.
>  Speaker (Intercept) 0.46023  0.6784
> Number of obs: 347, groups: Speaker, 27
>
> Fixed effects:
>                                      Estimate Std. Error z value Pr(>|z|)
>
> (Intercept)                           -2.7731     0.4659  -5.952 2.65e-09
> ***
> WordOrdersubNotInitial                 0.2731     0.5025   0.543   0.5868
>
> AgeGroupchild                          1.2059     0.4726   2.552   0.0107 *
>
> AnimacyOfSubjectinanimate              0.6406     0.3822   1.676   0.0938 .
>
> Texttextb                              0.2887     0.4833   0.597   0.5503
>
> Texttextc                              0.7376     0.4237   1.741   0.0817 .
>
> WordOrdersubNotInitial:AgeGroupchild  -1.8233     0.7382  -2.470   0.0135 *
>
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> Correlation of Fixed Effects:
>             (Intr) WrdONI AgGrpc AnmcOS Txttxtb Txttxtc
> WrdOrdrsbNI -0.341
> AgeGropchld -0.594  0.371
> AnmcyOfSbjc -0.031 -0.052  0.041
> Texttextb   -0.478 -0.040 -0.039 -0.137
> Texttextc   -0.568 -0.033 -0.009 -0.311  0.606
> WrdOrdNI:AG  0.249 -0.674 -0.434 -0.069  0.053   0.026
>>
>> summary(glht(M1, linfct=mcp(Text="Tukey")))
>
>          Simultaneous Tests for General Linear Hypotheses
>
> Multiple Comparisons of Means: Tukey Contrasts
>
>
> Fit: glmer(formula = CaseMarking ~ WordOrder * AgeGroup + AnimacyOfSubject +
>
>     Text + (1 | Speaker), data = warlpiri, family = "binomial")
>
> Linear Hypotheses:
>                    Estimate Std. Error z value Pr(>|z|)
> textb - texta == 0   0.2887     0.4833   0.597    0.821
> textc - texta == 0   0.7376     0.4237   1.741    0.188
> textc - textb == 0   0.4490     0.4063   1.105    0.509
> (Adjusted p values reported -- single-step method)
>
> Cheers,
>
> Andy
>
> --
> Dr Andy Fugard
> http://www.andyfugard.info
>



-- 
Marina Sherkina-Lieber
Ph.D. candidate
Dept. of Linguistics
University of Toronto




More information about the ling-r-lang-L mailing list