[R] Question about Linear Mixed-Models (in R)

Shravan Vasishth vasishth at ling.ohio-state.edu
Sun Mar 17 15:42:05 CET 2002

Hi all,

This question is about using the linear-mixed effects model for a
within-subjects experiment.

The experiment description:

Each subject was asked to read a series of sentences (in Hindi) on a
computer screen, and pressed the space bar to see each word in the
sentence successively. The amount of time spent on each word was recorded
on the computer, in milliseconds; this is the dependent variable.

Each subject saw two levels of a factor "Case" (which means presence or
absence of case-marking on a given word) and saw each level 4 times (hence
8 data-points for each subject). "Word Length" is essentially a continuous
variable that varies for each word. The important words in each stimulus
sentence (the words that may or may not have case marking) always occurred
in position three in the sentence, so I consider only those words' reading
times. The research question is: does presence of case-marking on this
third word affect reading time?  Since adding case-marking increases the
length of the word per se (in general), a statistician suggested I use a
linear mixed-effects model, so that the potential confound of word length
can be dealt with.

Here's part of the data:

    subj case  raw wl
1      1    1 1138  3
2      1    1  487  3
3      1    1  782  5
4      1    1  896  5
5      1    3 1138  6
6      1    3 1311  8
7      1    3 3023  7
8      1    3  809  7
9      2    1  440  3
10     2    1  526  3
11     2    1  620  5
12     2    1  688  5
13     2    3 1829  8
14     2    3  518  7
15     2    3  726  7
16     2    3  805  6

and so on (there are 44 subjects).

In the data excerpt above, "subj" means the subject number, "case" is
case-marking absent/present (1 for absent, 3 for present-- I just chose
these two numbers arbitrarily), "raw" is the raw reading time for that
particular word, and "wl" is the word length associated with that word.

The question:

Reading a couple of books (but mainly the Pinheiro and Bates book,
Mixed-Effects Models in S and S-PLUS), it seems that I simply need to say
the following to R, using the linear mixed effects library (nlme) in R:

lme1 <- lme(raw ~ case*wl, data = exptdata, random = ~1|subj)

Does this make sense in this case?

If so, the results of this are as follows:

> lme1 <- lme(raw ~ case*wl, data = exptdata, random = ~1|subj)
> anova(lme1)
            numDF denDF   F-value p-value
(Intercept)     1   305 260.71072  <.0001
case            1   305  21.86372  <.0001
wl              1   305   3.50046  0.0623
case:wl         1   305   2.46480  0.1175

This means that there is a main effect of case-marking. There's a near
significant effect of word length (i.e., word length per se probably does
affect reading time?).  This means that case marking does affect reading
time, over and above any effect of word length per se-- which was the
research question.

BTW, an alternative to using the mixed effects model is to use residuals
instead of raw reading times, but Maxwell and Delaney's book (Designing
Experiments and Analyzing Data, 2000, p. 391) suggests that's the wrong
thing to do, because it does not give least squares estimates. Sure
enough, I get odd results when I use residuals.

Thanks, and apologies for bothering all of you with this,

Shravan Vasishth

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list