Author: Neal Snider

diagnosing the linger usb keyboard sampling error

Posted on Updated on

UPDATE: I have found that you can get around this problem completely by using a more sensitive keyboard. For example, there are gaming keyboards that advertise a 1ms sampling rate. Our lab has tested a “Razer Lycosa” keyboard and found that it works as advertised with Linger on an iMac, where the original keyboard had the sampling problem.

It’s been going around various email lists for a while that there is an error in Linger (an otherwise very nice program for running psycholinguistic experiments such as word-by-word reading time) when it’s (at least) run on a PC with a usb keyboard.  Here’s an email that Ted Gibson sent around:

 

Colin Philips brought this to our attention recently: there is a
problem that Linger has with sampling RTs for PC machines that use USB
keyboards.  RTs are sampled every 15-20ms, so some sensitivity is
lost.  One solution that works is to use PS/2 keyboards (that's what
we are currently doing in my lab).

 

To my knowledge, no one has determined whether this problem extends to other operating systems or processor architectures.  In this post, I describe how to determine whether your linger reading time data shows this problem, using R (but of course the algorithm could be applied to any stats or scripting package).

First, extract the last two digits of your raw reading time measurements (assuming your data is in the data frame rt, and the raw reading times are in the column rwrt):

rt$time2digit <- as.numeric(sapply(1:nrow(rt),FUN=function(i){substr(rt$rwrt[i],regexpr(“[0-9][0-9]$”,rt$rwrt[i])[1],regexpr(“[0-9][0-9]$”,rt$rwrt[i])[1]+attr(regexpr(“[0-9][0-9]$”,rt$rwrt[i]),”match.length”))}))

Now plot a histogram of this time2digit using 100 breaks:

hist(rt$time2digit,breaks=100)

Here is such a histogram for word-by-word RT data taken from a Dell PC running Windows XP with a USB keyboard:

Histogram of RTs, with sampling error
Histogram of RTs, with sampling error

The measurements are clearly discretized in 15-20 ms increments.  By contrast here is a histogram for word-by-word RT data (from a similar experiment) taken from a laptop PC (I don’t know the brand) running Linux:

Histogram of RTs, without sampling error
Histogram of RTs, without sampling error

Each of the possible 100 numbers are pretty much equally distributed (although I’m not sure what’s going on with 00).  

The discretization is actually visible in raw RTs (without taking only the last 2 digits), but you need to zoom in on the histogram a lot.  This technique makes it very easy to spot the problem, and determine if your equipment is susceptible to the Linger USB keyboard sampling bug.