[R-lang] Re: lmer sliding contrasts

T. Florian Jaeger tiflo@csli.stanford.edu
Sat Apr 5 07:58:04 PDT 2014


Just contrast code all three IVs.

contrast(a) =contr.sum(2)
Etc

Then --collinearity w the covariate aside-- the main effect in the model
for left vs right tells you what you want to know.

a * b* c + covariate.

That's under the assumption that your data is balanced.

If you also want to know whether the simple effects of left right are
significant for all four cells defined  by the other two factors, do

a * b * c - a + covariate.

Assuming "a" is left to right

Hth?

F
On Apr 5, 2014 1:45 AM, "Ray Becker" <raybecker@gmail.com> wrote:

> Hi Florian,
>
> I am trying to do follow-up test of a significant 3-way interaction, but
> still control for the a fourth variable as a covariate. That is the
> difference between using the + instead of a *, correct? Maybe I should
> include the interaction just to be safe.
>
> With the sliding contrasts, I am mainly looking for differences between
> left and right responses, which means the difference between pairs 1-2,
> 3-4, 5-6, and 7-8. So, I am not really testing an ordering hypothesis, but
> just doing four paired contrasts.
>
> I have tried subsetting my data into the two conditions where my sliding
> contrast showed an effect. I made one dataset with only plural-subject NP
> sentences and high-WM participants, and one with low-WM participants. Then
> I did an lmer with only response location as a fixed effect, and found
> almost the same values for the t-tests as the lmer with the full dataset
> using sliding contrasts. It seems less likely that I am looking at the
> wrong t-test for a pair of means, and maybe something wrong with my data.
>
> Thanks for replying.
>
> Best,
> -Ray
>
>
> On Sat, Apr 5, 2014 at 4:22 AM, T. Florian Jaeger <tiflo@csli.stanford.edu
> > wrote:
>
>> Hi Ray,
>>
>> I'm having trouble following the details of your message. perhaps you
>> could elaborate. when you said you used + instead of * that, of course,
>> might matter. one is the interaction (*), the other is two main effects.
>>
>> I also don't follow the sliding effects coding. are you testing a
>> ordering hypothesis?
>>
>> F
>>
>>
>> On Thursday, April 3, 2014, Ray Becker <raybecker@gmail.com> wrote:
>>
>>> Hi everyone,
>>>
>>> I have a problem with my sliding contrasts, and need some help. The
>>> means of the descriptive statistics and t-values from the contrasts are not
>>> adding up. For example, I have run the omnibus lmer and found a significant
>>> 3-way interaction (WMGroup x number x response location), t(30) = 2.89; p <
>>> 0.05. My DV is response time, my IVs are high- vs. low-working memory, the
>>> grammatical number of the subject noun phrase (singular vs. plural), and
>>> left vs. right response location). After the omnibus lmer, I did sliding
>>> contrasts to test the simple main effects between left vs. right responses
>>> (labeled 'corans' below). First, I code my contrasts into one variable,
>>> 'cond':
>>>
>>> tme3wcorx$cond <- ifelse(tme3wcorx$WMGroup == 'LOW' &
>>> tme3wcorx$sing_plur == 'p' & tme3wcorx$corans == 8, 100,
>>> ifelse(tme3wcorx$WMGroup == 'LOW' & tme3wcorx$sing_plur == 'p' &
>>> tme3wcorx$corans == 7, 101,
>>> ifelse(tme3wcorx$WMGroup == 'LOW' & tme3wcorx$sing_plur == 's' &
>>> tme3wcorx$corans == 8, 102,
>>> ifelse(tme3wcorx$WMGroup == 'LOW' & tme3wcorx$sing_plur == 's' &
>>> tme3wcorx$corans == 7, 103,
>>> ifelse(tme3wcorx$WMGroup == 'HIGH' & tme3wcorx$sing_plur == 'p' &
>>> tme3wcorx$corans == 8, 104,
>>> ifelse(tme3wcorx$WMGroup == 'HIGH' & tme3wcorx$sing_plur == 'p' &
>>> tme3wcorx$corans == 7, 105,
>>> ifelse(tme3wcorx$WMGroup == 'HIGH' & tme3wcorx$sing_plur == 's' &
>>> tme3wcorx$corans == 8, 106,
>>> ifelse(tme3wcorx$WMGroup == 'HIGH' & tme3wcorx$sing_plur == 's' &
>>> tme3wcorx$corans == 7, 107, NA))))))))
>>>
>>> Then I scale and apply the contrast codes:
>>> tme3wcorx$condcent <- scale(tme3wcorx$cond)
>>> tme3wcorx$condcentf <- factor(tme3wcorx$condcent)
>>> c.sliding <- contr.sdif(8)
>>> contrasts(tme3wcorx$condcentf) <- c.sliding
>>>
>>> Lastly, I run the lmer with the coded variable now called 'condcentf'
>>> with the other fixed effect 'TenseCent' (verb tense) as a covariate by
>>> using a '+' instead of '*' as I did in the omnibus lmer.
>>>
>>>
>>>
>>>
>>> I don't think that matters, but maybe someone might find fault with this
>>> approach.
>>> tme3RESPCONTRASTS.lmer1 <- lmer(Resptime ~ condcentf + TenseCent
>>>  + (1|RECORDING_SESSION_LABEL) + (1|Stimnum), data=tme3wcorx)
>>>
>>> The two significant differences I find are both for plural-subject noun
>>> phrase sentences.
>>> In the low-WM group, participants are reliably faster when the response
>>> is on the right (M = 3409; SD = 624) compared to the left (M = 3410; SD =
>>> 642; t(30) = -3.20)
>>>
>>> In the high-WM group, participants are reliably faster when the response
>>> is on the right (M = 3071; SD = 718) compared to the left (M = 3132; SD =
>>> 722; t(30) = 4.36)
>>>
>>> I haven't calculated p-values yet, but consider any t-value over +/-2
>>> significant at the 0.05 level. The problem, as you can see, is not only do
>>> the first set of means only differ by < 1ms, but the difference is in the
>>> same direction as the other set of means. So the t-values should not be
>>> negative and positive, but the same sign.
>>>
>>> Please let me know if you can see what I am doing wrong with my sliding
>>> contrasts. Other comments on problems with how I am doing this analysis are
>>> also welcome. Thank you in advance.
>>>
>>> Best,
>>> -Ray
>>>
>>
>>
>> --
>> Sent from Gmail Mobile
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucsd.edu/pipermail/ling-r-lang-l/attachments/20140405/5143c8f5/attachment-0001.html 


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