Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to track down the source of some wonky data. The data are response times (RTs) collected from humans using a computer keyboard. Here's a histogram of the RTs, binned to 1ms:


Obvious is a skew in the data, which is expected/known for such data. However, also noticeable is a slight "ghosting" of the image. Zooming in we see:


There appears to be some phenomenon such that the probability of observing an RT at a given time point fluctuates across time in a cyclical manner. This is also evident in the empirical cumulative density function (suggesting that the phenomenon is about data, not the binning algorithms of the histograms):


To determine the nature of this cyclicality, I computed the 2nd derivative of the ecdf (actually, I've never taken calculus, so I simply computed diff(diff(y)) in R), yielding the following waveform (again, zoomed in to show details):


I actually encountered a similar phenomenon in the past and at that time my googling seemed to suggest that a periodogram would help me determine the Hz values at which something was happening to cause this phenomenon. I found some R code for a periodogram:

periodogram <- function(x) {
    n <- length(x)
    Mod(fft(x))[1:(n%/%2 + 1)]^2 / (2*pi*n)

    x = 1:((length(rt)/2)+1)
    , y = periodogram(ddy)
    , type = 'l'

which yields:


However, I'm not sure what the x-axis is supposed to be. Hz seems reasonable, but doesn't seem to fit with my impression from the histograms that the phenomenon has a cycle of about 100Hz. Any help providing clarification on the x-axis of this plot would be greatly appreciated.

(For those with interest in this over-and-above the math, if I do find that the phenomenon has a 100Hz or thereabouts frequency, then I'm pretty sure it can be attributable to the polling rate of the USB keyboard, plus a little random error here and there in other aspects of timing)

share|cite|improve this question

What is your sampling interval? Looking at your second graph, it appears there is something in your acquisition that makes it much more probable to measure times that are at about 7.5 or 8 millisecond intervals than times in between. One approach is to figure out the spacing and bin at this interval.

The periodogram shows frequencies where there is lots of energy in the data. It looks like the peak at 1000 would correspond to 1/(8 msec) or about 120 Hz. Does that correspond to your sampling?

share|cite|improve this answer
The program collecting the RTs attempts to sample as quickly as possible (then rounds to the nearest millisecond), hence my suspicion that the cyclical phenomenon is simply a manifestation of the polling rate of the usb keyboard. If I knew precisely the Hz value at which those periodogram peaks manifest, I would be able to confirm this suspicion. – Mike Lawrence Dec 21 '10 at 14:45

How about the plot as below?

    x = (2*pi/n)*1:((length(rt)/2)+1)
    , y = periodogram(ddy)
    , type = 'l'
share|cite|improve this answer
Welcome! Here is a MathJax tutorial. – k170 Sep 3 '14 at 3:26
@k170 Seeing as this is not a math formula, MathJax would not help much... – ᴡᴏʀᴅs Sep 3 '14 at 5:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.