Spill-over effects in self-paced reading

Posted on Updated on

I’ve been working on some R-code for spill-over analysis for self-paced reading experiments. I’ll be posting the actual analysis a later. Here’s some code that adds the spill-over from previous words to each word:

# create spill-over matrix of log raw RTs of previous n words
data <- YOURDATA
spillrange <- 1:n
lsr <- length(spillrange)
spillover <- matrix(0,nrow= nrow(data), ncol=lsr, dimnames=list(1:nrow(data),
             paste("SPILLOVER",spillrange, sep="_")))
pos <- data$Wpos
lrt <- data$logRT
for(i in 1:nrow(data)) {
  lookback <- min(lsr, pos[i] - 1)
  spillover[i,] <- append(lrt[i -
                   spillrange[seq(1,lookback, length.out=lookback)]],
                   rep(NA, lsr - lookback))
# update datasets
YOURDATA <- cbind(data, spillover)
rm(lookback, lsr, spillrange, pos, lrt, spillover)

5 thoughts on “Spill-over effects in self-paced reading

    […] residuals of that model are used as dependent variable for the second model and spill-over variables are entered into the model, along with the experimental manipulations. For […]


    Luca Onnis said:
    September 13, 2013 at 11:36 am

    Hi, I`d be interested in reproducing the two-step procedure. What is the format of the “YOURDATA” file to be input above? could you provide the first 10 lines of an example file? Cheers


      tiflo said:
      September 13, 2013 at 12:30 pm

      Hi Luca,

      oh, YOURDATA was assumed to be a data.frame. So you still need to read in some data.frame from, for example, a comma-separated file (in that case with read.csv()).

      data = read.csv(file = "YOURFILENAME.csv")




        Luca Onnis said:
        September 13, 2013 at 12:38 pm

        yes thanks, I assumed it was a data frame but not sure how many columns and what goes in the rows and the columns? Is it something like this, where ID = subject ID, Item = word, RT = raw RT, CharLen = the length of a word in characters. (Perhaps you posted this info somewhere else on the blog)



          tiflo said:
          September 13, 2013 at 3:11 pm

          I was assuming Linger output. So, yes, you’re on the right track.


Questions? Thoughts?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s