Publishable Stuff

Rasmus Bååth's Research Blog

Bayesian Modeling of Anscombe’s Quartet

Anscombe’s quartet is a collection of four datasets that look radically different yet result in the same regression line when using ordinary least square regression. The graph below shows Anscombe’s quartet with imposed regression lines (taken from the Wikipedia article).

Ancombe's Quartet

While least square regression is a good choice for dataset 1 (upper left plot) it fails to capture the shape of the other three datasets. In a recent post John Kruschke shows how to implement a Bayesian model in JAGS that captures the shape of both data set 1 and 3 (lower left plot). Here I will expand that model to capture the shape of all four data sets. If that sounds interesting start out by reading Kruschke’s post and I will continue where that post ended…

Ok, using a wide tailed t distribution it was possible to down weight the influence of the outlier in dataset 3 while still capturing the shape of dataset 1. It still fails to capture datasets 2 and 4 however. Looking at dataset 2 (upper right plot) it is clear that we would like to model this as a quadratic curve and what we would like to do is to allow the model to include a quadratic term when the data supports it (as dataset 2 does) and refrain from including a quadratic term when the data supports a linear trend (as in datasets 1 and 3). A solution is to include a quadratic term (b2) with a spike and slab prior distribution which is a mixture between two distributions one thin (spiky) distribution and one wide (slab) distribution. By centering the spike over zero we introduce a bit of automatic model selection into our model, that is, if there is evidence for a quadratic trend in the data then the slab will allow this trend to be included in the model, however, if there is little evidence for a quadratic trend then the spike will make the estimate of b2 practically equivalent to zero. In JAGS such a prior can be implemented as follows:

b2 <- b2_prior[b2_pick + 1]
b2_prior[1] ~ dnorm(0, 99999999999999) # spike
b2_prior[2] ~ dnorm(0, 0.1) # slab
b2_pick ~ dbern(0.5)

The argument to the dbern function indicates our prior belief that the data includes a quadratic term, in this case we think the odds are 50/50. The resulting prior looks like this:

Technical report: Construction of a Low Latency Tapping Board.

I’ve used the really sweet Arduino prototyping platform to construct a high precision, low latency tapping board to be used when measuring finger tapping. The details are found in this technical report.


This technical report describes the construction of a tapping board to be used in sensorimotor synchronization tasks where the timing of participants’ taps are to be registered. The tapping board is designed to be comfortable to use and to register taps with millisecond accuracy.

Subjective Difficulty of Tapping to a Slow Beat

A short paper I presented at the 12th International Conference on Music Perception and Cognition , Thessaloniki, Greece. A great conference, by the way, except for the heat…


The current study investigates the slower limit of rhythm perception and participants subjective difficulty when tapping to a slow beat. Thirty participants were asked to tap to metronome beats ranging in tempo from 600 ms to 3000 ms between each beat. After each tapping trial the participants rated the difficulty of keeping the beat on a seven point scale ranging from “very easy” to “very difficult”. The result strongly support the notion that subjective difficulty increased with slower tempo as this was the case for all participants. While rated difficulty increased monotonically as a function of tempo the largest increase was between the tempo of 1200 ms and 1800 ms. This is in line with earlier reports on where tapping starts to feel laborious and supports the notion that there is a qualitative difference between tapping at fast (< 1200 ms between each beat) and slow (> 2400 between each beat) tempi. A mixed model analysis showed that tempo, tapping error and percentage of reactive responses all affected the participants rating of difficulty. Of these, tempo was by far the most influential factor, still participants were, to some degree, sensitive to their own tapping errors which then influenced their subsequent difficulty rating.


Bååth, R., Madison, G. (2012) The Subjective Difficulty of Tapping to a Slow Beat. Proceedings of the 12th International Conference on Music Perception and Cognition and the 8th Triennial Conference of the European Society for the Cognitive Sciences of Music.

Eye Tapping

A short paper I presented at the International Conference on New Interfaces for Musical Expression (NIME), 30 May – 1 June 2011, Oslo, Norway. This paper was heavily inspired by Hornof, A., & Vessey, K. (2011).


The aim of this study was to investigate how well subjects beat out a rhythm using eye movements and to establish the most accurate method of doing this. Eighteen subjects participated in an experiment were five different methods were evaluated. A fixation based method was found to be the most accurate. All subjects were able to synchronizetheir eye movements with a given beat but the accuracy was much lower than usually found in finger tapping studies. Many parts of the body are used to make music but so far, with a few exceptions, the eyes have been silent. The research presented here provides guidelines for implementing eye controlled musical interfaces. Such interfaces would enable performers and artists to use eye movement for musical expression and would open up new, exiting possibilities. full_paper_pdf


Hornof, A., & Vessey, K. (2011). The sound of one eye clapping: Tapping an accurate rhythm with eye movements. Proceedings of the 55nd Annual Meeting of the Human Factors and Ergonomics Society, to appear.

Robert MacDougall’s “The Structure of Simple Rhythm forms”, 1903.

After much googling I finally found a copy of Robert MacDougall’s “The Structure of Simple Rhythm forms” from 1903. It was hidden in Harvard Psychological Studies, Volume 1 now freely available from Project Gutenberg ( . Since it seems the book is now in the public domain I took the liberty to convert “The Structure of Simple Rhythm forms” into pdf-format and post it here so that it might be more easily found in the future.

MacDougall, R. (1903). The structure of simple rhythm forms. Psychological Monographs. American Psychological Association. pdf

BibTeX reference:

  title={The structure of simple rhythm forms.},
  author={MacDougall, R.},
  journal={Psychological Monographs},
  publisher={American Psychological Association}

ChildFreq: a Tool to Explore Word Frequencies in Child Language.

Have you ever wondered if children prefer bananas over candy or when their fascination for dinosaurs kick in? These are the kinds of questions you can get answered on my new webpage ChildFreq. Using a huge child language database ChildFreq shows you what words children use at what age. Let’s look at some querries and let’s start with banana vs. candy.

Frequencies of candy and banana.

Seems like Banana start out as the leader but then Candy gains speed, passes Banana at around 30 months and finishes as the winner with a good marginal, go Candy! So how about dinosaurs? Let’s look at dino* vs. cat (the star works as a wildcard).

Frequencies of Dino* vs. Cat

Here Dino starts out basically on the bottom, but works itself steadily upwards and manages to pass Cat with a slim marginal just before 60 months!

Jokes aside, ChildFreq is a great (and fun) tool if you are interested in child language. You can watch the development of any words, construct advanced queries with wild cards and aggregations, you can split queries by gender and more. Check it out on !