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
n <- NUMBER-OF-WORDS-SPILL-OVER
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)
Advertisements

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 […]

    Like

    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

    Like

      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()).

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

      HTH?

      Florian

      Like

        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)

        ID,Item,RT,CharLen
        A1675D95NJ1YDD,You,515,3
        A1675D95NJ1YDD,don’t,454,5
        A1675D95NJ1YDD,have,409,4
        A1675D95NJ1YDD,to,403,2
        A1675D95NJ1YDD,watch,466,5
        A1675D95NJ1YDD,all,432,3

        Like

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

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

          Like

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